]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
replaced url.c::url_escape() with rfc1738_escape()
authorwessels <>
Thu, 16 Jul 1998 05:56:24 +0000 (05:56 +0000)
committerwessels <>
Thu, 16 Jul 1998 05:56:24 +0000 (05:56 +0000)
src/gopher.cc
src/url.cc

index 38eb89b30e0b0d6c538a9a432c932cccc7091189..bc430423586fb0af9e9e1888abb9025efeb7c4af 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: gopher.cc,v 1.129 1998/06/09 21:18:49 wessels Exp $
+ * $Id: gopher.cc,v 1.130 1998/07/15 23:56:25 wessels Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -505,7 +505,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
                                port[0] = 0;    /* 0 means none */
                        }
                        /* escape a selector here */
-                       escaped_selector = url_escape(selector);
+                       escaped_selector = xstrdup(rfc1738_escape(selector));
 
                        switch (gtype) {
                        case GOPHER_DIRECTORY:
index 1be5fc91c232cca0979412ff93cc55a71281e155..f85ecfb78e54c6712388b7c587b0e526e550d00b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: url.cc,v 1.97 1998/06/24 23:04:59 wessels Exp $
+ * $Id: url.cc,v 1.98 1998/07/15 23:56:24 wessels Exp $
  *
  * DEBUG: section 23    URL Parsing
  * AUTHOR: Duane Wessels
@@ -59,7 +59,6 @@ const char *ProtocolStr[] =
     "TOTAL"
 };
 
-static int url_ok[256];
 static const char *const hex = "0123456789abcdef";
 static request_t *urnParse(method_t method, char *urn);
 static const char *const valid_hostname_chars =
@@ -72,8 +71,6 @@ static const char *const valid_hostname_chars =
 "abcdefghijklmnopqrstuvwxyz"
 "0123456789-.";
 #endif
-static const char *const valid_url_chars =
-"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./-_$";
 
 /* convert %xx in url string to a character 
  * Allocate a new string and return a pointer to converted string */
@@ -109,31 +106,6 @@ urlInitialize(void)
     int i;
     debug(23, 5) ("urlInitialize: Initializing...\n");
     assert(sizeof(ProtocolStr) == (PROTO_MAX + 1) * sizeof(char *));
-    for (i = 0; i < 256; i++)
-       url_ok[i] = strchr(valid_url_chars, (char) i) ? 1 : 0;
-
-}
-
-/* Encode prohibited char in string */
-/* return the pointer to new (allocated) string */
-char *
-url_escape(const char *url)
-{
-    const char *p;
-    char *q;
-    char *tmpline = xcalloc(1, MAX_URL);
-    q = tmpline;
-    for (p = url; *p; p++) {
-       if (url_ok[(int) (*p)])
-           *q++ = *p;
-       else {
-           *q++ = '%';         /* Means hex coming */
-           *q++ = hex[(int) ((*p) >> 4)];
-           *q++ = hex[(int) ((*p) & 15)];
-       }
-    }
-    *q++ = '\0';
-    return tmpline;
 }
 
 method_t