Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] No Content-Length header causing problems

Hi Joakim Erdfelt,

Thanks for the response.

Wanted to understand more on this issue. How is it a valid response header when both Content-Length and Transfer-Encoding is not set in the response from jetty? Dont we need any one of these?

If I understand correctly, in Jetty 9.4.x either Content-Length or Transfer-Encoding is set based on the response can fit in a single buffer or multiple buffers. Was this fix not part of Jetty 8? Was there any known bug for this? Could you please point me to the same.

Thanks.

On Tue, Sep 29, 2020 at 9:32 PM Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
Also of note.

On Jetty 9.4.x (current stable release 9.4.31.v20200723, with 9.4.32 due out soon).
If the entire gzip compressed response can fit in a single buffer then the response has a Content-Length.
If it uses more than 1 response buffer, the response headers are sent with Transfer-Encoding: chunked (and no Content-Length header)

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Tue, Sep 29, 2020 at 10:58 AM Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
That is a 100% valid HTTP/1.1 response, all properly implemented HTTP/1.1 clients support it.
Valid since HTTP/1.1 spec https://tools.ietf.org/html/rfc2068 (published in 1997)

Also, you should upgrade, as Jetty 8.x is long ago EOL / End of Life (as of Nov 2014)

Jetty 8.1.12 is also subject to several security issues now.

Joakim Erdfelt / joakim@xxxxxxxxxxx

On Tue, Sep 29, 2020 at 10:36 AM Gurudatta Pai <gurudatta.pai07@xxxxxxxxx> wrote:
Hi All,

We are using Jetty and the response has following header when sent -H 'Accept-Encoding: gzip' header with the request. This is working fine.

< HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
< Access-Control-Allow-Origin: *
< Content-Encoding: gzip
< Vary: Accept-Encoding, User-Agent
< Content-Length: 259
< Server: Jetty(8.1.12.v20130726)

But when we send Connection: close header then the content-length header is missing from the response which is causing problems.

Request has -H 'Accept-Encoding: gzip' -H 'Connection: close' headers. Following is the response headers.

< HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
< Access-Control-Allow-Origin: *
< Content-Encoding: gzip
< Vary: Accept-Encoding, User-Agent
< Connection: close
< Server: Jetty(8.1.12.v20130726)

Is there any workaround for this? Also I tried debugging for this but could not get the exact code where we add the content-length and where we skip it. Can anyone please provide more details on this.

Thanks.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top