From 9aa8ff2895df60f2857d26fb3262c231511114a9 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 6 Nov 2018 23:48:35 +0100 Subject: 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 --- lib/urlapi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/urlapi.c') 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++; } -- cgit v1.2.3