You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2006/06/13 12:51:55 UTC

svn commit: r413861 - /httpd/httpd/trunk/support/ab.c

Author: colm
Date: Tue Jun 13 03:51:54 2006
New Revision: 413861

URL: http://svn.apache.org/viewvc?rev=413861&view=rev
Log:
A keepalive response need not neccessarily have included any content-length
header, handle this case properly for 304 responses. PR39789


Modified:
    httpd/httpd/trunk/support/ab.c

Modified: httpd/httpd/trunk/support/ab.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/ab.c?rev=413861&r1=413860&r2=413861&view=diff
==============================================================================
--- httpd/httpd/trunk/support/ab.c (original)
+++ httpd/httpd/trunk/support/ab.c Tue Jun 13 03:51:54 2006
@@ -1451,6 +1451,11 @@
                     c->keepalive = 1;
                     c->length = atoi(cl + 16);
                 }
+                /* The response may not have a Content-Length header */
+                if (!cl) {
+                    c->keepalive = 1;
+                    c->length = 0; 
+                }	
             }
             c->bread += c->cbx - (s + l - c->cbuff) + r - tocopy;
             totalbread += c->bread;



Re: svn commit: r413861 - /httpd/httpd/trunk/support/ab.c

Posted by Joe Orton <jo...@redhat.com>.
On Tue, Jun 13, 2006 at 12:28:20PM +0100, Colm MacCarthaigh wrote:
> On Tue, Jun 13, 2006 at 12:11:38PM +0100, Joe Orton wrote:
> > On Tue, Jun 13, 2006 at 10:51:55AM -0000, colm@apache.org wrote:
> > > Author: colm
> > > Date: Tue Jun 13 03:51:54 2006
> > > New Revision: 413861
> > > 
> > > URL: http://svn.apache.org/viewvc?rev=413861&view=rev
> > > Log:
> > > A keepalive response need not neccessarily have included any content-length
> > > header, handle this case properly for 304 responses. PR39789
> > 
> > This looks wrong, the patch in the PR was a bit better.  If a response 
> > doesn't have a C-L/T-E the body is read till EOF.  [23]04 are special 
> > cases which have zero length bodies regardless of the message headers.
> 
> 204 is why I didn't conditionalise it on 304, my comment was a bit
> misleading there. My change has the same effect as the patch in the PR
> for 304 responses, but also for any other keep-alive request which
> doesn't include a C-L. Should I restrict to more specific response
> codes? or is there another problem I'm just not seeing :)

Oh sorry, I missed that this is localised to the "keep-alive" case; in 
that case I guess it is no less dubious than the rest of the ab response 
parsing, I don't think it'll break with any normal server.

joe

Re: svn commit: r413861 - /httpd/httpd/trunk/support/ab.c

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Tue, Jun 13, 2006 at 12:11:38PM +0100, Joe Orton wrote:
> On Tue, Jun 13, 2006 at 10:51:55AM -0000, colm@apache.org wrote:
> > Author: colm
> > Date: Tue Jun 13 03:51:54 2006
> > New Revision: 413861
> > 
> > URL: http://svn.apache.org/viewvc?rev=413861&view=rev
> > Log:
> > A keepalive response need not neccessarily have included any content-length
> > header, handle this case properly for 304 responses. PR39789
> 
> This looks wrong, the patch in the PR was a bit better.  If a response 
> doesn't have a C-L/T-E the body is read till EOF.  [23]04 are special 
> cases which have zero length bodies regardless of the message headers.

204 is why I didn't conditionalise it on 304, my comment was a bit
misleading there. My change has the same effect as the patch in the PR
for 304 responses, but also for any other keep-alive request which
doesn't include a C-L. Should I restrict to more specific response
codes? or is there another problem I'm just not seeing :)

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net

Re: svn commit: r413861 - /httpd/httpd/trunk/support/ab.c

Posted by Joe Orton <jo...@redhat.com>.
On Tue, Jun 13, 2006 at 10:51:55AM -0000, colm@apache.org wrote:
> Author: colm
> Date: Tue Jun 13 03:51:54 2006
> New Revision: 413861
> 
> URL: http://svn.apache.org/viewvc?rev=413861&view=rev
> Log:
> A keepalive response need not neccessarily have included any content-length
> header, handle this case properly for 304 responses. PR39789

This looks wrong, the patch in the PR was a bit better.  If a response 
doesn't have a C-L/T-E the body is read till EOF.  [23]04 are special 
cases which have zero length bodies regardless of the message headers.

> 
> 
> Modified:
>     httpd/httpd/trunk/support/ab.c
> 
> Modified: httpd/httpd/trunk/support/ab.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/ab.c?rev=413861&r1=413860&r2=413861&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/support/ab.c (original)
> +++ httpd/httpd/trunk/support/ab.c Tue Jun 13 03:51:54 2006
> @@ -1451,6 +1451,11 @@
>                      c->keepalive = 1;
>                      c->length = atoi(cl + 16);
>                  }
> +                /* The response may not have a Content-Length header */
> +                if (!cl) {
> +                    c->keepalive = 1;
> +                    c->length = 0; 
> +                }	
>              }
>              c->bread += c->cbx - (s + l - c->cbuff) + r - tocopy;
>              totalbread += c->bread;
>