aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2017-11-05 15:09:48 +0100
committerPatrick Monnerat <patrick@monnerat.net>2017-11-05 15:09:48 +0100
commitdbcced8e32b50c068ac297106f0502ee200a1ebd (patch)
tree0fa1ce28f33ab968792e21264e9a9318807d9f9b /lib/url.c
parent462f3cac34c09b9c28b449258e71dc37171dc604 (diff)
HTTP: support multiple Content-Encodings
This is implemented as an output streaming stack of unencoders, the last calling the client write procedure. New test 230 checks this feature. Bug: https://github.com/curl/curl/pull/2002 Reported-By: Daniel Bankhead
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/url.c b/lib/url.c
index 374ac6cfa..aeb0c9027 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1011,9 +1011,17 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
*
*/
argptr = va_arg(param, char *);
- result = setstropt(&data->set.str[STRING_ENCODING],
- (argptr && !*argptr)?
- ALL_CONTENT_ENCODINGS: argptr);
+ if(argptr && !*argptr) {
+ argptr = Curl_all_content_encodings();
+ if(!argptr)
+ result = CURLE_OUT_OF_MEMORY;
+ else {
+ result = setstropt(&data->set.str[STRING_ENCODING], argptr);
+ free(argptr);
+ }
+ }
+ else
+ result = setstropt(&data->set.str[STRING_ENCODING], argptr);
break;
case CURLOPT_TRANSFER_ENCODING: