Skip to content

http: build the Host header from an address in authority form - #11

Open
david-yu wants to merge 1 commit into
ipv6/09-listen-unspecifiedfrom
ipv6/10-http-host-authority
Open

david-yu wants to merge 1 commit into
ipv6/09-listen-unspecifiedfrom
ipv6/10-http-host-authority

Conversation

@david-yu

@david-yu david-yu commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Part 10 of 10 of the IPv6 series, split out of #1 and rebased on current scylladb/seastar master. Based on #10, so the diff here is only this PR's commit.

Why

request::make takes the Host header as a string, so a caller with a socket_address formats it, and the obvious "{}:{}" gives fd00::5:8080 for IPv6: a different address, not an authority (RFC 3986 §3.2.2 wants [fd00::5]:8080).

What

  • http: build the Host header from an address in authority form (02c5867b2) — http::internal::format_authority(), which brackets IPv6 and drops a zone index (an authority cannot carry one), and request::make overloads taking a socket_address. The string overloads are unchanged.

Testing

test_format_authority: 10.0.0.1:80 unchanged, [2001:db8::1]:8080 bracketed, fe80::1%2 loses its zone, and request::make puts exactly that in Host and the URL.

On the core-aws VM (Ubuntu 24.04, GCC 14, C++23, RelWithDebInfo, GnuTLS and OpenSSL in one tree), this PR's head builds and passes dns, ipv6, socket, rpc, httpd, httpd_openssl, tls, tls_openssl, network_interface, websocket and unix_domain with SEASTAR_TEST_REQUIRE_IPV6=1, so none of their IPv6 cases skipped.

Stack

  1. tests, ci: fail instead of skip when IPv6 is expected #2 tests, ci: fail instead of skip when IPv6 is expected
  2. dns: reach nameservers over IPv6 #3 dns: reach nameservers over IPv6
  3. dns: literals for any family, c-ares error text, link-local nameservers #4 dns: literals for any family, c-ares error text, link-local nameservers
  4. net, http, rpc: dual-stack listeners (IPV6_V6ONLY, IPv4-mapped peers) #5 net, http, rpc: dual-stack listeners (IPV6_V6ONLY, IPv4-mapped peers)
  5. net: IPv6 zones and strict literal parsing #6 net: IPv6 zones and strict literal parsing
  6. tls: do not send IP literals in the SNI extension #7 tls: do not send IP literals in the SNI extension
  7. tls: verify server_name on OpenSSL, opt-in #8 tls: verify server_name on OpenSSL, opt-in
  8. net: ipv6_addr equality and hash, ipv4_addr(socket_address) throws instead of terminating #9 net: ipv6_addr equality and hash, ipv4_addr(socket_address) throws instead of terminating
  9. net: listen on an unspecified address binds any family #10 net: listen on an unspecified address binds any family
  10. http: build the Host header from an address in authority form #11 http: build the Host header from an address in authority form ← this PR

request::make takes the Host header as a string, so a caller with a
socket_address formats it, and the obvious "{}:{}" of address and port
produces "fd00::5:8080" for IPv6 — a different address, not an authority.
Seastar had no formatter to reach for.

Add http::internal::format_authority(), which brackets an IPv6 address per
RFC 3986 §3.2.2 and drops a zone index (an authority cannot carry one),
and request::make overloads taking a socket_address.
@david-yu
david-yu force-pushed the ipv6/10-http-host-authority branch from 353917f to 02c5867 Compare September 25, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant