Re: bug in ftp(1)?

2024-02-18 Thread Thomas Klausner
On Sun, Feb 18, 2024 at 12:19:57PM -, Michael van Elst wrote:
> w...@netbsd.org (Thomas Klausner) writes:
> 
> >ftp: Receiving HTTP reply: Input line is too long
> 
> #define   FTPBUFLEN   (4 * MAXPATHLEN)
> char buf[FTPBUFLEN];
> 
> That's 4kB.
> 
> >curl -v https://sourceforge.net/projects/courier/files/courier-unicode/2.3.=
> >0/courier-unicode-2.3.0.tar.bz2
> 
> This returns a 5kB HTTP header "content-security-policy".
> 
> There is no protocol limit, but common server implementations do limit header
> lines to something between 4k (some nginx versions) to 48k (tomcat).

Thanks for the analysis. I've increased the size to 16kB.
 Thomas


Re: bug in ftp(1)?

2024-02-18 Thread Christos Zoulas
In article ,
Thomas Klausner   wrote:
>Hi!
>
>When fetching the distfile for mail/courier-unicode, I see:
>
>=> Bootstrap dependency digest>=20211023: found digest-20220214
>=> Fetching courier-unicode-2.3.0.tar.bz2
>=> Total size: 657354 bytes
>Trying [2606:4700:4400::ac40:9691]:443 ...
>Requesting
>https://sourceforge.net/projects/courier/files/courier-unicode/2.3.0/courier-unicode-2.3.0.tar.bz2
>ftp: Receiving HTTP reply: Input line is too long
>fetch: Unable to fetch expected file courier-unicode-2.3.0.tar.bz2
>...
>
>wget fetches the file fine.

On HEAD you can use -b now.

christos



Re: bug in ftp(1)?

2024-02-18 Thread Michael van Elst
w...@netbsd.org (Thomas Klausner) writes:

>ftp: Receiving HTTP reply: Input line is too long

#define   FTPBUFLEN   (4 * MAXPATHLEN)
char buf[FTPBUFLEN];

That's 4kB.

>curl -v https://sourceforge.net/projects/courier/files/courier-unicode/2.3.=
>0/courier-unicode-2.3.0.tar.bz2

This returns a 5kB HTTP header "content-security-policy".

There is no protocol limit, but common server implementations do limit header
lines to something between 4k (some nginx versions) to 48k (tomcat).



bug in ftp(1)?

2024-02-18 Thread Thomas Klausner
Hi!

When fetching the distfile for mail/courier-unicode, I see:

=> Bootstrap dependency digest>=20211023: found digest-20220214
=> Fetching courier-unicode-2.3.0.tar.bz2
=> Total size: 657354 bytes
Trying [2606:4700:4400::ac40:9691]:443 ...
Requesting 
https://sourceforge.net/projects/courier/files/courier-unicode/2.3.0/courier-unicode-2.3.0.tar.bz2
ftp: Receiving HTTP reply: Input line is too long
fetch: Unable to fetch expected file courier-unicode-2.3.0.tar.bz2
...

wget fetches the file fine.

curl -v gives some more information on the return value:


curl -v 
https://sourceforge.net/projects/courier/files/courier-unicode/2.3.0/courier-unicode-2.3.0.tar.bz2
* Host sourceforge.net:443 was resolved.
* IPv6: 2606:4700:4400::ac40:9691, 2606:4700:4400::6812:256f
* IPv4: 104.18.37.111, 172.64.150.145
*   Trying [2606:4700:4400::ac40:9691]:443...
* Connected to sourceforge.net (2606:4700:4400::ac40:9691) port 443
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
*  CAfile: none
*  CApath: /etc/openssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / X25519 / 
id-ecPublicKey
* ALPN: server accepted h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; 
CN=sourceforge.net
*  start date: Feb  4 00:00:00 2024 GMT
*  expire date: Dec 31 23:59:59 2024 GMT
*  subjectAltName: host "sourceforge.net" matched cert's "sourceforge.net"
*  issuer: C=US; O=Cloudflare, Inc.; CN=Cloudflare Inc ECC CA-3
*  SSL certificate verify ok.
*   Certificate level 0: Public key type EC/prime256v1 (256/128 Bits/secBits), 
signed using ecdsa-with-SHA256
*   Certificate level 1: Public key type EC/prime256v1 (256/128 Bits/secBits), 
signed using sha256WithRSAEncryption
*   Certificate level 2: Public key type RSA (2048/112 Bits/secBits), signed 
using sha1WithRSAEncryption
* using HTTP/2
* [HTTP/2] [1] OPENED stream for 
https://sourceforge.net/projects/courier/files/courier-unicode/2.3.0/courier-unicode-2.3.0.tar.bz2
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: sourceforge.net]
* [HTTP/2] [1] [:path: 
/projects/courier/files/courier-unicode/2.3.0/courier-unicode-2.3.0.tar.bz2]
* [HTTP/2] [1] [user-agent: Mozilla/5.0]
* [HTTP/2] [1] [accept: */*]
> GET 
> /projects/courier/files/courier-unicode/2.3.0/courier-unicode-2.3.0.tar.bz2 
> HTTP/2
> Host: sourceforge.net
> User-Agent: Mozilla/5.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 301
< date: Sun, 18 Feb 2024 11:09:47 GMT
< content-type: text/html; charset=UTF-8
< location: 
https://sourceforge.net/projects/courier/files/courier-unicode/2.3.0/courier-unicode-2.3.0.tar.bz2/
< cache-control: no-cache
< pragma: no-cache
< x-ua-compatible: IE=edge,chrome=1
< permissions-policy: geolocation=(), microphone=(), camera=(), payment=(), 
document-domain=(), display-capture=(), autoplay=()
< feature-policy: geolocation 'none'; microphone 'none'; camera 'none'; payment 
'none'; document-domain 'none'; display-capture 'none'; autoplay 'none'
< x-frame-options: SAMEORIGIN
< content-security-policy: frame-ancestors 'self'; script-src 'self' 
adservice.google.co.jp adservice.google.co.tz adservice.google.nr *.crsspxl.com 
adservice.google.ge adservice.google.com.gi adservice.google.com.br 
adservice.google.com.tr adservice.google.so adservice.google.com.pe 
adservice.google.com.sb adservice.google.st *.sharethrough.com 
adservice.google.com.co adservice.google.com.pk adservice.google.ad 
adservice.google.cv adservice.google.ws adservice.google.gm adservice.google.gy 
adservice.google.tn adservice.google.no adservice.google.rs *.gstatic.cn 
*.googlesyndication.com adservice.google.com.bn adservice.google.tm 
http://c.sf-syn.com translate.googleapis.com adservice.google.com.my 
adservice.google.as *.google.com adservice.google.com.tw *.2mdn.net 
adservice.google.de adservice.google.lu adservice.google.com.hk 
adservice.google.pl adservice.google.gg adservice.google.tt 
adservice.google.com.pa adservice.google.vu adservice.google.co.ve 
adservice.google.fi adservice.google.mu adservice.google.vg adservice.google.to 
adservice.google.co.th adservice.google.iq adservice.google.ml 
adservice.google.com.bo adservice.google.com.ai adservice.google.com.uy 
adservice.google.ro adservice.google.ae adservice.google.cg *.trustarc.com 
adservice.google.co.bw adservice.google.tg adservice.google.com.eg *.tiny.cloud 
adservice.google.rw adservice.google.cz adservice.google.gr 
adservice.google.co.id