--------------------- PatchSet 10391 Date: 2008/01/13 12:15:43 Author: adri Branch: s27_adri Tag: (none) Log: Revert changeset 10386 - this breaks SSL tunneling as the data needs to be consumed from the conn buf before its called. Members: src/client_side.c:1.202.2.9.4.27->1.202.2.9.4.28 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.202.2.9.4.27 retrieving revision 1.202.2.9.4.28 diff -u -r1.202.2.9.4.27 -r1.202.2.9.4.28 --- squid/src/client_side.c 9 Jan 2008 13:53:32 -0000 1.202.2.9.4.27 +++ squid/src/client_side.c 13 Jan 2008 12:15:43 -0000 1.202.2.9.4.28 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.202.2.9.4.27 2008/01/09 13:53:32 adri Exp $ + * $Id: client_side.c,v 1.202.2.9.4.28 2008/01/13 12:15:43 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -3913,6 +3913,15 @@ request_t *request = NULL; HttpMsgBuf msg; + + /* Skip leading (and trailing) whitespace */ + while (conn->in.offset > 0 && xisspace(conn->in.buf[0])) { + xmemmove(conn->in.buf, conn->in.buf + 1, conn->in.offset - 1); + conn->in.offset--; + } + if (conn->in.offset == 0) + return 0; + HttpMsgBufInit(&msg, conn->in.buf, conn->in.offset); /* XXX for now there's no deallocation function needed but this may change */ /* Limit the number of concurrent requests to 2 */ for (n = conn->reqs.head, nrequests = 0; n; n = n->next, nrequests++); @@ -3969,13 +3978,16 @@ errorAppendEntry(http->entry, err); return -1; } - - /* - * XXX we used to pull the remainder bytes out here. Its possible that - * XXX the hdr_sz is right here but subsequently changes before we return. - * XXX Keep this in mind if Weird Stuff Happens. -adrian + /* + * If we read past the end of this request, move the remaining + * data to the beginning */ - + assert(conn->in.offset >= http->req_sz); + conn->in.offset -= http->req_sz; + debug(33, 5) ("removing %d bytes; conn->in.offset = %d\n", (int) http->req_sz, (int) conn->in.offset); + if (conn->in.offset > 0) + xmemmove(conn->in.buf, conn->in.buf + http->req_sz, conn->in.offset); + if (!http->flags.internal && internalCheck(strBuf2(request->urlpath), strLen2(request->urlpath))) { if (internalHostnameIs(request->host)) http->flags.internal = 1; @@ -4179,32 +4191,9 @@ ret = 0; while (cbdataValid(conn) && conn->in.offset > 0 && conn->body.size_left == 0) { /* Ret tells us how many bytes was consumed - 0 == didn't consume request, > 0 == consumed, -1 == error, -2 == CONNECT request stole the connection */ - - /* Skip leading (and trailing) whitespace */ - while (conn->in.offset > 0 && xisspace(conn->in.buf[0])) { - xmemmove(conn->in.buf, conn->in.buf + 1, conn->in.offset - 1); - conn->in.offset--; - } - if (conn->in.offset == 0) { - ret = 0; - break; - } - ret = clientTryParseRequest(conn); if (ret <= 0) break; - - /* - * If we read past the end of this request, move the remaining - * data to the beginning - */ - if (ret > 0) { - assert(conn->in.offset >= ret); - conn->in.offset -= ret; - debug(33, 5) ("clientReadRequest: FD %d: removing %d bytes; conn->in.offset = %d\n", fd, (int) ret, (int) conn->in.offset); - if (conn->in.offset > 0) - xmemmove(conn->in.buf, conn->in.buf + ret, conn->in.offset); - } } /* while offset > 0 && conn->body.size_left == 0 */ if (!cbdataValid(conn)) { cbdataUnlock(conn);