mirror of
https://github.com/curl/curl.git
synced 2026-08-24 22:43:38 +03:00
lib: Curl_read/Curl_write clarifications
- 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)
Added as documented [in
CLIENT-READER.md](5b1f31dfba/docs/CLIENT-READERS.md).
- old `Curl_buffer_send()` completely replaced by new `Curl_req_send()`
- old `Curl_fillreadbuffer()` replaced with `Curl_client_read()`
- HTTP chunked uploads are now formatted in a client reader added when
needed.
- FTP line-end conversions are done in a client reader added when
needed.
- when sending requests headers, remaining buffer space is filled with
body data for sending in "one go". This is independent of the request
body size. Resolves #12938 as now small and large requests have the
same code path.
Changes done to test cases:
- test513: now fails before sending request headers as this initial
"client read" triggers the setup fault. Behaves now the same as in
hyper build
- test547, test555, test1620: fix the length check in the lib code to
only fail for reads *smaller* than expected. This was a bug in the
test code that never triggered in the old implementation.
Closes #12969
This commit is contained in:
parent
8d67c61c47
commit
9369c30cd8
26 changed files with 1191 additions and 1021 deletions
|
|
@ -34,14 +34,6 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
|||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
%if !hyper
|
||||
POST /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
Content-Length: 1
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
|
||||
%endif
|
||||
</protocol>
|
||||
# 42 - aborted by callback
|
||||
<errorcode>
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER %LOGDIR/ip%TESTNUMBER
|
|||
<verify>
|
||||
<file name="%LOGDIR/ip%TESTNUMBER">
|
||||
Progress callback called with UL 0 out of 0
|
||||
Progress callback called with UL 5 out of 0
|
||||
Progress callback called with UL 0 out of 0
|
||||
Progress callback called with UL 8 out of 0
|
||||
Progress callback called with UL 16 out of 0
|
||||
Progress callback called with UL 26 out of 0
|
||||
|
|
|
|||
|
|
@ -103,9 +103,9 @@ class TestAuth:
|
|||
def test_14_05_basic_large_pw(self, env: Env, httpd, nghttpx, repeat, proto):
|
||||
if proto == 'h3' and not env.have_h3():
|
||||
pytest.skip("h3 not supported")
|
||||
if proto == 'h3' and env.curl_uses_lib('quiche'):
|
||||
if proto == 'h3' and not env.curl_uses_lib('ngtcp2'):
|
||||
# See <https://github.com/cloudflare/quiche/issues/1573>
|
||||
pytest.skip("quiche has problems with large requests")
|
||||
pytest.skip("quiche/openssl-quic have problems with large requests")
|
||||
# just large enough that nghttp2 will submit
|
||||
password = 'x' * (47 * 1024)
|
||||
fdata = os.path.join(env.gen_dir, 'data-10m')
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ static size_t readcallback(char *ptr,
|
|||
}
|
||||
(*counter)++; /* bump */
|
||||
|
||||
if(size * nmemb > strlen(UPLOADTHIS)) {
|
||||
if(size * nmemb >= strlen(UPLOADTHIS)) {
|
||||
fprintf(stderr, "READ!\n");
|
||||
strcpy(ptr, UPLOADTHIS);
|
||||
return strlen(UPLOADTHIS);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ static size_t readcallback(char *ptr,
|
|||
}
|
||||
(*counter)++; /* bump */
|
||||
|
||||
if(size * nmemb > strlen(uploadthis)) {
|
||||
if(size * nmemb >= strlen(uploadthis)) {
|
||||
fprintf(stderr, "READ!\n");
|
||||
strcpy(ptr, uploadthis);
|
||||
return strlen(uploadthis);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue