Re: mod_perl2, HEAD request and Content-Length

2004-08-08 Thread Stas Bekman
This thread has been documented at: http://perl.apache.org/docs/2.0/user/handlers/http.html#C_Content_Length__Response_Header -- __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guid

Re: mod_perl2, HEAD request and Content-Length

2004-08-04 Thread Geoffrey Young
>> If httpd-dev doesn't do it, I suppose we can still implement it in mp2. > > > On a second thought, I think it's better not to add this special method > unless Apache does that. I fully agree. > Since in 99.99% cases one should not cause an > early headers sending, and for those special cas

Re: mod_perl2, HEAD request and Content-Length

2004-08-04 Thread Stas Bekman
Geoffrey Young wrote: As mentioned earlier I think the bug is in the headers_out filter, which received EOS (since on HEAD apache scratches the response body) and no body. So it takes the liberty to nuke the C-L header, which I'm not sure is a good thing. When we send some body, headers_out sends

Re: mod_perl2, HEAD request and Content-Length

2004-08-04 Thread Stas Bekman
Stas Bekman wrote: [...] Would a flush bucket be a great way to say "send headers now"? So if you're not going to send the actual content down the filter chain on a HEAD request, would sending a flush bucket make things happy? It does. IIF this works, can I make a request the $r->send_http_header(

Re: mod_perl2, HEAD request and Content-Length

2004-08-04 Thread Stas Bekman
Glenn Strauss wrote: On Mon, Aug 02, 2004 at 11:55:56AM -0700, Stas Bekman wrote: [...] I mentioned to Geoff off-list about possibly using a flush bucket, since I don't have a test setup ready (just replaced my dead laptop hard drive) Thanks Glenn, calling $r->rflush works perfectly fine to cause

Re: mod_perl2, HEAD request and Content-Length

2004-08-03 Thread Glenn Strauss
On Mon, Aug 02, 2004 at 11:55:56AM -0700, Stas Bekman wrote: [...] > Actually I the problem I saw was exactly what Boris was talking about: > The C-L header wasn't there. The test simply exercises 4 different > combinations of sending and not sending C-L header and content. > > >my point was tha

Re: mod_perl2, HEAD request and Content-Length

2004-08-02 Thread Geoffrey Young
> As mentioned earlier I think the bug is > in the headers_out filter, which received EOS (since on HEAD apache > scratches the response body) and no body. So it takes the liberty to > nuke the C-L header, which I'm not sure is a good thing. When we send > some body, headers_out sends the headers

Re: mod_perl2, HEAD request and Content-Length

2004-08-02 Thread Stas Bekman
Geoffrey Young wrote: yes, clearly there is a bug in there, but not where you think - what is important is that apache needs to do the same thing on GET as HEAD, not that there is no C-L generated for contentless HEAD requests. this patch more accurately represents the real bug which, IIRC, httpd

Re: mod_perl2, HEAD request and Content-Length

2004-08-02 Thread Geoffrey Young
>> yes, clearly there is a bug in there, but not where you think - what is >> important is that apache needs to do the same thing on GET as HEAD, >> not that >> there is no C-L generated for contentless HEAD requests. this patch more >> accurately represents the real bug which, IIRC, httpd is alr

Re: mod_perl2, HEAD request and Content-Length

2004-08-02 Thread Stas Bekman
Geoffrey Young wrote: [...] I just missed the content-length header on HEAD requests that is delivered on GET. Geoff, see the t/apache/head_request.t test I've added last night. If you don't send a body, Apache strips the C-L header for HEAD requests. Sending at least 1 byte works as a workaround,

Re: mod_perl2, HEAD request and Content-Length

2004-08-02 Thread Geoffrey Young
> From RFC 2616: > > "The HEAD method is identical to GET except that the server MUST NOT > return a message-body in the response. The metainformation contained in > the HTTP headers in response to a HEAD request SHOULD be identical to > the information sent in response to a GET request." indee

Re: mod_perl2, HEAD request and Content-Length

2004-08-02 Thread Jean-Michel Hiver
Geoffrey Young wrote: ??? I do not know what you mean, my GET request _has_ a content-lenght header! For HEAD, I just do not calculate the expencive data for my body. that is exactly what I mean - if you include a C-L header on a GET then you are supposed to have one for a HEAD request as well, exp

Re: mod_perl2, HEAD request and Content-Length

2004-08-02 Thread Geoffrey Young
>> ??? I do not know what you mean, my GET request _has_ a content-lenght >> header! For HEAD, I just do not calculate the expencive data for my body. that is exactly what I mean - if you include a C-L header on a GET then you are supposed to have one for a HEAD request as well, expensive or not.

Re: mod_perl2, HEAD request and Content-Length

2004-08-02 Thread Stas Bekman
Boris Zentner wrote: Hi, Am Montag 02 August 2004 15:28 schrieb Geoffrey Young: But my point is, for a HEAD request, there is no data so apache should not touch my content-length header. I really dislike to generate the full data for the request and apache throws it away ( and even the I get no Con

Re: mod_perl2, HEAD request and Content-Length

2004-08-02 Thread Boris Zentner
Hi, Am Montag 02 August 2004 15:28 schrieb Geoffrey Young: > > But my point is, for a HEAD request, there is no data so apache should > > not touch my content-length header. I really dislike to generate the full > > data for the request and apache throws it away ( and even the I get no > > Conten

Re: mod_perl2, HEAD request and Content-Length

2004-08-02 Thread Geoffrey Young
> But my point is, for a HEAD request, there is no data so apache should not > touch my content-length header. I really dislike to generate the full data > for the request and apache throws it away ( and even the I get no > Content-Length header ). for the record, this is fundamentally wrong.

Re: mod_perl2, HEAD request and Content-Length

2004-08-01 Thread Stas Bekman
Stas Bekman wrote: Stas Bekman wrote: let me try to write a test and I'll be back to you. I've just committed this test to the modperl-2.0 cvs rep: t/apache/head_request.t t/response/TestApache/head_request.pm please take a look -- __

Re: mod_perl2, HEAD request and Content-Length

2004-08-01 Thread Stas Bekman
Stas Bekman wrote: let me try to write a test and I'll be back to you. I get indentical behavior with either of the two methods: my $body = "This is a response string"; #$r->headers_out->{'Content-Length'} = length $body; $r->set_content_length(length $body); $r->print('a'); if the

Re: mod_perl2, HEAD request and Content-Length

2004-08-01 Thread Stas Bekman
Boris Zentner wrote: [...] Nothing, I searched for the function, but I did not find it! I know I should use mp2doc, but as I searched for it, I did not think on the tool. I tryed first with perldoc Apache::RequestRec and then I searched http://perl.apache.org/docs/2.0/api/Apache/RequestRec.ht

Re: mod_perl2, HEAD request and Content-Length

2004-08-01 Thread Boris Zentner
Hi, Am Sonntag 01 August 2004 18:13 schrieb Stas Bekman: > Does anybody have any statistics on the percentage of HEAD requests vs. > GET? The purpose of HEAD request is not to save your CPU cycles, but to > avoid data transfer which is precisely what Apache 2.0 does, without > making you do the e

Re: mod_perl2, HEAD request and Content-Length

2004-08-01 Thread Stas Bekman
Boris Zentner wrote: Hi, Am Samstag 31 Juli 2004 10:20 schrieb Stas Bekman: Geoffrey Young wrote: Boris Zentner wrote: Hi, I have a handler, that serve dynamic pages or static ones. If the handler gets a HEAD request, it answers with [...] it is desired - you no longer need to set the Content-Leng

Re: mod_perl2, HEAD request and Content-Length

2004-08-01 Thread Boris Zentner
Hi, Am Samstag 31 Juli 2004 10:20 schrieb Stas Bekman: > Geoffrey Young wrote: > > Boris Zentner wrote: > >>Hi, > >> > >>I have a handler, that serve dynamic pages or static ones. If the handler > >> gets a HEAD request, it answers with > > [...] > > > it is desired - you no longer need to set th

Re: mod_perl2, HEAD request and Content-Length

2004-07-31 Thread Stas Bekman
Geoffrey Young wrote: Boris Zentner wrote: Hi, I have a handler, that serve dynamic pages or static ones. If the handler gets a HEAD request, it answers with [...] it is desired - you no longer need to set the Content-Length header for requests in Apache 2.0. It's somewhat documented: http://perl.

Re: mod_perl2, HEAD request and Content-Length

2004-07-30 Thread Geoffrey Young
Boris Zentner wrote: > Hi, > > I have a handler, that serve dynamic pages or static ones. If the handler gets > a HEAD request, it answers with > > ... > $apr->headers_out->{'Content-Length'} = 12345; > $apr->content_type($media_type) unless $apr->main; > if ( $apr->header_only ) { >

mod_perl2, HEAD request and Content-Length

2004-07-30 Thread Boris Zentner
Hi, I have a handler, that serve dynamic pages or static ones. If the handler gets a HEAD request, it answers with ... $apr->headers_out->{'Content-Length'} = 12345; $apr->content_type($media_type) unless $apr->main; if ( $apr->header_only ) { return DONE; } ... This works, but