header api: add curl_easy_header and curl_easy_nextheader

Add test 1940 to 1946 to verify.

Closes #8593
This commit is contained in:
Daniel Stenberg 2022-03-17 10:20:19 +01:00
parent bdc664a640
commit d1e4a67734
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
38 changed files with 1798 additions and 306 deletions

View file

@ -345,6 +345,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
/* Send the connect request to the proxy */
result = Curl_buffer_send(req, data, &data->info.request_size, 0,
sockindex);
s->headerlines = 0;
}
if(result)
failf(data, "Failed sending CONNECT to proxy");
@ -480,6 +481,7 @@ static CURLcode CONNECT(struct Curl_easy *data,
if(byte != 0x0a)
continue;
s->headerlines++;
linep = Curl_dyn_ptr(&s->rcvbuf);
perline = Curl_dyn_len(&s->rcvbuf); /* amount of bytes in this line */
@ -488,9 +490,9 @@ static CURLcode CONNECT(struct Curl_easy *data,
if(!data->set.suppress_connect_headers) {
/* send the header to the callback */
int writetype = CLIENTWRITE_HEADER;
if(data->set.include_header)
writetype |= CLIENTWRITE_BODY;
int writetype = CLIENTWRITE_HEADER | CLIENTWRITE_CONNECT |
(data->set.include_header ? CLIENTWRITE_BODY : 0) |
(s->headerlines == 1 ? CLIENTWRITE_STATUS : 0);
result = Curl_client_write(data, writetype, linep, perline);
if(result)