From aff70e2e9534eecb9e756d2104efa52e5d8b0462 Mon Sep 17 00:00:00 2001 From: warp kawada Date: Thu, 8 Sep 2011 15:39:39 -0700 Subject: 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. --- lib/http.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lib') 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; -- cgit v1.2.3