aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorwarp kawada <warp.kawada@gmail.com>2011-09-08 15:39:39 -0700
committerDan Fandrich <dan@coneharvesters.com>2011-09-13 16:17:21 -0700
commitaff70e2e9534eecb9e756d2104efa52e5d8b0462 (patch)
tree86069726bec4662e6788a5e76814eacf6c0a55f1 /lib
parent6790a543d4b692e0f62971804606fdcbcf84a292 (diff)
Curl_add_custom_headers: support headers with no data
A custom HTTP header ending in a semicolon instead of a colon will be treated as a header to be added without any data portion.
Diffstat (limited to 'lib')
-rw-r--r--lib/http.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/http.c b/lib/http.c
index b67329649..993900617 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1559,6 +1559,31 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
}
}
}
+ else {
+ ptr = strchr(headers->data, ';');
+ if(ptr) {
+
+ ptr++; /* pass the semicolon */
+ while(*ptr && ISSPACE(*ptr))
+ ptr++;
+
+ if(*ptr) {
+ /* this may be used for something else in the future */
+ }
+ else {
+ if(*(--ptr) == ';') {
+ CURLcode result;
+
+ /* send no-value custom header if terminated by semicolon */
+ *ptr = ':';
+ result = Curl_add_bufferf(req_buffer, "%s\r\n",
+ headers->data);
+ if(result)
+ return result;
+ }
+ }
+ }
+ }
headers = headers->next;
}
return CURLE_OK;