#
476adfea |
| 26-Jan-2024 |
Stefan Eissing |
multi: add xfer_buf to multi handle - can be borrowed by transfer during recv-write operation - needs to be released before borrowing again - adjustis size to `data->set.buffer_size`
multi: add xfer_buf to multi handle - can be borrowed by transfer during recv-write operation - needs to be released before borrowing again - adjustis size to `data->set.buffer_size` - used in transfer.c readwrite_data() Closes #12805
show more ...
|
#
cdd905a9 |
| 22-Jan-2024 |
Daniel Stenberg |
transfer: make the select_bits_paused condition check both directions If there is activity in a direction that is not paused, return false. Reported-by: Sergey Bronnikov Bug: ht
transfer: make the select_bits_paused condition check both directions If there is activity in a direction that is not paused, return false. Reported-by: Sergey Bronnikov Bug: https://curl.se/mail/lib-2024-01/0049.html Closes #12740
show more ...
|
#
adfffc39 |
| 13-Jan-2024 |
Daniel Stenberg |
transfer: remove warning: Value stored to 'blen' is never read Detected by scan-build Follow-up from 1cd2f0072f Closes #12693
|
#
d7b6ce64 |
| 01-Dec-2023 |
Stefan Eissing |
lib: replace readwrite with write_resp This clarifies the handling of server responses by folding the code for the complicated protocols into their protocol handlers. This concerns m
lib: replace readwrite with write_resp This clarifies the handling of server responses by folding the code for the complicated protocols into their protocol handlers. This concerns mainly HTTP and its bastard sibling RTSP. The terms "read" and "write" are often used without clear context if they refer to the connect or the client/application side of a transfer. This PR uses "read/write" for operations on the client side and "send/receive" for the connection, e.g. server side. If this is considered useful, we can revisit renaming of further methods in another PR. Curl's protocol handler `readwrite()` method been changed: ```diff - CURLcode (*readwrite)(struct Curl_easy *data, struct connectdata *conn, - const char *buf, size_t blen, - size_t *pconsumed, bool *readmore); + CURLcode (*write_resp)(struct Curl_easy *data, const char *buf, size_t blen, + bool is_eos, bool *done); ``` The name was changed to clarify that this writes reponse data to the client side. The parameter changes are: * `conn` removed as it always operates on `data->conn` * `pconsumed` removed as the method needs to handle all data on success * `readmore` removed as no longer necessary * `is_eos` as indicator that this is the last call for the transfer response (end-of-stream). * `done` TRUE on return iff the transfer response is to be treated as finished This change affects many files only because of updated comments in handlers that provide no implementation. The real change is that the HTTP protocol handlers now provide an implementation. The HTTP protocol handlers `write_resp()` implementation will get passed **all** raw data of a server response for the transfer. The HTTP/1.x formatted status and headers, as well as the undecoded response body. `Curl_http_write_resp_hds()` is used internally to parse the response headers and pass them on. This method is public as the RTSP protocol handler also uses it. HTTP/1.1 "chunked" transport encoding is now part of the general *content encoding* writer stack, just like other encodings. A new flag `CLIENTWRITE_EOS` was added for the last client write. This allows writers to verify that they are in a valid end state. The chunked decoder will check if it indeed has seen the last chunk. The general response handling in `transfer.c:466` happens in function `readwrite_data()`. This mainly operates now like: ``` static CURLcode readwrite_data(data, ...) { do { Curl_xfer_recv_resp(data, buf) ... Curl_xfer_write_resp(data, buf) ... } while(interested); ... } ``` All the response data handling is implemented in `Curl_xfer_write_resp()`. It calls the protocol handler's `write_resp()` implementation if available, or does the default behaviour. All raw response data needs to pass through this function. Which also means that anyone in possession of such data may call `Curl_xfer_write_resp()`. Closes #12480
show more ...
|
#
a0f94800 |
| 05-Jan-2024 |
Stefan Eissing |
transfer: adjust_pollset improvements - let `multi_getsock()` initialize the pollset in what the transfer state requires in regards to SEND/RECV - change connection filters `adjust
transfer: adjust_pollset improvements - let `multi_getsock()` initialize the pollset in what the transfer state requires in regards to SEND/RECV - change connection filters `adjust_pollset()` implementation to react on the presence of POLLIN/-OUT in the pollset and no longer check CURL_WANT_SEND/CURL_WANT_RECV - cf-socket will no longer add POLLIN on its own - http2 and http/3 filters will only do adjustments if the passed pollset wants to POLLIN/OUT for the transfer on the socket. This is similar to the HTTP/2 proxy filter and works in stacked filters. Closes #12640
show more ...
|
#
e492c7c5 |
| 22-Dec-2023 |
Stefan Eissing |
transfer: fix upload rate limiting, add test cases - add test cases for rate limiting uploads for all http versions - fix transfer loop handling of limits. Signal a re-receive
transfer: fix upload rate limiting, add test cases - add test cases for rate limiting uploads for all http versions - fix transfer loop handling of limits. Signal a re-receive attempt only on exhausting maxloops without an EAGAIN - fix `data->state.selectbits` forcing re-receive to also set re-sending when transfer is doing this. Reported-by: Karthikdasari0423 on github Fixes #12559 Closes #12586
show more ...
|
#
1da640ab |
| 11-Dec-2023 |
Daniel Stenberg |
readwrite_data: loop less This function is made to loop in order to drain incoming data faster. Completely removing the loop has a measerably negative impact on transfer speeds.
readwrite_data: loop less This function is made to loop in order to drain incoming data faster. Completely removing the loop has a measerably negative impact on transfer speeds. Downsides with the looping include - it might call the progress callback much more seldom. Especially if the write callback is slow. - rate limiting becomes less exact - a single transfer might "starve out" other parallel transfers - QUIC timers for other connections can't be maintained correctly The long term fix should be to remove the loop and optimize coming back to avoid the transfer speed penalty. This fix lower the max loop count to reduce the starvation problem, and avoids the loop completely for when rate-limiting is in progress. Ref: #12488 Ref: https://curl.se/mail/lib-2023-12/0012.html Closes #12504
show more ...
|
#
8706b680 |
| 13-Dec-2023 |
Stefan Eissing |
lib: eliminate `conn->cselect_bits` - use `data->state.dselect_bits` everywhere instead - remove `bool *comeback` parameter as non-zero `data->state.dselect_bits` will indicate tha
lib: eliminate `conn->cselect_bits` - use `data->state.dselect_bits` everywhere instead - remove `bool *comeback` parameter as non-zero `data->state.dselect_bits` will indicate that IO is incomplete. Closes #12512
show more ...
|
#
6a0dc7cf |
| 29-Nov-2023 |
Dmitry Karpov |
transfer: abort pause send when connection is marked for closing This handles cases of some bi-directional "upgrade" scenarios (i.e. WebSockets) where sending is paused until some "upgra
transfer: abort pause send when connection is marked for closing This handles cases of some bi-directional "upgrade" scenarios (i.e. WebSockets) where sending is paused until some "upgrade" handshake is completed, but server rejects the handshake and closes the connection. Closes #12428
show more ...
|
#
5b65e7d1 |
| 21-Nov-2023 |
Stefan Eissing |
transfer: cleanup done+excess handling - add `SingleRequest->download_done` as indicator that all download bytes have been received - remove `stop_reading` bool from readwrite func
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
show more ...
|
#
e9a7d4a1 |
| 21-Nov-2023 |
Viktor Szakats |
windows: use built-in `_WIN32` macro to detect Windows Windows compilers define `_WIN32` automatically. Windows SDK headers or build env defines `WIN32`, or we have to take care of it. T
windows: use built-in `_WIN32` macro to detect Windows Windows compilers define `_WIN32` automatically. Windows SDK headers or build env defines `WIN32`, or we have to take care of it. The agreement seems to be that `_WIN32` is the preferred practice here. Make the source code rely on that to detect we're building for Windows. Public `curl.h` was using `WIN32`, `__WIN32__` and `CURL_WIN32` for Windows detection, next to the official `_WIN32`. After this patch it only uses `_WIN32` for this. Also, make it stop defining `CURL_WIN32`. There is a slight chance these break compatibility with Windows compilers that fail to define `_WIN32`. I'm not aware of any obsolete or modern compiler affected, but in case there is one, one possible solution is to define this macro manually. grepping for `WIN32` remains useful to discover Windows-specific code. Also: - extend `checksrc` to ensure we're not using `WIN32` anymore. - apply minor formatting here and there. - delete unnecessary checks for `!MSDOS` when `_WIN32` is present. Co-authored-by: Jay Satiro Reviewed-by: Daniel Stenberg Closes #12376
show more ...
|
#
891f1041 |
| 21-Nov-2023 |
Daniel Stenberg |
transfer: avoid unreachable expression If curl_off_t and size_t have the same size (which is common on modern 64 bit systems), a condition cannot occur which Coverity pointed out. Av
transfer: avoid unreachable expression If curl_off_t and size_t have the same size (which is common on modern 64 bit systems), a condition cannot occur which Coverity pointed out. Avoid the warning by having the code conditionally only used if curl_off_t actually is larger. Follow-up to 1cd2f0072fa482e25baa2 Closes #12370
show more ...
|
#
1cd2f007 |
| 06-Nov-2023 |
Stefan Eissing |
transfer: readwrite improvements - changed header/chunk/handler->readwrite prototypes to accept `buf`, `blen` and a `pconsumed` pointer. They now get the buffer to work on and re
transfer: readwrite improvements - changed header/chunk/handler->readwrite prototypes to accept `buf`, `blen` and a `pconsumed` pointer. They now get the buffer to work on and report back how many bytes they consumed - eliminated `k->str` in SingleRequest - improved excess data handling to properly calculate with any body data left in the headerb buffer - eliminated `k->badheader` enum to only be a bool Closes #12283
show more ...
|
#
6a095da1 |
| 20-Nov-2023 |
Jiří Hruška |
transfer: avoid calling the read callback again after EOF Regression since 7f43f3dc5994d01b12 (7.84.0) Bug: https://curl.se/mail/lib-2023-11/0017.html Closes #12363
|
#
ad051e1c |
| 23-Oct-2023 |
Stefan Eissing |
lib: client writer, part 2, accounting + logging This PR has these changes: Renaming of unencode_* to cwriter, e.g. client writers - documentation of sendf.h functions - mov
lib: client writer, part 2, accounting + logging This PR has these changes: Renaming of unencode_* to cwriter, e.g. client writers - documentation of sendf.h functions - move max decode stack checks back to content_encoding.c - define writer phase which was used as order before - introduce phases for monitoring inbetween decode phases - offering default implementations for init/write/close Add type paramter to client writer's do_write() - always pass all writes through the writer stack - writers who only care about BODY data will pass other writes unchanged add RAW and PROTOCOL client writers - RAW used for Curl_debug() logging of CURLINFO_DATA_IN - PROTOCOL used for updates to data->req.bytecount, max_filesize checks and Curl_pgrsSetDownloadCounter() - remove all updates of data->req.bytecount and calls to Curl_pgrsSetDownloadCounter() and Curl_debug() from other code - adjust test457 expected output to no longer see the excess write Closes #12184
show more ...
|
#
39547ae6 |
| 27-Oct-2023 |
Stefan Eissing |
url: protocol handler lookup tidy-up - rename lookup to what it does - use ARRAYSIZE instead of NULL check for end - offer alternate lookup for 0-terminated strings Closes #
url: protocol handler lookup tidy-up - rename lookup to what it does - use ARRAYSIZE instead of NULL check for end - offer alternate lookup for 0-terminated strings Closes #12216
show more ...
|
#
7eb31c85 |
| 07-Oct-2023 |
Stefan Eissing |
RTSP: improved RTP parser - fix HTTP header parsing to report incomplete lines it buffers as consumed! - re-implement the RTP parser for interleave RTP messages for robustnes
RTSP: improved RTP parser - fix HTTP header parsing to report incomplete lines it buffers as consumed! - re-implement the RTP parser for interleave RTP messages for robustness. It is now keeping its state at the connection - RTSP protocol handler "readwrite" implementation now tracks if the response is before/in/after header parsing or "in" a bod by calling "Curl_http_readwrite_headers()" itself. This allows it to know when non-RTP bytes are "junk" or HEADER or BODY. - tested with #12035 and various small receive sizes where current master fails Closes #12052
show more ...
|
#
df9aea22 |
| 19-Oct-2023 |
Daniel Stenberg |
transfer: only reset the FTP wildcard engine in CLEAR state To avoid the state machine to start over and redownload all the files *again*. Reported-by: lkordos on github Reg
transfer: only reset the FTP wildcard engine in CLEAR state To avoid the state machine to start over and redownload all the files *again*. Reported-by: lkordos on github Regression from 843b3baa3e3cb228 (shipped in 8.1.0) Bisect-by: Dan Fandrich Fixes #11775 Closes #12156
show more ...
|
#
6b9a591b |
| 29-Sep-2023 |
Stefan Eissing |
h2: testcase and fix for pausing h2 streams - refs #11982 where it was noted that paused transfers may close successfully without delivering the complete data - made sample poc int
h2: testcase and fix for pausing h2 streams - refs #11982 where it was noted that paused transfers may close successfully without delivering the complete data - made sample poc into tests/http/client/h2-pausing.c and added test_02_27 to reproduce Closes #11989 Fixes #11982 Reported-by: Harry Sintonen
show more ...
|
#
0bd9e137 |
| 20-Sep-2023 |
Stefan Eissing |
lib: move handling of `data->req.writer_stack` into Curl_client_write() - move definitions from content_encoding.h to sendf.h - move create/cleanup/add code into sendf.c - installed
lib: move handling of `data->req.writer_stack` into Curl_client_write() - move definitions from content_encoding.h to sendf.h - move create/cleanup/add code into sendf.c - installed content_encoding writers will always be called on Curl_client_write(CLIENTWRITE_BODY) - Curl_client_cleanup() frees writers and tempbuffers from paused transfers, irregardless of protocol Closes #11908
show more ...
|
#
96c29900 |
| 25-Sep-2023 |
Viktor Szakats |
build: delete checks for C89 standard headers Delete checks and guards for standard C89 headers and assume these are available: `stdio.h`, `string.h`, `time.h`, `setjmp.h`, `stdlib.h`,
build: delete checks for C89 standard headers Delete checks and guards for standard C89 headers and assume these are available: `stdio.h`, `string.h`, `time.h`, `setjmp.h`, `stdlib.h`, `stddef.h`, `signal.h`. Some of these we already used unconditionally, some others we only used for feature checks. Follow-up to 9c7165e96a3a9a2d0b7059c87c699b5ca8cdae93 #11918 (for `stdio.h` in CMake) Closes #11940
show more ...
|
#
914e49b9 |
| 23-Sep-2023 |
Daniel Stenberg |
lib: let the max filesize option stop too big transfers too Previously it would only stop them from getting started if the size is known to be too big then. Update the libcurl a
lib: let the max filesize option stop too big transfers too Previously it would only stop them from getting started if the size is known to be too big then. Update the libcurl and curl docs accordingly. Fixes #11810 Reported-by: Elliot Killick Assisted-by: Jay Satiro Closes #11820
show more ...
|
#
95a865b4 |
| 04-Sep-2023 |
Daniel Stenberg |
transfer: also stop the sending on closed connection Previously this cleared the receiving bit only but in some cases it is also still sending (like a request-body) when disconnected and
transfer: also stop the sending on closed connection Previously this cleared the receiving bit only but in some cases it is also still sending (like a request-body) when disconnected and neither direction can continue then. Fixes #11769 Reported-by: Oleg Jukovec Closes #11795
show more ...
|
#
331b89a3 |
| 29-Aug-2023 |
Stefan Eissing |
http2: polish things around POST - added test cases for various code paths - fixed handling of blocked write when stream had been closed inbetween attempts - re-enabled DEBUGAS
http2: polish things around POST - added test cases for various code paths - fixed handling of blocked write when stream had been closed inbetween attempts - re-enabled DEBUGASSERT on send with smaller data size - in debug builds, environment variables can be set to simulate a slow network when sending data. cf-socket.c and vquic.c support * CURL_DBG_SOCK_WBLOCK: percentage of send() calls that should be answered with a EAGAIN. TCP/UNIX sockets. This is chosen randomly. * CURL_DBG_SOCK_WPARTIAL: percentage of data that shall be written to the network. TCP/UNIX sockets. Example: 80 means a send with 1000 bytes would only send 800 This is applied to every send. * CURL_DBG_QUIC_WBLOCK: percentage of send() calls that should be answered with EAGAIN. QUIC only. This is chosen randomly. Closes #11756
show more ...
|
#
5e2beb33 |
| 23-Aug-2023 |
Daniel Stenberg |
spelling: use 'reuse' not 're-use' in code and elsewhere Unify the spelling as both versions were previously used intermittently Closes #11717
|