-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send Rework, Part 1 #12964
Closed
Closed
Send Rework, Part 1 #12964
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6ec9460
to
62d7054
Compare
Closed
02fd6f5
to
280a49a
Compare
- replace `Curl_read()`, `Curl_write()` and `Curl_nwrite()` to clarify when and at what level they operate - send/recv of transfer related data is now done via `Curl_xfer_send()/Curl_xfer_recv()` which no longer has socket/socketindex as parameter. It decides on the transfer setup of `conn->sockfd` and `conn->writesockfd` on which connection filter chain to operate. - send/recv on a specific connection filter chain is done via `Curl_conn_send()/Curl_conn_recv()` which get the socket index as parameter. - rename `Curl_setup_transfer()` to `Curl_xfer_setup()` for naming consistency - clarify that the special CURLE_AGAIN hangling to return `CURLE_OK` with length 0 only applies to `Curl_xfer_send()` and CURLE_AGAIN is returned by all other send() variants. - fix a bug in websocket `curl_ws_recv()` that mixed up data when it arrived in more than a single chunk (to be made into a sperate PR, also)
- hyper's send/receive callbacks operate on the connection (thus needing a socket index) and not on the transport layer - this fixes the bug that a FTP data connection over http proxy was sending on socket TWO, but receiving on socket ONE (as the transfer does).
- replace `Curl_read()`, `Curl_write()` and `Curl_nwrite()` to clarify when and at what level they operate - send/recv of transfer related data is now done via `Curl_xfer_send()/Curl_xfer_recv()` which no longer has socket/socketindex as parameter. It decides on the transfer setup of `conn->sockfd` and `conn->writesockfd` on which connection filter chain to operate. - send/recv on a specific connection filter chain is done via `Curl_conn_send()/Curl_conn_recv()` which get the socket index as parameter. - rename `Curl_setup_transfer()` to `Curl_xfer_setup()` for naming consistency - clarify that the special CURLE_AGAIN hangling to return `CURLE_OK` with length 0 only applies to `Curl_xfer_send()` and CURLE_AGAIN is returned by all other send() variants. - fix a bug in websocket `curl_ws_recv()` that mixed up data when it arrived in more than a single chunk (to be made into a sperate PR, also)
- future replacemnt for Curl_buffer_send() - enabled for GETs - changed ssize_t to size_t in several functions reading data with a CURLcode result. Saves many type conversions when checking the lengths
- Curl_buffer_send to static buffer_send - Curl_req_send_hds as macro using Curl_req_send()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the second part of reworking curl's "send" or "upload" handling. The changes will arrive in a series of PRs, based on top of each other, similar to the client writer ones. For Part 0 see #12963.
Curl_req_send()
The method for sending not just raw bytes, but bytes that are either "headers" or "body". The send abstraction stack, to to bottom, now is:
Curl_req_send()
: has parameter to indicate amount of header bytes, buffers all data.Curl_xfer_send()
: knows on which socket index to send, returns amount of bytes sent.Curl_conn_send()
: called with socket index, returns amount of bytes sent.In addition there is
Curl_req_flush()
for writing out all buffered bytes.Curl_req_send()
is active for requests without body,Curl_buffer_send()
still being used for others. This is because the special quirks need to be addressed in future parts:expect-100
handlingCurl_fillreadbuffer()
needs to add directly to the newdata->req.sendbuf
chunked
encodings and line end conversions will be moved into something like a Client Reader.ssize_t
args tosize_t
In functions of the pattern
CURLcode xxx_send(..., ssize_t *written)
, replace thessize_t
with asize_t
. It makes no sense to allow for negative values as the returnedCURLcode
already specifies error conditions. This allows easier handling of lengths without casting.