jetty.project
jetty.project copied to clipboard
Why is HttpResponse.getReason() always null?
Jetty Version 12.0.6
Jetty Environment core
Java Version 21
Question
When using HTTP/1.1 in the past, I remember HttpResponse.getReason()
returning the equivalent of HttpStatus.Code.getMessage()
but when using HTTP/2 I see that HttpChannelState.lockedPrepareResponse()
always sets the reason to null
. Is there a reason for the different behavior across HTTP versions? Or is this perhaps a bug?
The Response line status reason phrase is optional (the words like "OK" or "Not Found").
It was declared optional in HTTP/1. - https://datatracker.ietf.org/doc/html/rfc9110#section-15.1
and is completely absent from HTTP/2 and HTTP/3. - https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2.4
Thank you. Is it possible to add this clarification to the getReason()
javadoc?