-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Closed
Labels
Description
I did this
Using curl with alt-svc support compiled in:
$ curl --alt-svc test.txt https://integralblue.com
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://www.integralblue.com/">here</a>.</p>
<hr>
<address>Apache Server at integralblue.com Port 443</address>
</body></html>
$ curl --alt-svc test.txt https://integralblue.com
curl: (7) Failed to connect to 3dbbdetxoyw4nsp6c3cc456oj2aysmzhbfzz6s43ezxzsfxxri3h5xqd.onion port 443: Connection refused
https://integralblue.com uses an alt-svc header pointing to a tor .onion address. Cloudflare does this too: https://blog.cloudflare.com/cloudflare-onion-service/
I expected the following
The second curl invocation should have worked.
According to https://tools.ietf.org/html/rfc7838#section-2.4
Furthermore, if the connection to the alternative service fails or is
unresponsive, the client MAY fall back to using the origin or another
alternative service.
So falling back is okay.
I can see a few of approaches:
- Only add the alt-svc to the cache when curl determines that the service is reachable. This is what Chrome and Firefox do.
- Always add the alt-svc to cache (which is what curl does today), but then fall back to the original origin if the alt-svc isn't reachable. This is like how the IPv6 to IPv4 fallback works.
curl/libcurl version
$ curl --version
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1d zlib/1.2.11 brotli/1.0.7 libidn2/2.3.0 libssh2/1.9.0_DEV nghttp2/1.40.0 quiche/0.2.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Largefile libz Metalink NTLM SSL TLS-SRP UnixSockets
operating system
$ uname -a
Linux irrational 5.4.0-rc6 #2 SMP Fri Nov 8 19:09:49 EST 2019 x86_64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz GenuineIntel GNU/Linux