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.
This commit is contained in:
warp kawada 2011-09-08 15:39:39 -07:00 committed by Dan Fandrich
parent 6790a543d4
commit aff70e2e95
4 changed files with 34 additions and 4 deletions

View file

@ -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;