aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-08-05 12:34:07 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-08-05 12:34:07 +0000
commit2827f5327aad6a0341b4ed3231e414ff9a980101 (patch)
treeb3ba9bb11066ea05cb74436ebb8565edcb151b57
parent47bb09e9089e375bfded0c4a417271a6441eccdd (diff)
curl_escape() no longer attempts to detect already encoded stuff (in order
not to re-encode it).
-rw-r--r--lib/escape.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/lib/escape.c b/lib/escape.c
index 140bd655e..b5d35255d 100644
--- a/lib/escape.c
+++ b/lib/escape.c
@@ -54,28 +54,15 @@ char *curl_escape(char *string, int length)
!(in >= 'A' && in <= 'Z') &&
!(in >= '0' && in <= '9')) {
/* encode it */
- if(('%' == in) &&
- (length>=2) &&
- isxdigit((int)string[1]) &&
- isxdigit((int)string[2]) ) {
- /*
- * This is an already encoded letter, leave it!
- */
- memcpy(&ns[index], string, 3);
- string+=2;
+ newlen += 2; /* the size grows with two, since this'll become a %XX */
+ if(newlen > alloc) {
+ alloc *= 2;
+ ns = realloc(ns, alloc);
+ if(!ns)
+ return NULL;
}
- else {
- /* encode this now */
+ sprintf(&ns[index], "%%%02X", in);
- newlen += 2; /* the size grows with two, since this'll become a %XX */
- if(newlen > alloc) {
- alloc *= 2;
- ns = realloc(ns, alloc);
- if(!ns)
- return NULL;
- }
- sprintf(&ns[index], "%%%02X", in);
- }
index+=3;
}
else {