From: wessels <> Date: Thu, 16 Jul 1998 05:56:24 +0000 (+0000) Subject: replaced url.c::url_escape() with rfc1738_escape() X-Git-Tag: SQUID_3_0_PRE1~3078 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=80fcad81c2a59f7c0736a8a48e55b2639309e2ca;p=thirdparty%2Fsquid.git replaced url.c::url_escape() with rfc1738_escape() --- diff --git a/src/gopher.cc b/src/gopher.cc index 38eb89b30e..bc43042358 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -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: diff --git a/src/url.cc b/src/url.cc index 1be5fc91c2..f85ecfb78e 100644 --- a/src/url.cc +++ b/src/url.cc @@ -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