File 10829.patch of Package squid-beta
---------------------
PatchSet 10829
Date: 2007/05/23 21:07:43
Author: hno
Branch: HEAD
Tag: (none)
Log:
Back out unintentional commit of unrelated url.cc changes
Members:
src/gopher.cc:1.206->1.207
src/protos.h:1.544->1.545
src/url.cc:1.159->1.160
Index: squid3/src/gopher.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/gopher.cc,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -r1.206 -r1.207
--- squid3/src/gopher.cc 23 May 2007 20:59:14 -0000 1.206
+++ squid3/src/gopher.cc 23 May 2007 21:07:43 -0000 1.207
@@ -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 @@
if (request) {
xstrncpy(request, path + 1, MAX_URL);
/* convert %xx to char */
- rfc1738_unescape(request);
+ url_convert_hex(request, 0);
}
}
Index: squid3/src/protos.h
===================================================================
RCS file: /cvsroot/squid/squid3/src/protos.h,v
retrieving revision 1.544
retrieving revision 1.545
diff -u -r1.544 -r1.545
--- squid3/src/protos.h 23 May 2007 20:59:14 -0000 1.544
+++ squid3/src/protos.h 23 May 2007 21:07:43 -0000 1.545
@@ -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 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: squid3/src/url.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/url.cc,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -r1.159 -r1.160
--- squid3/src/url.cc 23 May 2007 20:59:14 -0000 1.159
+++ squid3/src/url.cc 23 May 2007 21:07:43 -0000 1.160
@@ -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 @@
"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)
{