A response with a `Connection: close` header (and no `Transfer-Encoding` or
`Content-Length`) indicates it's done sending the payload when the
connection is closed.

This is covered in  ...

   - https://tools.ietf.org/html/rfc2068#section-4.4 (entry 5)
   - https://tools.ietf.org/html/rfc2616#section-4.4 (entry 5)
   - https://tools.ietf.org/html/rfc7230#section-3.3.3 (entry 7)


Joakim Erdfelt / [email protected]


On Wed, Sep 30, 2020 at 7:29 AM Gurudatta Pai <[email protected]>
wrote:

> 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 <[email protected]> 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 / [email protected]
>>
>>
>> On Tue, Sep 29, 2020 at 10:58 AM Joakim Erdfelt <[email protected]>
>> 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)
>>>
>>> https://www.eclipse.org/jetty/documentation/current/what-jetty-version.html
>>>
>>> Jetty 8.1.12 is also subject to several security issues now.
>>> https://www.eclipse.org/jetty/security-reports.html
>>>
>>> Joakim Erdfelt / [email protected]
>>>
>>> On Tue, Sep 29, 2020 at 10:36 AM Gurudatta Pai <
>>> [email protected]> 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
>>>> [email protected]
>>>> To unsubscribe from this list, visit
>>>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>>>
>>> _______________________________________________
>> jetty-users mailing list
>> [email protected]
>> To unsubscribe from this list, visit
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to