add RAW macro for rustls and use it

comparing to raw EWOULDBLOCK may not be working as expected on Windows.

Based on this:
https://doc.rust-lang.org/std/io/struct.Error.html#method.last_os_error
Rust doesn't seem to be returning the socket error on Windows, but
a GetLastError() which does not return EWOULDBLOCK or SOCKEWOULDBLOCK.
This commit is contained in:
Viktor Szakats 2026-06-08 02:13:20 +02:00
parent 14cd3ff22b
commit 6e4aa6600a
No known key found for this signature in database
2 changed files with 4 additions and 10 deletions

View file

@ -1139,8 +1139,10 @@ typedef unsigned int curl_bit;
#if EAGAIN != SOCKEWOULDBLOCK
#define SOCK_EAGAIN_EWOULDBLOCK(e) ((e) == EAGAIN || (e) == SOCKEWOULDBLOCK)
#define RAW_EAGAIN_EWOULDBLOCK(e) ((e) == EAGAIN || (e) == EWOULDBLOCK)
#else
#define SOCK_EAGAIN_EWOULDBLOCK(e) ((e) == EAGAIN)
#define RAW_EAGAIN_EWOULDBLOCK(e) ((e) == EAGAIN)
#endif
/*

View file

@ -160,11 +160,7 @@ static ssize_t tls_recv_more(struct Curl_cfilter *cf,
io_ctx.data = data;
io_error = rustls_connection_read_tls(backend->conn, read_cb, &io_ctx,
&tls_bytes_read);
if(io_error == EWOULDBLOCK
#if EAGAIN != EWOULDBLOCK
|| io_error == EAGAIN
#endif
) {
if(RAW_EAGAIN_EWOULDBLOCK(io_error)) {
*err = CURLE_AGAIN;
return -1;
}
@ -274,11 +270,7 @@ static CURLcode cr_flush_out(struct Curl_cfilter *cf, struct Curl_easy *data,
while(rustls_connection_wants_write(rconn)) {
io_error = rustls_connection_write_tls(rconn, write_cb, &io_ctx,
&tlswritten);
if(io_error == EWOULDBLOCK
#if EAGAIN != EWOULDBLOCK
|| io_error == EAGAIN
#endif
) {
if(RAW_EAGAIN_EWOULDBLOCK(io_error)) {
CURL_TRC_CF(data, cf, "cf_send: EAGAIN after %zu bytes",
tlswritten_total);
return CURLE_AGAIN;