You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2005/09/08 11:04:09 UTC

ResponseWrapper eats my HTTP header settings

I'm trying to set HTTP headers for mod_cache, something like:

<map:act type="my-own-http-cache-headers-action">
   <map:parameter name="cache-validity-seconds" value="..dynamically 
computed value..."/>
</map:act>

in a pipeline that is called by an internal request.

And I just found out that ResponseWrapper eats all the header-setting 
calls.

This is discussed in 
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=109785174903101&w=2 
(BTW thanks Unico for putting that link in the SVN log message), and I 
understand the issues, but what would be the recommended way for 
setting headers from an internal pipeline?

I think setting headers for caching is a valid use-case. I'll look for 
a solution, but I'd appreciate any pointers.

Note that this probably prevents HttpHeaderAction from working in 
internal pipelines as well, we should at least make a note in that 
class if that's actually the case. But just tell me if I'm missing 
something.

-Bertrand

Re: ResponseWrapper eats my HTTP header settings, as does map:mount ;-(

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 12 sept. 05, à 15:57, Carsten Ziegeler a écrit :

> ...Yepp - so the question is: which changes broke this?

Most probably related to 
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=109785174903101&w=2

> And we should solve this for 2.1.8.

Yes - I don't have much time now as I have to deliver a site running 
under 2.1.7 with caching, Real Soon Now ;-)
But I agree, we need a test for this and then a fix.

-Bertrand

Re: ResponseWrapper eats my HTTP header settings, as does map:mount ;-(

Posted by Carsten Ziegeler <cz...@apache.org>.
Pier Fumagalli wrote:
> On 12 Sep 2005, at 14:47, Bertrand Delacretaz wrote:
> 
>>Le 12 sept. 05, à 15:31, Carsten Ziegeler a écrit :
>>
>>
>>>...What does this currently mean? If I set headers in a sub  
>>>sitemap they
>>>are ignored?..
>>>
>>
>>That's what I'm seeing, my mounted sitemap has an Action which sets  
>>HTTP headers, and a Serializer which sets Content-Length, and they  
>>are all eaten by ResponseWrapper and EnvironmentWrapper, respectively.
> 
> 
> Shit, this is _really_ bad... (Sorry the language).
> 
> This would mean that 2.1.7 (and the current branch head) can't be  
> used in production when Caching is involved.
> 
Yepp - so the question is: which changes broke this?
And we should solve this for 2.1.8.

Carsten

-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Re: ResponseWrapper eats my HTTP header settings, as does map:mount ;-(

Posted by Pier Fumagalli <pi...@betaversion.org>.
On 12 Sep 2005, at 14:47, Bertrand Delacretaz wrote:
> Le 12 sept. 05, à 15:31, Carsten Ziegeler a écrit :
>
>> ...What does this currently mean? If I set headers in a sub  
>> sitemap they
>> are ignored?..
>>
>
> That's what I'm seeing, my mounted sitemap has an Action which sets  
> HTTP headers, and a Serializer which sets Content-Length, and they  
> are all eaten by ResponseWrapper and EnvironmentWrapper, respectively.

Shit, this is _really_ bad... (Sorry the language).

This would mean that 2.1.7 (and the current branch head) can't be  
used in production when Caching is involved.

     Pier


Re: ResponseWrapper eats my HTTP header settings, as does map:mount ;-(

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 12 sept. 05, à 15:31, Carsten Ziegeler a écrit :
> ...What does this currently mean? If I set headers in a sub sitemap 
> they
> are ignored?..

That's what I'm seeing, my mounted sitemap has an Action which sets 
HTTP headers, and a Serializer which sets Content-Length, and they are 
all eaten by ResponseWrapper and EnvironmentWrapper, respectively.

-Bertrand

Re: ResponseWrapper eats my HTTP header settings, as does map:mount ;-(

Posted by Carsten Ziegeler <cz...@apache.org>.
Bertrand Delacretaz wrote:
> 
> I see your point - in the meantime I've worked around the problem by 
> storing cache-related info in a Request attribute and generating the 
> headers later in a non-internal part of pipeline.
> 
> I also found out that (in the 2.1.7 release at least), pipelines called 
> via map:mount also eat HTTP response headers set in code , *including* 
> content-length which might have been set by the mounted pipeline.
> 
> There's a related discussion at 
> http://marc.theaimsgroup.com/?t=111746450000002&r=1&w=2, I think this 
> deserves further investigation, in my view map:mount should completely 
> delegate to the mounted sitemap, without filtering.
> 
What does this currently mean? If I set headers in a sub sitemap they
are ignored?

Carsten

-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Re: ResponseWrapper eats my HTTP header settings, as does map:mount ;-(

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 8 sept. 05, à 12:42, Pier Fumagalli a écrit :

> On 8 Sep 2005, at 10:39, Bertrand Delacretaz wrote:
>> ---Good idea - having had a look at it, maybe ResponseWrapper should 
>> let some headers go through?
>> The cache-related ones (Expires, Cache-Control, Last-Modified) make 
>> sense to me.
>
> I would be against it. AFAIK, the ResponseWrapper is the one used 
> (also) in CIncludes and sitemap aggregations, right? That would 
> generate massive race conditions when for some reason one of the 
> included pipelines specifies caching.
>
> Have you tried using <map:redirect/>? That should preserve the caching 
> headers and AFAIK would allow you to expose an internal-only pipeline, 
> right?..

I see your point - in the meantime I've worked around the problem by 
storing cache-related info in a Request attribute and generating the 
headers later in a non-internal part of pipeline.

I also found out that (in the 2.1.7 release at least), pipelines called 
via map:mount also eat HTTP response headers set in code , *including* 
content-length which might have been set by the mounted pipeline.

There's a related discussion at 
http://marc.theaimsgroup.com/?t=111746450000002&r=1&w=2, I think this 
deserves further investigation, in my view map:mount should completely 
delegate to the mounted sitemap, without filtering.

-Bertrand

Re: ResponseWrapper eats my HTTP header settings

Posted by Pier Fumagalli <pi...@betaversion.org>.
On 8 Sep 2005, at 10:39, Bertrand Delacretaz wrote:
> Le 8 sept. 05, à 11:32, Carsten Ziegeler a écrit :
>
>> Don't know how to solve this, but I think we should create warning  
>> log
>> entries if someone tries to set headers in an internal pipeline  
>> and they
>> are ignored...
>
> Good idea - having had a look at it, maybe ResponseWrapper should  
> let some headers go through?
> The cache-related ones (Expires, Cache-Control, Last-Modified) make  
> sense to me.

I would be against it. AFAIK, the ResponseWrapper is the one used  
(also) in CIncludes and sitemap aggregations, right? That would  
generate massive race conditions when for some reason one of the  
included pipelines specifies caching.

Have you tried using <map:redirect/>? That should preserve the  
caching headers and AFAIK would allow you to expose an internal-only  
pipeline, right?

     Pier


Re: ResponseWrapper eats my HTTP header settings

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 8 sept. 05, à 11:32, Carsten Ziegeler a écrit :

> Don't know how to solve this, but I think we should create warning log
> entries if someone tries to set headers in an internal pipeline and 
> they
> are ignored...

Good idea - having had a look at it, maybe ResponseWrapper should let 
some headers go through?
The cache-related ones (Expires, Cache-Control, Last-Modified) make 
sense to me.

-Bertrand

Re: ResponseWrapper eats my HTTP header settings

Posted by Carsten Ziegeler <cz...@apache.org>.
Don't know how to solve this, but I think we should create warning log
entries if someone tries to set headers in an internal pipeline and they
are ignored.

Carsten

Bertrand Delacretaz wrote:
> I'm trying to set HTTP headers for mod_cache, something like:
> 
> <map:act type="my-own-http-cache-headers-action">
>    <map:parameter name="cache-validity-seconds" value="..dynamically 
> computed value..."/>
> </map:act>
> 
> in a pipeline that is called by an internal request.
> 
> And I just found out that ResponseWrapper eats all the header-setting 
> calls.
> 
> This is discussed in 
> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=109785174903101&w=2 
> (BTW thanks Unico for putting that link in the SVN log message), and I 
> understand the issues, but what would be the recommended way for 
> setting headers from an internal pipeline?
> 
> I think setting headers for caching is a valid use-case. I'll look for 
> a solution, but I'd appreciate any pointers.
> 
> Note that this probably prevents HttpHeaderAction from working in 
> internal pipelines as well, we should at least make a note in that 
> class if that's actually the case. But just tell me if I'm missing 
> something.
> 
> -Bertrand


-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/