Closed bryanp closed 5 years ago
Yeah, we should probably respect it. The problem is, if it's nil, it breaks Safari WebSockets. Also, the concept of "Reason" was completely removed from HTTP/2, so I thought about actually removing it from Protocol::HTTP::Response
.
What do you think?
I think we should keep support in Protocol::HTTP::Response
just for HTTP/1 completeness. Maybe don't allow it to be nil and default to Unknown
?
I guess I wonder is there any reason why anyone would want to set it in normal usage, given that at a guess, a large percentage of requests would never use it?
We can have a lookup table for normal status codes, and use the strings according to RFCs, e.g.
REASONS = {
200 => "Okay"
}
and so on.
The only reason why I exposed it is because it seemed interesting - you could use it as a side channel for data. But it's HTTP/1 specific, so if someone wanted to use that, maybe they'd just use protocol-http1
directly.
I've been thinking on this and agree with your reasoning. Maybe something like this for the lookup:
When should the reason
argument be removed from Async::HTTP::Protocol::Response
? Since it's pre 1.0 we don't care too much about backwards compatibility, but you may have an opinion here.
That's useful, I'll use that list. I'll remove it in the next release.
Okay, it was released in v0.43.0
.
Thanks for the list it probably saved me at least an hour of mucking about with RFCs.
If you want to have one central place for list, feel free to use Protocol::HTTP1::Reason::DESCRIPTIONS
.
Setting the response reason for
Async::HTTP::Protocol::Response
does not seem to work:Here's the response:
I would expect to see
HTTP/1.1 200 Foo
.