Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is absence of both :authority and Host an error? #3408

Closed
MikeBishop opened this issue Feb 4, 2020 · 5 comments · Fixed by #3475
Closed

Is absence of both :authority and Host an error? #3408

MikeBishop opened this issue Feb 4, 2020 · 5 comments · Fixed by #3475
Assignees
Labels
-http design has-consensus

Comments

@MikeBishop
Copy link
Contributor

@MikeBishop MikeBishop commented Feb 4, 2020

From an interop discussion with @martinduke and @kazuho.

HTTP/1.1 requires the presence of a Host header:

A client MUST send a Host header field in all HTTP/1.1 request messages. If the target URI includes an authority component, then a client MUST send a field value for Host that is identical to that authority component, excluding any userinfo subcomponent and its "@" delimiter (Section 2.5.1). If the authority component is missing or undefined for the target URI, then a client MUST send a Host header field with an empty field value.

If no Host header is present, the section on Effective Request URI describes how you determine what host is being asked for, ending with "guess" if it's an HTTP/1.0 request.

HTTP/2 says that you generate an :authority pseudo-header if sending direct-to-H2 and carry through the Host header if you're relaying HTTP/1.1. There is no discussion about what to do with an HTTP/1.0 (or 0.9) request being relayed over HTTP/2, which wouldn't have a Host header; you're neither required to generate or send one, even an empty one, nor are you given guidance about how to figure it out.

HTTP/3 carries forward the H2 language (currently by reference, and explicitly after #3352). Do we want to have some guidance here? Or does this issue instead belong in https://httpwg.org/http-core/ to move some of the existing guidance to be HTTP version-independent?

(@royfielding)

@kazuho
Copy link
Member

@kazuho kazuho commented Feb 4, 2020

@MikeBishop Thank you for looking into the problem.

Regarding if (or how) we should handle the issue, I think my weak preference goes to having one rule that applies to both HTTP/2 and HTTP/3. That would be less surprising to the users, and would also be helpful to implementations. It could well be the case for an HTTP server to have a common logic of handing pseudo headers (or lack of) between HTTP/2 and HTTP/3.

@royfielding
Copy link
Contributor

@royfielding royfielding commented Feb 4, 2020

Host is an HTTP/1.x header field (it was just late to the party), so HTTP/1.0 includes it as an extension. And that requirement is specific to HTTP/1.1, so would theoretically not apply to HTTP/1.2 (and that was intended): it was a short term requirement imposed by the IESG because they wanted to require deployment and didn't understand that it was already deployed.

In general, I don't understand why ":authority" exists (as opposed to always using ":host"), but I think the HTTP requirement is simply that the identifying data must be present somewhere in the request.

@MikeBishop
Copy link
Contributor Author

@MikeBishop MikeBishop commented Feb 4, 2020

":authority" exists for the purpose of always transporting the equivalent of the absolute-form, with ":scheme" and ":path" transporting the rest. It's mostly a consistency thing, I think. If you have a "Host" header instead, that's acceptable, too.

So should we say that the target authority MUST be present in either "Host" or ":authority", or do we leave it alone?

@royfielding
Copy link
Contributor

@royfielding royfielding commented Feb 4, 2020

Well, assuming we still allow requests for URIs that do not have an authority component (e.g, a URN or similar), I think it is better to just leave it alone. OTOH, folks are still going to ask what needs to be sent when the request target doesn't have an authority component, so that ought to be defined somewhere here more sensibly than it was for 1.1.

@mnot mnot added this to Triage in Late Stage Processing Feb 5, 2020
@larseggert larseggert added the design label Feb 5, 2020
@project-bot project-bot bot moved this from Triage to Design Issues in Late Stage Processing Feb 5, 2020
@larseggert
Copy link
Member

@larseggert larseggert commented Feb 5, 2020

Discussed in ZRH. Proposed resolution is that if a URI scheme has a mandatory component, it better have one of those two things, preferably a :authority. Alert httpbis.

@MikeBishop MikeBishop added the proposal-ready label Feb 26, 2020
@project-bot project-bot bot moved this from Design Issues to Consensus Emerging in Late Stage Processing Feb 26, 2020
@LPardue LPardue added call-issued and removed proposal-ready labels Mar 7, 2020
@project-bot project-bot bot moved this from Consensus Emerging to Consensus Call issued in Late Stage Processing Mar 7, 2020
@LPardue LPardue added has-consensus and removed call-issued labels Mar 20, 2020
@project-bot project-bot bot moved this from Consensus Call issued to Consensus Declared in Late Stage Processing Mar 20, 2020
Late Stage Processing automation moved this from Consensus Declared to Text Incorporated Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-http design has-consensus
Projects
Late Stage Processing
  
Issue Handled
Development

Successfully merging a pull request may close this issue.

5 participants