felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.W. Janssen (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (FELIX-3987) ResourceServlet sets content-length header too late
Date Mon, 11 Nov 2013 14:24:17 GMT

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

J.W. Janssen resolved FELIX-3987.
---------------------------------

    Resolution: Fixed
      Assignee: J.W. Janssen

Committed the proposed solution in rev #1540739.

> 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
>            Assignee: J.W. Janssen
>             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)

Mime
View raw message