[ 
https://issues.apache.org/jira/browse/FELIX-3987?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

J.W. Janssen updated FELIX-3987:
--------------------------------

    Fix Version/s: http-2.2.2

> ResourceServlet sets content-length header too late
> ---------------------------------------------------
>
>                 Key: FELIX-3987
>                 URL: https://issues.apache.org/jira/browse/FELIX-3987
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http-2.2.0
>            Reporter: Kaspar von Gunten
>             Fix For: http-2.2.2
>
>         Attachments: ResourceServlet.patch
>
>
> The ResourceServlet.handle(..) implementation sets content-type and 
> last-modified headers, then goes on and copies the specified resource's 
> content onto the response's output stream. When it is done, it sets the 
> content-length header to the # of written bytes.
> This is just wrong, because all headers should be present before content is 
> written. The implementation gets away with it, because most content probably 
> fits into the internal buffers and content-length is set before flush/close 
> is called, but with large content this will cause problems.
> Suggestion: determine content-length in handle (analogous to last-modified) 
> BEFORE calling copy(). I attached a suggested patch for the v2.2.0 
> ResourceServlet.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to