atward: redirect location missing for certain URLs

#135
Opened by sterni at 2021-07-25T21·57+00

Tried to open //fun/ὗ0️/ via atward which firefox urlencodes into https://at.tvl.fyi/?q=%2F%2Ffun%2F%F0%9F%95%B0%EF%B8%8F%2F. Redirect doesn't work since apparently then the Location header is missing:

$ curl -v 'https://at.tvl.fyi/?q=%2F%2Ffun%2F%F0%9F%95%B0%EF%B8%8F%2F'
*   Trying 2a01:4f8:242:5b21:0:feed:edef:beef:443...
* Connected to at.tvl.fyi (2a01:4f8:242:5b21:0:feed:edef:beef) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* 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
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=atward.tvl.fyi
*  start date: Jul  3 16:02:55 2021 GMT
*  expire date: Oct  1 16:02:54 2021 GMT
*  subjectAltName: host "at.tvl.fyi" matched cert's "at.tvl.fyi"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x936960)
> GET /?q=%2F%2Ffun%2F%F0%9F%95%B0%EF%B8%8F%2F HTTP/2
> Host: at.tvl.fyi
> user-agent: curl/7.76.1
> accept: */*
> 
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 303 
< server: nginx
< date: Sun, 25 Jul 2021 21:55:20 GMT
< content-length: 0
< permissions-policy: interest-cohort=()
< 
* Connection #0 to host at.tvl.fyi left intact

Probably the multi-byte UTF-8 encoded characters used are an issue, but haven't tried to narrow it down further.