lib: further send/upload handling polish

- Move all the "upload_done" handling to request.c

  - add possibility to abort sending of a request
  - add `Curl_req_done_sending()` for checks
  - transfer.c: readwrite_upload() now clean

- removing data->state.ulbuf and data->req.upload_fromhere

  - as well as data->req.upload_present
  - set data->req.upload_done on having read all from
    the client and completely flushed the send buffer

- tftp, remove setting of data->req.upload_fromhere

  - serves no purpose as `upload_present` is not set
    and the data itself is directly `sendto()` anyway

- smtp, make upload EOB conversion a client reader
- xfer_ulbuf addition

  - add xfer_ulbuf for borrowing, similar to xfer_buf
  - use in file upload
  - use in c-hyper body sending

- h1-proxy, remove init of data->state.uilbuf that is never used
- smb, add own send_buf instead of using data->state.ulbuf

Closes #13010
This commit is contained in:
Stefan Eissing 2024-02-28 14:51:53 +01:00 committed by Daniel Stenberg
parent 46aea3d990
commit e3905de819
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
22 changed files with 485 additions and 535 deletions

View file

@ -118,4 +118,29 @@ CURLcode Curl_multi_xfer_buf_borrow(struct Curl_easy *data,
*/
void Curl_multi_xfer_buf_release(struct Curl_easy *data, char *buf);
/**
* Borrow the upload buffer from the multi, suitable
* for the given transfer `data`. The buffer may only be used in one
* multi processing of the easy handle. It MUST be returned to the
* multi before it can be borrowed again.
* Pointers into the buffer remain only valid as long as it is borrowed.
*
* @param data the easy handle
* @param pbuf on return, the buffer to use or NULL on error
* @param pbuflen on return, the size of *pbuf or 0 on error
* @return CURLE_OK when buffer is available and is returned.
* CURLE_OUT_OF_MEMORy on failure to allocate the buffer,
* CURLE_FAILED_INIT if the easy handle is without multi.
* CURLE_AGAIN if the buffer is borrowed already.
*/
CURLcode Curl_multi_xfer_ulbuf_borrow(struct Curl_easy *data,
char **pbuf, size_t *pbuflen);
/**
* Release the borrowed upload buffer. All references into the buffer become
* invalid after this.
* @param buf the upload buffer pointer borrowed for coding error checks.
*/
void Curl_multi_xfer_ulbuf_release(struct Curl_easy *data, char *buf);
#endif /* HEADER_CURL_MULTIIF_H */