--------------------- PatchSet 10412 Date: 2008/01/15 14:36:44 Author: adri Branch: s27_adri Tag: (none) Log: Add in the whitespace trim for now; shuffle the sslStart() to take an optional client data buffer. The client buffer consuming is now in client_side.c rather than in the sslStart() path. That should make my next bit of work slightly easier Members: src/client_side.c:1.202.2.9.4.39->1.202.2.9.4.40 src/protos.h:1.146.2.4.4.37->1.146.2.4.4.38 src/ssl.c:1.31.6.2.4.3->1.31.6.2.4.4 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.202.2.9.4.39 retrieving revision 1.202.2.9.4.40 diff -u -r1.202.2.9.4.39 -r1.202.2.9.4.40 --- squid/src/client_side.c 15 Jan 2008 13:50:05 -0000 1.202.2.9.4.39 +++ squid/src/client_side.c 15 Jan 2008 14:36:44 -0000 1.202.2.9.4.40 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.202.2.9.4.39 2008/01/15 13:50:05 adri Exp $ + * $Id: client_side.c,v 1.202.2.9.4.40 2008/01/15 14:36:44 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -216,7 +216,10 @@ void clientConnBufConsume(ConnInBuf *in, int cbytes) { - in->offset -= cbytes; + if (cbytes == -1) + in->offset = 0; + else + in->offset -= cbytes; debug(33, 5) ("removing %d bytes; clientConnBufLen(&conn->in) = %d\n", (int) cbytes, (int) in->offset); if (in->offset > 0) xmemmove(in->buf, in->buf + cbytes, in->offset); @@ -3578,7 +3581,8 @@ httpRequestFree(http); } else #endif - sslStart(http, &http->out.size, &http->al.http.code); + sslStart(http, &http->out.size, &http->al.http.code, clientConnBuf(&http->conn->in), clientConnBufLen(&http->conn->in)); + clientConnBufConsume(&http->conn->in, -1); return; } else if (r->method == METHOD_PURGE) { clientPurgeRequest(http); @@ -4276,6 +4280,12 @@ /* XXX Trim whitespace here! */ + /* Skip leading whitespace */ + clientConnBufTrimWhitespace(&conn->in); + if (clientConnBufLen(&conn->in) == 0) { + ret = 0; + break; + } ret = clientTryParseRequest(conn, &cbytes, &chttp, clientConnBuf(&conn->in), clientConnBufLen(&conn->in)); if (cbytes > 0) { Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.146.2.4.4.37 retrieving revision 1.146.2.4.4.38 diff -u -r1.146.2.4.4.37 -r1.146.2.4.4.38 --- squid/src/protos.h 14 Jan 2008 06:20:04 -0000 1.146.2.4.4.37 +++ squid/src/protos.h 15 Jan 2008 14:36:45 -0000 1.146.2.4.4.38 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.146.2.4.4.37 2008/01/14 06:20:04 adri Exp $ + * $Id: protos.h,v 1.146.2.4.4.38 2008/01/15 14:36:45 adri Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -813,7 +813,7 @@ extern void start_announce(void *unused); -extern void sslStart(clientHttpRequest *, squid_off_t *, int *); +extern void sslStart(clientHttpRequest *, squid_off_t *, int *, const char *buf, int len); /* ident.c */ #if USE_IDENT Index: squid/src/ssl.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ssl.c,v retrieving revision 1.31.6.2.4.3 retrieving revision 1.31.6.2.4.4 diff -u -r1.31.6.2.4.3 -r1.31.6.2.4.4 --- squid/src/ssl.c 14 Jan 2008 06:20:05 -0000 1.31.6.2.4.3 +++ squid/src/ssl.c 15 Jan 2008 14:36:45 -0000 1.31.6.2.4.4 @@ -1,6 +1,6 @@ /* - * $Id: ssl.c,v 1.31.6.2.4.3 2008/01/14 06:20:05 adri Exp $ + * $Id: ssl.c,v 1.31.6.2.4.4 2008/01/15 14:36:45 adri Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -487,7 +487,7 @@ CBDATA_TYPE(SslStateData); void -sslStart(clientHttpRequest * http, squid_off_t * size_ptr, int *status_ptr) +sslStart(clientHttpRequest * http, squid_off_t * size_ptr, int *status_ptr, const char *s_buf, int s_len) { /* Create state structure. */ SslStateData *sslState = NULL; @@ -554,16 +554,14 @@ sslState->server.buf = xmalloc(SQUID_TCP_SO_RCVBUF); sslState->client.buf = xmalloc(SQUID_TCP_SO_RCVBUF); /* Copy any pending data from the client connection */ - sslState->client.len = clientConnBufLen(&http->conn->in); + sslState->client.len = s_len; sslState->request->out_ip = outgoing; if (sslState->client.len > 0) { if (sslState->client.len > SQUID_TCP_SO_RCVBUF) { safe_free(sslState->client.buf); sslState->client.buf = xmalloc(sslState->client.len); } - clientConnBufCopy(&http->conn->in, sslState->client.buf, sslState->client.len); - clientConnBufConsume(&http->conn->in, sslState->client.len); - assert(clientConnBufLen(&http->conn->in) == 0); + xmemcpy(sslState->client.buf, s_buf, sslState->client.len); } comm_add_close_handler(sslState->server.fd, sslServerClosed,