Commit 656f54bb authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix pipelining: don't expect the fd to become readable before we

look for complete requests.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2122 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 3290b19c
......@@ -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"
......
......@@ -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 {
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment