mirror of
https://github.com/curl/curl.git
synced 2026-08-09 01:14:18 +03:00
http: handle trailer headers in all chunked responses
HTTP allows that a server sends trailing headers after all the chunks have been sent WITHOUT signalling their presence in the first response headers. The "Trailer:" header is only a SHOULD there and as we need to handle the situation even without that header I made libcurl ignore Trailer: completely. Test case 1116 was added to verify this and to make sure we handle more than one trailer header properly. Reported by: Patrick McManus Bug: http://curl.haxx.se/bug/view.cgi?id=3052450
This commit is contained in:
parent
0cbdcd07a8
commit
6b6a3bcb61
6 changed files with 150 additions and 107 deletions
14
lib/http.c
14
lib/http.c
|
|
@ -3647,20 +3647,6 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
|
|||
/* init our chunky engine */
|
||||
Curl_httpchunk_init(conn);
|
||||
}
|
||||
|
||||
else if(checkprefix("Trailer:", k->p) ||
|
||||
checkprefix("Trailers:", k->p)) {
|
||||
/*
|
||||
* This test helps Curl_httpchunk_read() to determine to look
|
||||
* for well formed trailers after the zero chunksize record. In
|
||||
* this case a CRLF is required after the zero chunksize record
|
||||
* when no trailers are sent, or after the last trailer record.
|
||||
*
|
||||
* It seems both Trailer: and Trailers: occur in the wild.
|
||||
*/
|
||||
k->trailerhdrpresent = TRUE;
|
||||
}
|
||||
|
||||
else if(checkprefix("Content-Encoding:", k->p) &&
|
||||
data->set.str[STRING_ENCODING]) {
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue