--------------------- PatchSet 10400 Date: 2008/01/14 06:20:02 Author: adri Branch: s27_adri Tag: (none) Log: Remove more direct references to conn->in members. Members: src/client_side.c:1.202.2.9.4.34->1.202.2.9.4.35 src/protos.h:1.146.2.4.4.36->1.146.2.4.4.37 src/ssl.c:1.31.6.2.4.2->1.31.6.2.4.3 src/stat.c:1.42.2.3.4.2->1.42.2.3.4.3 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.202.2.9.4.34 retrieving revision 1.202.2.9.4.35 diff -u -r1.202.2.9.4.34 -r1.202.2.9.4.35 --- squid/src/client_side.c 14 Jan 2008 05:47:29 -0000 1.202.2.9.4.34 +++ squid/src/client_side.c 14 Jan 2008 06:20:02 -0000 1.202.2.9.4.35 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.202.2.9.4.34 2008/01/14 05:47:29 adri Exp $ + * $Id: client_side.c,v 1.202.2.9.4.35 2008/01/14 06:20:02 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -225,7 +225,32 @@ void clientConnBufCopy(ConnInBuf *in, char *dst, int numbytes) { + assert(numbytes <= in->offset); + xmemmove(dst, in->buf, numbytes); +} + +const char * +clientConnBuf(ConnInBuf *in) +{ + return in->buf; +} + +int +clientConnBufLen(ConnInBuf *in) +{ + return in->offset; +} +int +clientConnBufCapacity(ConnInBuf *in) +{ + return in->size; +} + +int +clientConnBufIsFull(ConnInBuf *in) +{ + return (clientConnBufLen(in) >= clientConnBufCapacity(in)); } /* Temporary here while restructuring stuff */ @@ -3935,7 +3960,7 @@ fde *F = &fd_table[fd]; ConnStateData *conn = data; if (conn->body.size_left && !F->flags.socket_eof) { - if (conn->in.offset >= conn->in.size - 1) { + if (clientConnBufIsFull(&conn->in)) { commDeferFD(fd); return 1; } else { @@ -3977,7 +4002,7 @@ *chttp = NULL; *cbytes = 0; - HttpMsgBufInit(&msg, conn->in.buf, conn->in.offset); /* XXX for now there's no deallocation function needed but this may change */ + HttpMsgBufInit(&msg, clientConnBuf(&conn->in), clientConnBufLen(&conn->in)); /* 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++); if (nrequests >= (Config.onoff.pipeline_prefetch ? 2 : 1)) { @@ -4027,7 +4052,7 @@ debug(33, 1) ("clientReadRequest: FD %d (%s:%d) Invalid Request\n", fd, fd_table[fd].ipaddr, fd_table[fd].remote_port); err = errorCon(ERR_INVALID_REQ, HTTP_BAD_REQUEST, NULL); err->src_addr = conn->peer.sin_addr; - err->request_hdrs = xstrndup(conn->in.buf, conn->in.offset); + err->request_hdrs = xstrndup(clientConnBuf(&conn->in), clientConnBufLen(&conn->in)); http->log_type = LOG_TCP_DENIED; http->entry = clientCreateStoreEntry(http, method, null_request_flags); errorAppendEntry(http->entry, err); Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.146.2.4.4.36 retrieving revision 1.146.2.4.4.37 diff -u -r1.146.2.4.4.36 -r1.146.2.4.4.37 --- squid/src/protos.h 14 Jan 2008 04:51:34 -0000 1.146.2.4.4.36 +++ squid/src/protos.h 14 Jan 2008 06:20:04 -0000 1.146.2.4.4.37 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.146.2.4.4.36 2008/01/14 04:51:34 adri Exp $ + * $Id: protos.h,v 1.146.2.4.4.37 2008/01/14 06:20:04 adri Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1421,6 +1421,9 @@ extern void clientConnBufGrow(ConnInBuf *in, int newsize); extern void clientConnBufConsume(ConnInBuf *in, int consume); extern void clientConnBufCopy(ConnInBuf *in, char *dst, int numbytes); +extern const char * clientConnBuf(ConnInBuf *in); +extern int clientConnBufLen(ConnInBuf *in); +extern int clientConnBufCapacity(ConnInBuf *in); extern aclCheck_t *clientAclChecklistCreate(const acl_access * acl, const clientHttpRequest * http); extern void clientInterpretRequestHeaders(clientHttpRequest * http); Index: squid/src/ssl.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ssl.c,v retrieving revision 1.31.6.2.4.2 retrieving revision 1.31.6.2.4.3 diff -u -r1.31.6.2.4.2 -r1.31.6.2.4.3 --- squid/src/ssl.c 14 Jan 2008 04:51:35 -0000 1.31.6.2.4.2 +++ squid/src/ssl.c 14 Jan 2008 06:20:05 -0000 1.31.6.2.4.3 @@ -1,6 +1,6 @@ /* - * $Id: ssl.c,v 1.31.6.2.4.2 2008/01/14 04:51:35 adri Exp $ + * $Id: ssl.c,v 1.31.6.2.4.3 2008/01/14 06:20:05 adri Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -554,7 +554,7 @@ 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 = http->conn->in.offset; + sslState->client.len = clientConnBufLen(&http->conn->in); sslState->request->out_ip = outgoing; if (sslState->client.len > 0) { if (sslState->client.len > SQUID_TCP_SO_RCVBUF) { @@ -563,7 +563,7 @@ } clientConnBufCopy(&http->conn->in, sslState->client.buf, sslState->client.len); clientConnBufConsume(&http->conn->in, sslState->client.len); - assert(http->conn->in.offset == 0); + assert(clientConnBufLen(&http->conn->in) == 0); } comm_add_close_handler(sslState->server.fd, sslServerClosed, Index: squid/src/stat.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stat.c,v retrieving revision 1.42.2.3.4.2 retrieving revision 1.42.2.3.4.3 diff -u -r1.42.2.3.4.2 -r1.42.2.3.4.3 --- squid/src/stat.c 15 Dec 2007 12:07:45 -0000 1.42.2.3.4.2 +++ squid/src/stat.c 14 Jan 2008 06:20:06 -0000 1.42.2.3.4.3 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.42.2.3.4.2 2007/12/15 12:07:45 adri Exp $ + * $Id: stat.c,v 1.42.2.3.4.3 2008/01/14 06:20:06 adri Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -1482,7 +1482,7 @@ fd_table[fd].bytes_read, fd_table[fd].bytes_written); storeAppendPrintf(s, "\tFD desc: %s\n", fd_table[fd].desc); storeAppendPrintf(s, "\tin: buf %p, offset %ld, size %ld\n", - conn->in.buf, (long int) conn->in.offset, (long int) conn->in.size); + clientConnBuf(&conn->in), (long int) clientConnBufLen(&conn->in), (long int) clientConnBufCapacity(&conn->in)); storeAppendPrintf(s, "\tpeer: %s:%d\n", inet_ntoa(conn->peer.sin_addr), ntohs(conn->peer.sin_port));