From: Amos Jeffries Date: Tue, 31 Dec 2013 02:37:42 +0000 (-0800) Subject: Drop useless function mime_get_header() X-Git-Tag: merge-candidate-3-v1~506^2~74 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=496a1dcb9bdca2eb7624e49e207a6d51a5197d51;p=thirdparty%2Fsquid.git Drop useless function mime_get_header() Also, drop the unused prefix parameter from mime_get_header_field(). --- diff --git a/src/client_side.cc b/src/client_side.cc index 0e3121ad67..1f67c91e57 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -2121,7 +2121,7 @@ prepareAcceleratedURL(ConnStateData * conn, ClientHttpRequest *http, char *url, const bool switchedToHttps = conn->switchedToHttps(); const bool tryHostHeader = vhost || switchedToHttps; - if (tryHostHeader && (host = mime_get_header(req_hdr, "Host")) != NULL) { + if (tryHostHeader && (host = mime_get_header_field(req_hdr, "Host")) != NULL) { debugs(33, 5, "ACCEL VHOST REWRITE: vhost=" << host << " + vport=" << vport); char thost[256]; if (vport > 0) { @@ -2180,7 +2180,7 @@ prepareTransparentURL(ConnStateData * conn, ClientHttpRequest *http, char *url, /* BUG: Squid cannot deal with '*' URLs (RFC2616 5.1.2) */ - if ((host = mime_get_header(req_hdr, "Host")) != NULL) { + if ((host = mime_get_header_field(req_hdr, "Host")) != NULL) { int url_sz = strlen(url) + 32 + Config.appendDomainLen + strlen(host); http->uri = (char *)xcalloc(url_sz, 1); diff --git a/src/mime_header.cc b/src/mime_header.cc index 91829d5d3e..2347481171 100644 --- a/src/mime_header.cc +++ b/src/mime_header.cc @@ -41,14 +41,13 @@ * field-value matches prefix if any */ char * -mime_get_header_field(const char *mime, const char *name, const char *prefix) +mime_get_header_field(const char *mime, const char *name) { LOCAL_ARRAY(char, header, GET_HDR_SZ); const char *p = NULL; char *q = NULL; char got = 0; const int namelen = name ? strlen(name) : 0; - const int preflen = prefix ? strlen(prefix) : 0; int l; if (NULL == mime) @@ -94,12 +93,6 @@ mime_get_header_field(const char *mime, const char *name, const char *prefix) got = 1; } - if (got && prefix) { - /* we could process list entries here if we had strcasestr(). */ - /* make sure we did not match a part of another field-value */ - got = !strncasecmp(q, prefix, preflen) && !xisalpha(q[preflen]); - } - if (got) { debugs(25, 5, "mime_get_header: returning '" << q << "'"); return q; @@ -109,13 +102,6 @@ mime_get_header_field(const char *mime, const char *name, const char *prefix) return NULL; } -/* returns a pointer to a field-value of the first matching field-name */ -char * -mime_get_header(const char *mime, const char *name) -{ - return mime_get_header_field(mime, name, NULL); -} - size_t headersEnd(const char *mime, size_t l) { diff --git a/src/mime_header.h b/src/mime_header.h index cd67dfdb53..3fd272bf18 100644 --- a/src/mime_header.h +++ b/src/mime_header.h @@ -33,8 +33,7 @@ #ifndef SQUID_MIME_HEADER_H_ #define SQUID_MIME_HEADER_H_ -char *mime_get_header(const char *mime, const char *header); -char *mime_get_header_field(const char *mime, const char *name, const char *prefix); +char *mime_get_header_field(const char *mime, const char *name); size_t headersEnd(const char *, size_t); #endif /* SQUID_MIME_HEADER_H_ */