maskit commented on code in PR #8963:
URL: https://github.com/apache/trafficserver/pull/8963#discussion_r940942582
##########
proxy/http2/HTTP2.cc:
##########
@@ -446,10 +451,16 @@ http2_convert_header_from_2_to_1_1(HTTPHdr *headers)
if (MIMEField *field = headers->field_find(HTTP2_VALUE_AUTHORITY,
HTTP2_LEN_AUTHORITY);
field != nullptr && field->value_is_valid()) {
int authority_len;
- const char *authority = field->value_get(&authority_len);
+ // Set the host header field
+ MIMEField *host = headers->field_find(MIME_FIELD_HOST, MIME_LEN_HOST);
+ if (host == nullptr) {
+ host = headers->field_create(MIME_FIELD_HOST, MIME_LEN_HOST);
+ headers->field_attach(host);
Review Comment:
Okay, `Host` header was unnecessary for ATS internal process if the request
URL is absolute form, but adding it makes sense.
This block is fine at all and no change is needed, but I realized one thing
while I'm checking RFC 9110. According to the RFC, `Host` header should be at
the beginning of a header field list.
> A user agent that sends Host SHOULD send it as the first
field in the header section of a request.
That makes sense and we do that for pseudo headers though, that's not easy
to do with our `MIMEHdr` structure, because it doesn't allow us to
insert/prepend headers.
I also checked RFC 9113 (HTTP/2) and it says:
> All pseudo-header fields MUST appear in a field block before all
regular field lines. Any request or response that contains a pseudo-
header field that appears in a field block after a regular field line
MUST be treated as malformed ([Section
8.1.1](https://datatracker.ietf.org/doc/html/rfc9113#section-8.1.1)).
So it's MUST for pseudo headers, but it's SHOULD for `Host` header. It would
be nice if we could have `Host` header at the beginning but I don't think it
has to be done on this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]