--------------------- PatchSet 10244 Date: 2007/12/14 13:07:10 Author: adri Branch: s27_adri Tag: (none) Log: strBuf() -> strBuf2() - pass a length to urlParse() and to rfc1738_escape_str(). (41 left.) Members: lib/rfc1738.c:1.7->1.7.12.1 src/HttpHeader.c:1.28.6.1.4.15->1.28.6.1.4.16 src/asn.c:1.22.10.1->1.22.10.1.4.1 src/client_side.c:1.202.2.9.4.13->1.202.2.9.4.14 src/client_side_rewrite.c:1.2.4.2.4.1->1.2.4.2.4.2 src/errormap.c:1.4.12.1->1.4.12.1.4.1 src/htcp.c:1.25->1.25.16.1 src/http.c:1.63.2.3.4.7->1.63.2.3.4.8 src/icp_v2.c:1.10->1.10.32.1 src/icp_v3.c:1.6->1.6.58.1 src/mime.c:1.19->1.19.12.1 src/neighbors.c:1.33->1.33.10.1 src/net_db.c:1.26.2.1->1.26.2.1.4.1 src/peer_digest.c:1.21.10.2.4.1->1.21.10.2.4.2 src/peer_monitor.c:1.6.2.1->1.6.2.1.4.1 src/protos.h:1.146.2.4.4.16->1.146.2.4.4.17 src/refresh_check.c:1.2.4.2->1.2.4.2.4.1 src/store_digest.c:1.14->1.14.12.1 src/url.c:1.22.12.1->1.22.12.2 src/urn.c:1.24.6.2.4.4->1.24.6.2.4.5 Index: squid/lib/rfc1738.c =================================================================== RCS file: /cvsroot/squid-sf//squid/lib/rfc1738.c,v retrieving revision 1.7 retrieving revision 1.7.12.1 diff -u -r1.7 -r1.7.12.1 --- squid/lib/rfc1738.c 23 May 2007 22:52:21 -0000 1.7 +++ squid/lib/rfc1738.c 14 Dec 2007 13:07:10 -0000 1.7.12.1 @@ -1,5 +1,5 @@ /* - * $Id: rfc1738.c,v 1.7 2007/05/23 22:52:21 squidadm Exp $ + * $Id: rfc1738.c,v 1.7.12.1 2007/12/14 13:07:10 adri Exp $ * * DEBUG: * AUTHOR: Harvest Derived @@ -86,20 +86,20 @@ * compliant, escaped version of the given url. */ static char * -rfc1738_do_escape(const char *url, int encode_reserved) +rfc1738_do_escape(const char *url, int len, int encode_reserved) { static char *buf; static size_t bufsize = 0; const char *p; char *q; - unsigned int i, do_escape; + unsigned int i, do_escape, j; - if (buf == NULL || strlen(url) * 3 > bufsize) { + if (buf == NULL || len * 3 > bufsize) { xfree(buf); - bufsize = strlen(url) * 3 + 1; + bufsize = len * 3 + 1; buf = xcalloc(bufsize, 1); } - for (p = url, q = buf; *p != '\0'; p++, q++) { + for (p = url, q = buf, j = 0; j < len; p++, q++, j++) { do_escape = 0; /* RFC 1738 defines these chars as unsafe */ @@ -153,7 +153,13 @@ char * rfc1738_escape(const char *url) { - return rfc1738_do_escape(url, 0); + return rfc1738_do_escape(url, strlen(url), 0); +} + +char * +rfc1738_escape_str(const char *url, int len) +{ + return rfc1738_do_escape(url, len, 0); } /* @@ -163,7 +169,7 @@ char * rfc1738_escape_unescaped(const char *url) { - return rfc1738_do_escape(url, -1); + return rfc1738_do_escape(url, strlen(url), -1); } /* @@ -173,7 +179,7 @@ char * rfc1738_escape_part(const char *url) { - return rfc1738_do_escape(url, 1); + return rfc1738_do_escape(url, strlen(url), 1); } /* Index: squid/src/HttpHeader.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHeader.c,v retrieving revision 1.28.6.1.4.15 retrieving revision 1.28.6.1.4.16 diff -u -r1.28.6.1.4.15 -r1.28.6.1.4.16 --- squid/src/HttpHeader.c 14 Dec 2007 02:49:42 -0000 1.28.6.1.4.15 +++ squid/src/HttpHeader.c 14 Dec 2007 13:07:11 -0000 1.28.6.1.4.16 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.c,v 1.28.6.1.4.15 2007/12/14 02:49:42 adri Exp $ + * $Id: HttpHeader.c,v 1.28.6.1.4.16 2007/12/14 13:07:11 adri Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -626,7 +626,7 @@ /* * same as httpHeaderFindEntry */ -static HttpHeaderEntry * +HttpHeaderEntry * httpHeaderFindLastEntry(const HttpHeader * hdr, http_hdr_type id) { HttpHeaderPos pos = HttpHeaderInitPos; @@ -1126,20 +1126,6 @@ } -/* unusual */ -const char * -httpHeaderGetLastStr(const HttpHeader * hdr, http_hdr_type id) -{ - HttpHeaderEntry *e; - assert_eid(id); - assert(Headers[id].type == ftStr); /* must be of an appropriate type */ - if ((e = httpHeaderFindLastEntry(hdr, id))) { - httpHeaderNoteParsedEntry(e->id, e->value, 0); /* no errors are possible */ - return strBuf(e->value); - } - return NULL; -} - HttpHdrCc * httpHeaderGetCc(const HttpHeader * hdr) { Index: squid/src/asn.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/asn.c,v retrieving revision 1.22.10.1 retrieving revision 1.22.10.1.4.1 diff -u -r1.22.10.1 -r1.22.10.1.4.1 --- squid/src/asn.c 2 Oct 2007 09:27:11 -0000 1.22.10.1 +++ squid/src/asn.c 14 Dec 2007 13:07:12 -0000 1.22.10.1.4.1 @@ -1,6 +1,6 @@ /* - * $Id: asn.c,v 1.22.10.1 2007/10/02 09:27:11 adri Exp $ + * $Id: asn.c,v 1.22.10.1.4.1 2007/12/14 13:07:12 adri Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -199,7 +199,7 @@ debug(53, 3) ("asnCacheStart: AS %d\n", as); snprintf(asres, 4096, "whois://%s/!gAS%d", Config.as_whois_server, as); asState->as_number = as; - req = urlParse(METHOD_GET, asres); + req = urlParse(METHOD_GET, asres, strlen(asres)); assert(NULL != req); asState->request = requestLink(req); if ((e = storeGetPublic(asres, METHOD_GET)) == NULL) { Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.202.2.9.4.13 retrieving revision 1.202.2.9.4.14 diff -u -r1.202.2.9.4.13 -r1.202.2.9.4.14 --- squid/src/client_side.c 14 Dec 2007 07:09:37 -0000 1.202.2.9.4.13 +++ squid/src/client_side.c 14 Dec 2007 13:07:12 -0000 1.202.2.9.4.14 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.202.2.9.4.13 2007/12/14 07:09:37 adri Exp $ + * $Id: client_side.c,v 1.202.2.9.4.14 2007/12/14 13:07:12 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -3831,7 +3831,7 @@ errorAppendEntry(http->entry, err); return -1; } - if ((request = urlParse(method, http->uri)) == NULL) { + if ((request = urlParse(method, http->uri, strlen(http->uri))) == NULL) { debug(33, 5) ("Invalid URL: %s\n", http->uri); err = errorCon(ERR_INVALID_URL, HTTP_BAD_REQUEST, NULL); err->src_addr = conn->peer.sin_addr; @@ -3872,7 +3872,10 @@ http->flags.internal = 1; if (http->flags.internal) { request_t *old_request = requestLink(request); - request = urlParse(method, internalStoreUri("", strBuf(request->urlpath))); + const char *url; + + url = internalStoreUri("", strBuf(request->urlpath)); + request = urlParse(method, url, strlen(url)); httpHeaderAppend(&request->header, &old_request->header); requestUnlink(old_request); } Index: squid/src/client_side_rewrite.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side_rewrite.c,v retrieving revision 1.2.4.2.4.1 retrieving revision 1.2.4.2.4.2 diff -u -r1.2.4.2.4.1 -r1.2.4.2.4.2 --- squid/src/client_side_rewrite.c 12 Dec 2007 16:18:52 -0000 1.2.4.2.4.1 +++ squid/src/client_side_rewrite.c 14 Dec 2007 13:07:14 -0000 1.2.4.2.4.2 @@ -1,6 +1,6 @@ /* - * $Id: client_side_rewrite.c,v 1.2.4.2.4.1 2007/12/12 16:18:52 adri Exp $ + * $Id: client_side_rewrite.c,v 1.2.4.2.4.2 2007/12/14 13:07:14 adri Exp $ * * DEBUG: section 33 Client-side Routines - URL Rewriter * AUTHOR: Duane Wessels; Adrian Chadd @@ -102,7 +102,7 @@ debug(33, 1) ("clientRedirectDone: bad input: %s\n", result); } } else if (strcmp(result, http->uri)) - new_request = urlParse(old_request->method, result); + new_request = urlParse(old_request->method, result, strlen(result)); } redirect_parsed: if (new_request) { Index: squid/src/errormap.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/errormap.c,v retrieving revision 1.4.12.1 retrieving revision 1.4.12.1.4.1 diff -u -r1.4.12.1 -r1.4.12.1.4.1 --- squid/src/errormap.c 29 Sep 2007 16:41:12 -0000 1.4.12.1 +++ squid/src/errormap.c 14 Dec 2007 13:07:15 -0000 1.4.12.1.4.1 @@ -179,7 +179,7 @@ errorUrl = getErrorMap(map, status, squid_error, aclname); if (!errorUrl) return 0; - req = urlParse(METHOD_GET, (char *) errorUrl); + req = urlParse(METHOD_GET, (char *) errorUrl, strlen((char *) errorUrl)); if (!req) { debug(0, 0) ("error_map: Invalid error URL '%s'\n", errorUrl); return 0; Index: squid/src/htcp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/htcp.c,v retrieving revision 1.25 retrieving revision 1.25.16.1 diff -u -r1.25 -r1.25.16.1 --- squid/src/htcp.c 21 Jan 2007 14:03:49 -0000 1.25 +++ squid/src/htcp.c 14 Dec 2007 13:07:15 -0000 1.25.16.1 @@ -1,6 +1,6 @@ /* - * $Id: htcp.c,v 1.25 2007/01/21 14:03:49 squidadm Exp $ + * $Id: htcp.c,v 1.25.16.1 2007/12/14 13:07:15 adri Exp $ * * DEBUG: section 31 Hypertext Caching Protocol * AUTHOR: Duane Wesssels @@ -554,7 +554,7 @@ * Parse the request */ method = urlParseMethod(s->method, strlen(s->method)); - s->request = urlParse(method == METHOD_NONE ? METHOD_GET : method, s->uri); + s->request = urlParse(method == METHOD_NONE ? METHOD_GET : method, s->uri, strlen(s->uri)); return s; } Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.63.2.3.4.7 retrieving revision 1.63.2.3.4.8 diff -u -r1.63.2.3.4.7 -r1.63.2.3.4.8 --- squid/src/http.c 14 Dec 2007 06:46:33 -0000 1.63.2.3.4.7 +++ squid/src/http.c 14 Dec 2007 13:07:15 -0000 1.63.2.3.4.8 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.63.2.3.4.7 2007/12/14 06:46:33 adri Exp $ + * $Id: http.c,v 1.63.2.3.4.8 2007/12/14 13:07:15 adri Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -1368,9 +1368,10 @@ http_state_flags flags) { const int offset = mb->size; - memBufPrintf(mb, "%s %s HTTP/1.0\r\n", + memBufPrintf(mb, "%s %.*s HTTP/1.0\r\n", RequestMethods[request->method].str, - strLen(request->urlpath) ? strBuf(request->urlpath) : "/"); + strLen2(request->urlpath) ? strLen2(request->urlpath) : 1, + strLen2(request->urlpath) ? strBuf2(request->urlpath) : "/"); /* build and pack headers */ { HttpHeader hdr; Index: squid/src/icp_v2.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/icp_v2.c,v retrieving revision 1.10 retrieving revision 1.10.32.1 diff -u -r1.10 -r1.10.32.1 --- squid/src/icp_v2.c 25 Jun 2006 16:52:06 -0000 1.10 +++ squid/src/icp_v2.c 14 Dec 2007 13:07:15 -0000 1.10.32.1 @@ -1,6 +1,6 @@ /* - * $Id: icp_v2.c,v 1.10 2006/06/25 16:52:06 squidadm Exp $ + * $Id: icp_v2.c,v 1.10.32.1 2007/12/14 13:07:15 adri Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -218,7 +218,7 @@ icpUdpSend(fd, &from, reply, LOG_UDP_INVALID, 0); break; } - if ((icp_request = urlParse(METHOD_GET, url)) == NULL) { + if ((icp_request = urlParse(METHOD_GET, url, strlen(url))) == NULL) { reply = icpCreateMessage(ICP_ERR, 0, url, header.reqnum, 0); icpUdpSend(fd, &from, reply, LOG_UDP_INVALID, 0); break; Index: squid/src/icp_v3.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/icp_v3.c,v retrieving revision 1.6 retrieving revision 1.6.58.1 diff -u -r1.6 -r1.6.58.1 --- squid/src/icp_v3.c 28 Apr 2006 11:10:52 -0000 1.6 +++ squid/src/icp_v3.c 14 Dec 2007 13:07:15 -0000 1.6.58.1 @@ -1,6 +1,6 @@ /* - * $Id: icp_v3.c,v 1.6 2006/04/28 11:10:52 squidadm Exp $ + * $Id: icp_v3.c,v 1.6.58.1 2007/12/14 13:07:15 adri Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -72,7 +72,7 @@ icpUdpSend(fd, &from, reply, LOG_UDP_INVALID, 0); break; } - if ((icp_request = urlParse(METHOD_GET, url)) == NULL) { + if ((icp_request = urlParse(METHOD_GET, url, strlen(url))) == NULL) { reply = icpCreateMessage(ICP_ERR, 0, url, header.reqnum, 0); icpUdpSend(fd, &from, reply, LOG_UDP_INVALID, 0); break; Index: squid/src/mime.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/mime.c,v retrieving revision 1.19 retrieving revision 1.19.12.1 diff -u -r1.19 -r1.19.12.1 --- squid/src/mime.c 26 Feb 2007 09:51:32 -0000 1.19 +++ squid/src/mime.c 14 Dec 2007 13:07:15 -0000 1.19.12.1 @@ -1,6 +1,6 @@ /* - * $Id: mime.c,v 1.19 2007/02/26 09:51:32 squidadm Exp $ + * $Id: mime.c,v 1.19.12.1 2007/12/14 13:07:15 adri Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -431,7 +431,7 @@ EBIT_SET(e->flags, ENTRY_SPECIAL); storeSetPublicKey(e); storeBuffer(e); - r = urlParse(METHOD_GET, url); + r = urlParse(METHOD_GET, url, strlen(url)); if (NULL == r) fatal("mimeLoadIcon: cannot parse internal URL"); e->mem_obj->request = requestLink(r); Index: squid/src/neighbors.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/neighbors.c,v retrieving revision 1.33 retrieving revision 1.33.10.1 diff -u -r1.33 -r1.33.10.1 --- squid/src/neighbors.c 29 Aug 2007 00:18:37 -0000 1.33 +++ squid/src/neighbors.c 14 Dec 2007 13:07:15 -0000 1.33.10.1 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.c,v 1.33 2007/08/29 00:18:37 squidadm Exp $ + * $Id: neighbors.c,v 1.33.10.1 2007/12/14 13:07:15 adri Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -1165,7 +1165,7 @@ snprintf(url, MAX_URL, "http://%s/", inet_ntoa(p->in_addr.sin_addr)); fake = storeCreateEntry(url, null_request_flags, METHOD_GET); psstate = cbdataAlloc(ps_state); - psstate->request = requestLink(urlParse(METHOD_GET, url)); + psstate->request = requestLink(urlParse(METHOD_GET, url, strlen(url))); psstate->entry = fake; psstate->callback = NULL; psstate->callback_data = p; Index: squid/src/net_db.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/net_db.c,v retrieving revision 1.26.2.1 retrieving revision 1.26.2.1.4.1 diff -u -r1.26.2.1 -r1.26.2.1.4.1 --- squid/src/net_db.c 30 Nov 2007 04:29:03 -0000 1.26.2.1 +++ squid/src/net_db.c 14 Dec 2007 13:07:15 -0000 1.26.2.1.4.1 @@ -1,6 +1,6 @@ /* - * $Id: net_db.c,v 1.26.2.1 2007/11/30 04:29:03 adri Exp $ + * $Id: net_db.c,v 1.26.2.1.4.1 2007/12/14 13:07:15 adri Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -991,7 +991,7 @@ uri = internalRemoteUri(p->host, p->http_port, "/squid-internal-dynamic/", "netdb"); debug(38, 3) ("netdbExchangeStart: Requesting '%s'\n", uri); assert(NULL != uri); - ex->r = urlParse(METHOD_GET, uri); + ex->r = urlParse(METHOD_GET, uri, strlen(url)); if (NULL == ex->r) { debug(38, 1) ("netdbExchangeStart: Bad URI %s\n", uri); return; Index: squid/src/peer_digest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/peer_digest.c,v retrieving revision 1.21.10.2.4.1 retrieving revision 1.21.10.2.4.2 diff -u -r1.21.10.2.4.1 -r1.21.10.2.4.2 --- squid/src/peer_digest.c 12 Dec 2007 10:14:22 -0000 1.21.10.2.4.1 +++ squid/src/peer_digest.c 14 Dec 2007 13:07:15 -0000 1.21.10.2.4.2 @@ -1,6 +1,6 @@ /* - * $Id: peer_digest.c,v 1.21.10.2.4.1 2007/12/12 10:14:22 adri Exp $ + * $Id: peer_digest.c,v 1.21.10.2.4.2 2007/12/14 13:07:15 adri Exp $ * * DEBUG: section 72 Peer Digest Routines * AUTHOR: Alex Rousskov @@ -285,7 +285,7 @@ url = internalRemoteUri(p->host, p->http_port, "/squid-internal-periodic/", StoreDigestFileName); - req = urlParse(METHOD_GET, url); + req = urlParse(METHOD_GET, url, strlen(url)); assert(req); key = storeKeyPublicByRequest(req); debug(72, 2) ("peerDigestRequest: %s key: %s\n", url, storeKeyText(key)); Index: squid/src/peer_monitor.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/peer_monitor.c,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.1.4.1 diff -u -r1.6.2.1 -r1.6.2.1.4.1 --- squid/src/peer_monitor.c 2 Oct 2007 09:59:21 -0000 1.6.2.1 +++ squid/src/peer_monitor.c 14 Dec 2007 13:07:16 -0000 1.6.2.1.4.1 @@ -1,6 +1,6 @@ /* - * $Id: peer_monitor.c,v 1.6.2.1 2007/10/02 09:59:21 adri Exp $ + * $Id: peer_monitor.c,v 1.6.2.1.4.1 2007/12/14 13:07:16 adri Exp $ * * DEBUG: section ?? Peer monitoring * AUTHOR: Henrik Nordstrom @@ -156,7 +156,7 @@ cbdataFree(pm); return; } - req = urlParse(METHOD_GET, url); + req = urlParse(METHOD_GET, url, strlen(url)); if (!req) { debug(DBG, 1) ("peerMonitorRequest: Failed to parse URL '%s' for cache_peer %s\n", url, pm->peer->name); cbdataFree(pm); Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.146.2.4.4.16 retrieving revision 1.146.2.4.4.17 diff -u -r1.146.2.4.4.16 -r1.146.2.4.4.17 --- squid/src/protos.h 14 Dec 2007 06:11:29 -0000 1.146.2.4.4.16 +++ squid/src/protos.h 14 Dec 2007 13:07:16 -0000 1.146.2.4.4.17 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.146.2.4.4.16 2007/12/14 06:11:29 adri Exp $ + * $Id: protos.h,v 1.146.2.4.4.17 2007/12/14 13:07:16 adri Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1131,7 +1131,7 @@ extern protocol_t urlParseProtocol(const char *); extern method_t urlParseMethod(const char *, int len); extern void urlInitialize(void); -extern request_t *urlParse(method_t, char *); +extern request_t *urlParse(method_t, char *, int); extern const char *urlCanonical(request_t *); extern char *urlRInternal(const char *host, u_short port, const char *dir, const char *name); extern char *urlInternal(const char *dir, const char *name); Index: squid/src/refresh_check.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/refresh_check.c,v retrieving revision 1.2.4.2 retrieving revision 1.2.4.2.4.1 diff -u -r1.2.4.2 -r1.2.4.2.4.1 --- squid/src/refresh_check.c 27 Nov 2007 08:12:28 -0000 1.2.4.2 +++ squid/src/refresh_check.c 14 Dec 2007 13:07:17 -0000 1.2.4.2.4.1 @@ -1,6 +1,6 @@ /* - * $Id: refresh_check.c,v 1.2.4.2 2007/11/27 08:12:28 adri Exp $ + * $Id: refresh_check.c,v 1.2.4.2.4.1 2007/12/14 13:07:17 adri Exp $ * * DEBUG: section 84 Refresh Check Helper * AUTHOR: Henrik Nordstrom @@ -287,29 +287,35 @@ char buf[256]; const char *str = NULL; const char *quoted; + int len = -1; switch (format->type) { case REFRESH_CHECK_URI: str = entry->mem_obj->url; + len = strlen(str); break; case REFRESH_CHECK_AGE: - snprintf(buf, sizeof(buf), "%ld", (long int) (squid_curtime - entry->timestamp)); + len = snprintf(buf, sizeof(buf), "%ld", (long int) (squid_curtime - entry->timestamp)); str = buf; break; case REFRESH_CHECK_RESP_HEADER: sb = httpHeaderGetByName(&reply->header, format->header); - str = strBuf(sb); + str = strBuf2(sb); + len = strLen2(sb); break; case REFRESH_CHECK_RESP_HEADER_ID: sb = httpHeaderGetStrOrList(&reply->header, format->header_id); - str = strBuf(sb); + str = strBuf2(sb); + len = strLen2(sb); break; case REFRESH_CHECK_RESP_HEADER_MEMBER: sb = httpHeaderGetByNameListMember(&reply->header, format->header, format->member, format->separator); - str = strBuf(sb); + str = strBuf2(sb); + len = strLen2(sb); break; case REFRESH_CHECK_RESP_HEADER_ID_MEMBER: sb = httpHeaderGetListMember(&reply->header, format->header_id, format->member, format->separator); - str = strBuf(sb); + str = strBuf2(sb); + len = strLen2(sb); break; case REFRESH_CHECK_UNKNOWN: @@ -317,11 +323,14 @@ fatal("unknown refresh_check_program format error"); break; } - if (!str || !*str) + if (!str || !*str) { str = "-"; + len = 1; + } + assert(len > -1); if (!first) memBufAppend(&mb, " ", 1); - quoted = rfc1738_escape(str); + quoted = rfc1738_escape_str(str, len); memBufAppend(&mb, quoted, strlen(quoted)); stringClean(&sb); first = 0; Index: squid/src/store_digest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_digest.c,v retrieving revision 1.14 retrieving revision 1.14.12.1 diff -u -r1.14 -r1.14.12.1 --- squid/src/store_digest.c 26 Feb 2007 09:51:32 -0000 1.14 +++ squid/src/store_digest.c 14 Dec 2007 13:07:17 -0000 1.14.12.1 @@ -1,6 +1,6 @@ /* - * $Id: store_digest.c,v 1.14 2007/02/26 09:51:32 squidadm Exp $ + * $Id: store_digest.c,v 1.14.12.1 2007/12/14 13:07:17 adri Exp $ * * DEBUG: section 71 Store Digest Manager * AUTHOR: Alex Rousskov @@ -355,7 +355,7 @@ sd_state.rewrite_lock = cbdataAlloc(generic_cbdata); sd_state.rewrite_lock->data = e; debug(71, 3) ("storeDigestRewrite: url: %s key: %s\n", url, storeKeyText(e->hash.key)); - e->mem_obj->request = requestLink(urlParse(METHOD_GET, url)); + e->mem_obj->request = requestLink(urlParse(METHOD_GET, url, strlen(url))); /* wait for rebuild (if any) to finish */ if (sd_state.rebuild_lock) { debug(71, 2) ("storeDigestRewriteStart: waiting for rebuild to finish.\n"); Index: squid/src/url.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/url.c,v retrieving revision 1.22.12.1 retrieving revision 1.22.12.2 diff -u -r1.22.12.1 -r1.22.12.2 --- squid/src/url.c 10 Dec 2007 19:13:07 -0000 1.22.12.1 +++ squid/src/url.c 14 Dec 2007 13:07:17 -0000 1.22.12.2 @@ -1,6 +1,6 @@ /* - * $Id: url.c,v 1.22.12.1 2007/12/10 19:13:07 adri Exp $ + * $Id: url.c,v 1.22.12.2 2007/12/14 13:07:17 adri Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -256,7 +256,7 @@ * being "end of host with implied path of /". */ request_t * -urlParse(method_t method, char *url) +urlParse(method_t method, char *url, int l) { LOCAL_ARRAY(char, proto, MAX_URL); LOCAL_ARRAY(char, login, MAX_URL); @@ -267,13 +267,12 @@ char *q = NULL; int port; protocol_t protocol = PROTO_NONE; - int l; int i; const char *src; char *dst; proto[0] = host[0] = urlpath[0] = login[0] = '\0'; - if ((l = strlen(url)) + Config.appendDomainLen > (MAX_URL - 1)) { + if (l + Config.appendDomainLen > (MAX_URL - 1)) { /* terminate so it doesn't overflow other buffers */ *(url + (MAX_URL >> 1)) = '\0'; debug(23, 1) ("urlParse: URL too large (%d bytes)\n", l); Index: squid/src/urn.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/urn.c,v retrieving revision 1.24.6.2.4.4 retrieving revision 1.24.6.2.4.5 diff -u -r1.24.6.2.4.4 -r1.24.6.2.4.5 --- squid/src/urn.c 12 Dec 2007 10:15:34 -0000 1.24.6.2.4.4 +++ squid/src/urn.c 14 Dec 2007 13:07:17 -0000 1.24.6.2.4.5 @@ -1,6 +1,6 @@ /* - * $Id: urn.c,v 1.24.6.2.4.4 2007/12/12 10:15:34 adri Exp $ + * $Id: urn.c,v 1.24.6.2.4.5 2007/12/14 13:07:17 adri Exp $ * * DEBUG: section 52 URN Parsing * AUTHOR: Kostas Anagnostakis @@ -128,7 +128,7 @@ } snprintf(urlres, 4096, "http://%s/uri-res/N2L?urn:%.*s", host, strLen2(r->urlpath), strBuf2(r->urlpath)); safe_free(host); - urlres_r = urlParse(METHOD_GET, urlres); + urlres_r = urlParse(METHOD_GET, urlres, strlen(urlres)); if (urlres_r == NULL) { debug(52, 3) ("urnStart: Bad uri-res URL %s\n", urlres); err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND, r);