diff options
author | Daniel Stenberg <daniel@haxx.se> | 2022-06-01 14:30:55 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-06-01 14:31:49 +0200 |
commit | 45de940cebf6ac897674018c460c1e73e7e082ad (patch) | |
tree | d269995d65e01d959dd9f2f4227eb64e17988b21 /lib/transfer.c | |
parent | bb130871c0878dbae97128655103b5944505af92 (diff) | |
download | curl-45de940cebf6ac897674018c460c1e73e7e082ad.tar.gz |
lib: make more protocol specific struct fields #ifdefed
... so that they don't take up space if the protocols are disabled in
the build.
Closes #8944
Diffstat (limited to 'lib/transfer.c')
-rw-r--r-- | lib/transfer.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index 49c9fd62b..27eec8a46 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -202,6 +202,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes, } #endif +#ifndef CURL_DISABLE_HTTP /* if we are transmitting trailing data, we don't need to write a chunk size so we skip this */ if(data->req.upload_chunky && @@ -211,7 +212,6 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes, data->req.upload_fromhere += (8 + 2); /* 32bit hex + CRLF */ } -#ifndef CURL_DISABLE_HTTP if(data->state.trailers_state == TRAILERS_SENDING) { /* if we're here then that means that we already sent the last empty chunk but we didn't send a final CR LF, so we sent 0 CR LF. We then start @@ -267,6 +267,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes, return CURLE_READ_ERROR; } +#ifndef CURL_DISABLE_HTTP if(!data->req.forbidchunk && data->req.upload_chunky) { /* if chunked Transfer-Encoding * build chunk: @@ -317,15 +318,12 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes, /* always append ASCII CRLF to the data unless we have a valid trailer callback */ -#ifndef CURL_DISABLE_HTTP if((nread-hexlen) == 0 && data->set.trailer_callback != NULL && data->state.trailers_state == TRAILERS_NONE) { data->state.trailers_state = TRAILERS_INITIALIZED; } - else -#endif - { + else { memcpy(data->req.upload_fromhere + nread, endofline_network, strlen(endofline_network)); @@ -333,7 +331,6 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes, } } -#ifndef CURL_DISABLE_HTTP if(data->state.trailers_state == TRAILERS_SENDING && !trailers_left(data)) { Curl_dyn_free(&data->state.trailers_buf); @@ -345,7 +342,6 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes, infof(data, "Signaling end of chunked upload after trailers."); } else -#endif if((nread - hexlen) == 0 && data->state.trailers_state != TRAILERS_INITIALIZED) { /* mark this as done once this chunk is transferred */ @@ -357,6 +353,7 @@ CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes, if(added_crlf) nread += strlen(endofline_network); /* for the added end of line */ } +#endif *nreadp = nread; @@ -1153,10 +1150,12 @@ CURLcode Curl_readwrite(struct connectdata *conn, else fd_write = CURL_SOCKET_BAD; +#if defined(USE_HTTP2) || defined(USE_HTTP3) if(data->state.drain) { select_res |= CURL_CSELECT_IN; DEBUGF(infof(data, "Curl_readwrite: forcibly told to drain data")); } +#endif if(!select_res) /* Call for select()/poll() only, if read/write/error status is not known. */ @@ -1402,7 +1401,6 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) if(result) return result; - data->state.wildcardmatch = data->set.wildcard_enabled; data->state.followlocation = 0; /* reset the location-follow counter */ data->state.this_is_a_follow = FALSE; /* reset this */ data->state.errorbuf = FALSE; /* no error has occurred */ @@ -1457,6 +1455,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) data->state.authproxy.picked &= data->state.authproxy.want; #ifndef CURL_DISABLE_FTP + data->state.wildcardmatch = data->set.wildcard_enabled; if(data->state.wildcardmatch) { struct WildcardData *wc = &data->wildcard; if(wc->state < CURLWC_INIT) { @@ -1821,10 +1820,12 @@ CURLcode Curl_retry_request(struct Curl_easy *data, char **url) return CURLE_OK; if((data->req.bytecount + data->req.headerbytecount == 0) && - conn->bits.reuse && - (!data->set.opt_no_body - || (conn->handler->protocol & PROTO_FAMILY_HTTP)) && - (data->set.rtspreq != RTSPREQ_RECEIVE)) + conn->bits.reuse && + (!data->set.opt_no_body || (conn->handler->protocol & PROTO_FAMILY_HTTP)) +#ifndef CURL_DISABLE_RTSP + && (data->set.rtspreq != RTSPREQ_RECEIVE) +#endif + ) /* We got no data, we attempted to re-use a connection. For HTTP this can be a retry so we try again regardless if we expected a body. For other protocols we only try again only if we expected a body. |