]> err.no Git - varnish/commitdiff
Fix pipelining: don't expect the fd to become readable before we
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 19 Oct 2007 08:50:50 +0000 (08:50 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 19 Oct 2007 08:50:50 +0000 (08:50 +0000)
look for complete requests.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2122 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_httpconn.c

index 8d6d177c281c501bba17c55b035ae05ec9df2d1f..68ce9af9d1638bc06fe5e6a73a19ad7c60f3b207 100644 (file)
@@ -491,6 +491,7 @@ void HTC_Init(struct http_conn *htc, struct ws *ws, int fd);
 int HTC_Reinit(struct http_conn *htc);
 int HTC_Rx(struct http_conn *htc);
 int HTC_Read(struct http_conn *htc, void *d, unsigned len);
+int HTC_Complete(struct http_conn *htc);
 
 #define HTTPH(a, b, c, d, e, f, g) extern char b[];
 #include "http_headers.h"
index 7bb6e8b0471838ae06fb2d58e63a9f3a9b10f803..5fb7b0f9fc498e633188638e8016e190eac3b900 100644 (file)
@@ -89,9 +89,9 @@ cnt_again(struct sess *sp)
 
        assert(sp->xid == 0);
 
-       do 
+       i = HTC_Complete(sp->htc);
+       while (i == 0)
                i = HTC_Rx(sp->htc);
-       while (i == 0);
        if (i == 1) {
                sp->step = STP_RECV;
        } else {
index 8ed70c9f15faa23310b7cd14d94969c7248a43b7..5f9c0a157cd4e7d55fc14eaf2747200f2d89d7d3 100644 (file)
@@ -123,6 +123,30 @@ HTC_Reinit(struct http_conn *htc)
        return (i);
 }
 
+/*--------------------------------------------------------------------
+ *
+ */
+
+int
+HTC_Complete(struct http_conn *htc)
+{
+       int i;
+
+       CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
+       i = htc_header_complete(&htc->rxbuf);
+       if (i < 0) 
+               htc->rxbuf.e = htc->rxbuf.b;
+       if (i <= 0)
+               return (0);
+       WS_ReleaseP(htc->ws, htc->rxbuf.e);
+       if (htc->rxbuf.b + i < htc->rxbuf.e) {
+               htc->pipeline.b = htc->rxbuf.b + i;
+               htc->pipeline.e = htc->rxbuf.e;
+               htc->rxbuf.e = htc->pipeline.b;
+       }
+       return (1);
+}
+
 /*--------------------------------------------------------------------
  * Receive more HTTP protocol bytes
  * Returns:
@@ -151,18 +175,7 @@ HTC_Rx(struct http_conn *htc)
        }
        htc->rxbuf.e += i;
        *htc->rxbuf.e = '\0';
-       i = htc_header_complete(&htc->rxbuf);
-       if (i < 0) 
-               htc->rxbuf.e = htc->rxbuf.b;
-       if (i <= 0)
-               return (0);
-       WS_ReleaseP(htc->ws, htc->rxbuf.e);
-       if (htc->rxbuf.b + i < htc->rxbuf.e) {
-               htc->pipeline.b = htc->rxbuf.b + i;
-               htc->pipeline.e = htc->rxbuf.e;
-               htc->rxbuf.e = htc->pipeline.b;
-       }
-       return (1);
+       return (HTC_Complete(htc));
 }
 
 int