mirror of
https://github.com/curl/curl.git
synced 2026-07-28 04:53:08 +03:00
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:
parent
6790a543d4
commit
aff70e2e95
4 changed files with 34 additions and 4 deletions
25
lib/http.c
25
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue