diff options
author | Daniel Stenberg <daniel@haxx.se> | 2018-11-06 23:48:35 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-11-07 08:28:48 +0100 |
commit | 9aa8ff2895df60f2857d26fb3262c231511114a9 (patch) | |
tree | bf137a111630902178f6bf116538f98ee2778582 /lib/urlapi.c | |
parent | 9df8dc101ba03807a3257ba0922fe4dd03c81ed3 (diff) | |
download | curl-9aa8ff2895df60f2857d26fb3262c231511114a9.tar.gz |
urlapi: only skip encoding the first '=' with APPENDQUERY set
APPENDQUERY + URLENCODE would skip all equals signs but now it only skip
encoding the first to better allow "name=content" for any content.
Reported-by: Alexey Melnichuk
Fixes #3231
Closes #3231
Diffstat (limited to 'lib/urlapi.c')
-rw-r--r-- | lib/urlapi.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/urlapi.c b/lib/urlapi.c index e877dc726..2830dc163 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -1103,6 +1103,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what, bool plusencode = FALSE; bool urlskipslash = FALSE; bool appendquery = FALSE; + bool equalsencode = FALSE; if(!u) return CURLUE_BAD_HANDLE; @@ -1183,6 +1184,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what, case CURLUPART_QUERY: plusencode = urlencode; appendquery = (flags & CURLU_APPENDQUERY)?1:0; + equalsencode = appendquery; storep = &u->query; break; case CURLUPART_FRAGMENT: @@ -1276,8 +1278,11 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what, for(i = part, o = enc; *i; i++) { if(Curl_isunreserved(*i) || ((*i == '/') && urlskipslash) || - ((*i == '=') && appendquery) || + ((*i == '=') && equalsencode) || ((*i == '+') && plusencode)) { + if((*i == '=') && equalsencode) + /* only skip the first equals sign */ + equalsencode = FALSE; *o = *i; o++; } |