]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Drop useless function mime_get_header()
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 31 Dec 2013 02:37:42 +0000 (18:37 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 31 Dec 2013 02:37:42 +0000 (18:37 -0800)
Also, drop the unused prefix parameter from mime_get_header_field().

src/client_side.cc
src/mime_header.cc
src/mime_header.h

index 0e3121ad671b5535e3a66c9c7101042a649bf1ef..1f67c91e5736d9a84d16c9eb3b867b81ade63c00 100644 (file)
@@ -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);
index 91829d5d3ec6756ef9188a1058cb30c01d4eb578..2347481171e0133d1d37bc0f5543b224128f1c95 100644 (file)
  * 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)
 {
index cd67dfdb536e476270a615a596bf513315e3555c..3fd272bf18ac8be423a93829ea720bfe9b3ae705 100644 (file)
@@ -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_ */