-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Do we need to verify trailers? #432
Comments
I think no. I read |
Actually I'm referring to something else. The spec says that the request header should be included. It does not say anything about what to do if the request header includes a key that is not part of the trailers. |
Consider: Ok res.writeHead(200, { Trailer: 'foo' })
res.writeTrailer('foo', 'asd')
res.writeTrailer('bar', 'asd') // not specified in header
res.end() Not ok? res.writeHead(200, { Trailer: 'foo' })
res.writeTrailer('bar', 'asd')
// foo is not sent?
res.end() |
Ah. Yeah, it makes sense to throw. IMO it's invalid. |
Just a note that this causes an Error to be thrown when using undici to fetch from an IPFS Gateway API. That api always sends a Would you consider a PR to make absent trailers not be an error? |
What does the spec say? |
https://httpwg.org/specs/rfc7230.html#rfc.section.4.1.2 It doesn't explicitly say the headers must be present, so I guess they can be omitted. |
From what I can see from Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing # header.trailer and Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing # chunked.trailer.part the spec doesn't explicitly specify whether a trailer field should be included at the end of the chunked response or not. Also looking at the decoding section it suggests to read until the field it's empty and append the headers that were provided in the |
This is to potentially address things like this: nodejs/undici#432 (comment)
The way I read the spec the server/client may send trailers that are not included in the
Trailers
header. However, how should one handle the case where the client/server does not send a specified trailer? i.e. to we need a "trailer mismatch error"?The text was updated successfully, but these errors were encountered: