mirror of
https://github.com/curl/curl.git
synced 2026-08-26 04:43:35 +03:00
transfer: cleanup done+excess handling
- add `SingleRequest->download_done` as indicator that all download bytes have been received - remove `stop_reading` bool from readwrite functions - move excess body handling into client download writer Closes #12371
This commit is contained in:
parent
03cb1ff4d6
commit
5b65e7d1ae
7 changed files with 121 additions and 128 deletions
15
lib/http.c
15
lib/http.c
|
|
@ -3996,8 +3996,7 @@ CURLcode Curl_bump_headersize(struct Curl_easy *data,
|
|||
CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
const char *buf, size_t blen,
|
||||
size_t *pconsumed,
|
||||
bool *stop_reading)
|
||||
size_t *pconsumed)
|
||||
{
|
||||
CURLcode result;
|
||||
struct SingleRequest *k = &data->req;
|
||||
|
|
@ -4005,7 +4004,6 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
|||
char *end_ptr;
|
||||
|
||||
/* header line within buffer loop */
|
||||
*stop_reading = FALSE;
|
||||
*pconsumed = 0;
|
||||
do {
|
||||
size_t line_length;
|
||||
|
|
@ -4358,7 +4356,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
|||
* out and return home.
|
||||
*/
|
||||
if(data->req.no_body)
|
||||
*stop_reading = TRUE;
|
||||
k->download_done = TRUE;
|
||||
#ifndef CURL_DISABLE_RTSP
|
||||
else if((conn->handler->protocol & CURLPROTO_RTSP) &&
|
||||
(data->set.rtspreq == RTSPREQ_DESCRIBE) &&
|
||||
|
|
@ -4367,7 +4365,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
|||
absent, a length 0 must be assumed. It will prevent libcurl from
|
||||
hanging on DESCRIBE request that got refused for whatever
|
||||
reason */
|
||||
*stop_reading = TRUE;
|
||||
k->download_done = TRUE;
|
||||
#endif
|
||||
|
||||
/* If max download size is *zero* (nothing) we already have
|
||||
|
|
@ -4378,12 +4376,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
|
|||
if(0 == k->maxdownload
|
||||
&& !Curl_conn_is_http2(data, conn, FIRSTSOCKET)
|
||||
&& !Curl_conn_is_http3(data, conn, FIRSTSOCKET))
|
||||
*stop_reading = TRUE;
|
||||
|
||||
if(*stop_reading) {
|
||||
/* we make sure that this socket isn't read more now */
|
||||
k->keepon &= ~KEEP_RECV;
|
||||
}
|
||||
k->download_done = TRUE;
|
||||
|
||||
Curl_debug(data, CURLINFO_HEADER_IN,
|
||||
Curl_dyn_ptr(&data->state.headerb),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue