You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Cédric Damioli <cd...@apache.org> on 2017/03/29 15:14:09 UTC
Content-Length header
Hi,
I recently noticed that, at least for 2.1.x and 2.2.x, after any request
processing, Environment.commitResponse() is called which has the side
effect to compute the actual response body size and then set the
response content length.
While this is perfectly fine for GET requests, it's obviously useless
for OPTIONS and even wrong for HEAD requests.
Looking at code, an immediate workaround is to disable output buffering
but it's not satisfying.
Did someone encountered the same issue ?
I don't know exactly how to solve this without breaking legacy behaviour.
Any thoughts ?
Regards,
--
C�dric Damioli
CMS - Java - Open Source
www.ametys.org
Re: Content-Length header
Posted by Peter Hunsberger <pe...@gmail.com>.
Think you can likely just hard code it to skip HEAD and maybe OPTIONS if
you need to? Document the change and if we some day finally get a new
release out the door people will just have to test against their existing
applications. I don't see how they would break but maybe there are ways?
Peter Hunsberger
On Thu, Mar 30, 2017 at 7:53 AM, Cédric Damioli <cd...@apache.org> wrote:
> I've searched archives but only found [1], which is only partly related.
>
> Of course, commitResponse could be overridden in HttpEnvironment to filter
> out some HTTP methods, but which ones ? Should we have a black list, a
> white list, or a mean to configure it somewhere ? I don't want to break
> some compatibility somewhere.
> BTW, maybe only HEAD requests are concerned, after all ...
>
> Cédric
>
> [1] http://cocoon.markmail.org/search/?q=content-length#
> query:content-length+page:4+mid:ddsqo5ezsstshh7a+state:results
>
> Le 29/03/2017 à 19:14, Peter Hunsberger a écrit :
>
> This sounds somewhat familiar, you may want to search the mailing list
> archives to see if this has been discussed before.... Can commitResponse
> tell what kind of request it is dealing with or if not can that be passed
> in so that it knows?
>
> Peter Hunsberger
>
> On Wed, Mar 29, 2017 at 10:14 AM, Cédric Damioli <cd...@apache.org>
> wrote:
>
>> Hi,
>>
>> I recently noticed that, at least for 2.1.x and 2.2.x, after any request
>> processing, Environment.commitResponse() is called which has the side
>> effect to compute the actual response body size and then set the response
>> content length.
>> While this is perfectly fine for GET requests, it's obviously useless for
>> OPTIONS and even wrong for HEAD requests.
>>
>> Looking at code, an immediate workaround is to disable output buffering
>> but it's not satisfying.
>>
>> Did someone encountered the same issue ?
>>
>> I don't know exactly how to solve this without breaking legacy behaviour.
>> Any thoughts ?
>>
>> Regards,
>>
>> --
>> Cédric Damioli
>> CMS - Java - Open Source
>> www.ametys.org
>>
>>
>
> --
> Cédric Damioli
> CMS - Java - Open Sourcewww.ametys.org
>
>
Re: Content-Length header
Posted by Cédric Damioli <cd...@apache.org>.
I've searched archives but only found [1], which is only partly related.
Of course, commitResponse could be overridden in HttpEnvironment to
filter out some HTTP methods, but which ones ? Should we have a black
list, a white list, or a mean to configure it somewhere ? I don't want
to break some compatibility somewhere.
BTW, maybe only HEAD requests are concerned, after all ...
C�dric
[1]
http://cocoon.markmail.org/search/?q=content-length#query:content-length+page:4+mid:ddsqo5ezsstshh7a+state:results
Le 29/03/2017 � 19:14, Peter Hunsberger a �crit :
> This sounds somewhat familiar, you may want to search the mailing list
> archives to see if this has been discussed before.... Can
> commitResponse tell what kind of request it is dealing with or if not
> can that be passed in so that it knows?
>
> Peter Hunsberger
>
> On Wed, Mar 29, 2017 at 10:14 AM, C�dric Damioli <cdamioli@apache.org
> <ma...@apache.org>> wrote:
>
> Hi,
>
> I recently noticed that, at least for 2.1.x and 2.2.x, after any
> request processing, Environment.commitResponse() is called which
> has the side effect to compute the actual response body size and
> then set the response content length.
> While this is perfectly fine for GET requests, it's obviously
> useless for OPTIONS and even wrong for HEAD requests.
>
> Looking at code, an immediate workaround is to disable output
> buffering but it's not satisfying.
>
> Did someone encountered the same issue ?
>
> I don't know exactly how to solve this without breaking legacy
> behaviour.
> Any thoughts ?
>
> Regards,
>
> --
> C�dric Damioli
> CMS - Java - Open Source
> www.ametys.org <http://www.ametys.org>
>
>
--
C�dric Damioli
CMS - Java - Open Source
www.ametys.org
Re: Content-Length header
Posted by Peter Hunsberger <pe...@gmail.com>.
This sounds somewhat familiar, you may want to search the mailing list
archives to see if this has been discussed before.... Can commitResponse
tell what kind of request it is dealing with or if not can that be passed
in so that it knows?
Peter Hunsberger
On Wed, Mar 29, 2017 at 10:14 AM, Cédric Damioli <cd...@apache.org>
wrote:
> Hi,
>
> I recently noticed that, at least for 2.1.x and 2.2.x, after any request
> processing, Environment.commitResponse() is called which has the side
> effect to compute the actual response body size and then set the response
> content length.
> While this is perfectly fine for GET requests, it's obviously useless for
> OPTIONS and even wrong for HEAD requests.
>
> Looking at code, an immediate workaround is to disable output buffering
> but it's not satisfying.
>
> Did someone encountered the same issue ?
>
> I don't know exactly how to solve this without breaking legacy behaviour.
> Any thoughts ?
>
> Regards,
>
> --
> Cédric Damioli
> CMS - Java - Open Source
> www.ametys.org
>
>