]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Back out unintentional commit of unrelated url.cc changes
authorhno <>
Thu, 24 May 2007 03:07:43 +0000 (03:07 +0000)
committerhno <>
Thu, 24 May 2007 03:07:43 +0000 (03:07 +0000)
src/gopher.cc
src/protos.h
src/url.cc

index fb778de1829d4b3edd9a6d66f53dea9ced04c203..6dd6e779f094be9132584acc28352d891acfe547 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: gopher.cc,v 1.206 2007/05/23 20:59:14 hno Exp $
+ * $Id: gopher.cc,v 1.207 2007/05/23 21:07:43 hno Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -248,7 +248,7 @@ gopher_request_parse(const HttpRequest * req, char *type_id, char *request)
     if (request) {
         xstrncpy(request, path + 1, MAX_URL);
         /* convert %xx to char */
-        rfc1738_unescape(request);
+        url_convert_hex(request, 0);
     }
 }
 
index a1d000f3e2279f64313a115b75504752385bd577..39e107b54e453e22efa4b750956d214322b16f00 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.544 2007/05/23 20:59:14 hno Exp $
+ * $Id: protos.h,v 1.545 2007/05/23 21:07:43 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -624,6 +624,8 @@ SQUIDCEXTERN void unlinkdClose(void);
 SQUIDCEXTERN void unlinkdUnlink(const char *);
 #endif
 
+SQUIDCEXTERN char *url_convert_hex(char *org_url, int allocate);
+SQUIDCEXTERN char *url_escape(const char *url);
 SQUIDCEXTERN protocol_t urlParseProtocol(const char *, const char *e = NULL);
 SQUIDCEXTERN void urlInitialize(void);
 SQUIDCEXTERN HttpRequest *urlParse(method_t, char *, HttpRequest *request = NULL);
index 45b64b94f485f87ab08470f627938991e3553776..0dc79767f2c44a1eab318589f265208b6c79f13e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: url.cc,v 1.159 2007/05/23 20:59:14 hno Exp $
+ * $Id: url.cc,v 1.160 2007/05/23 21:07:43 hno Exp $
  *
  * DEBUG: section 23    URL Parsing
  * AUTHOR: Duane Wessels
@@ -49,6 +49,38 @@ static const char valid_hostname_chars[] =
     "0123456789-."
     ;
 
+/* convert %xx in url string to a character
+ * Allocate a new string and return a pointer to converted string */
+
+char *
+url_convert_hex(char *org_url, int allocate)
+{
+    static char code[] = "00";
+    char *url = NULL;
+    char *s = NULL;
+    char *t = NULL;
+    url = allocate ? (char *) xstrdup(org_url) : org_url;
+
+    if ((int) strlen(url) < 3 || !strchr(url, '%'))
+        return url;
+
+    for (s = t = url; *s; s++) {
+        if (*s == '%' && *(s + 1) && *(s + 2)) {
+            code[0] = *(++s);
+            code[1] = *(++s);
+            *t++ = (char) strtol(code, NULL, 16);
+        } else {
+            *t++ = *s;
+        }
+    }
+
+    do {
+        *t++ = *s;
+    } while (*s++);
+
+    return url;
+}
+
 void
 urlInitialize(void)
 {