-
-
Notifications
You must be signed in to change notification settings - Fork 7k
sws: fix binding to unix socket on Windows #19812
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
Conversation
|
Next: |
|
Could these sockopt tweaks be applied to non-Windows, too? |
|
Is this the solution to #11258? |
|
This fixes 10045 (
Current GHA jobs run on Windows Server 2022, which should all support it. If we had a link to one of the old failing AppVeyor jobs, we may be able to see |
|
Before: After: |
|
Ref dfa84a0 |
|
Fixing socksd test server enabled 3 more tests. All fail due a 3rd issue: Opened #19825 |
64dd49b to
1f65527
Compare
``` === Start of file http_unix_server.log 16:52:47.609949 Running HTTP unix version on C:/msys64/tmp/curl-http-hfGQXSvC 16:52:47.611328 Wrote pid 4202056 to log/6/server/http_unix_server.pid 16:52:47.611550 Wrote port 8999 to log/6/server/http_unix_server.port 16:52:49.437513 setsockopt(SO_KEEPALIVE) failed with error (10042) Protocol option is unsupported 16:52:49.437670 accept_connection 388 returned -1 16:52:49.438145 unlink(C:/msys64/tmp/curl-http-hfGQXSvC) = 0 (The operation completed successfully.) 16:52:49.440305 ========> sws quits ``` https://github.com/curl/curl/actions/runs/19866365047/job/56930177145?pr=19812
https://github.com/curl/curl/pull/19810/files sock5 sockets fail ``` test 1467...[HTTP GET via SOCKS5 proxy via Unix sockets] 1467: protocol FAILED! There was no content at all in the file log/1/server.input. Server glitch? Total curl failure? Returned: 7 == Contents of files in the log/1/ directory after test 1467 === Start of file commands.log ../src/curl.exe -q --output log/1/curl1467.out --include --trace-ascii log/1/trace1467 --trace-time --socks5 localhost/tmp/curl-socksd-xe3LMbVY http://127.0.0.1:64407/1467 > log/1/stdout1467 2> log/1/stderr1467 === End of file commands.log === Start of file http_server.log 14:11:54.529549 ====> Client connect 14:11:54.529749 accept_connection 276 returned 528 14:11:54.529874 accept_connection 276 returned 0 14:11:54.530257 Read 97 bytes 14:11:54.530339 Process 97 bytes request 14:11:54.530599 Got request: GET /verifiedserver HTTP/1.1 14:11:54.530813 Are-we-friendly question received 14:11:54.531012 Wrote request (97 bytes) input to log/1/server.input 14:11:54.531204 Identifying ourselves as friends 14:11:54.531531 Response sent (58 bytes) and written to log/1/server.response 14:11:54.531617 special request received, no persistency 14:11:54.531695 ====> Client disconnect 0 === End of file http_server.log === Start of file http_verify.log * !!! WARNING !! * This is a debug build of libcurl, do not use in production. * alloc connection, bits.close=0 * setup connection, bits.close=0 * setup connection, bits.close=0 * new connection, bits.close=0 * Trying 127.0.0.1:64407... * Established connection to 127.0.0.1 (127.0.0.1 port 64407) from 127.0.0.1 port 52514 * using HTTP/1.x * sending last upload chunk of 97 bytes * Curl_xfer_send(len=97, eos=1) -> 0, 97 > GET /verifiedserver HTTP/1.1 > Host: 127.0.0.1:64407 > User-Agent: curl/8.18.0-DEV > Accept: */* > * Request completely sent off < HTTP/1.1 200 OK < Content-Length: 19 < { [19 bytes data] * Connection #0 to host 127.0.0.1:64407 left intact === End of file http_verify.log === Start of file http_verify.out WE ROOLZ: 4200364 === End of file http_verify.out === Start of file server.cmd Testnum 1467 === End of file server.cmd === Start of file server.response HTTP/1.1 200 OK Content-Length: 19 WE ROOLZ: 4200364 === End of file server.response === Start of file socks2_server.log 14:11:54.597017 Running unix version 14:11:54.597943 Listening on Unix socket D:/a/_temp/msys64/tmp/curl-socksd-xe3LMbVY 14:11:54.598142 Wrote pid 4195104 to log/1/server/socks2_server.pid === End of file socks2_server.log === Start of file stderr1467 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed to connect to 127.0.0.1 port 64407 via localhost/tmp/curl-socksd-xe3LMbVY after 4 ms: Could not connect to server === End of file stderr1467 === Start of file trace1467 14:11:55.693000 * !!! WARNING !! 14:11:55.693000 * This is a debug build of libcurl, do not use in production. 14:11:55.693000 * alloc connection, bits.close=0 14:11:55.693000 * setup connection, bits.close=0 14:11:55.693000 * setup connection, bits.close=0 14:11:55.693000 * new connection, bits.close=0 14:11:55.693000 * Trying /tmp/curl-socksd-xe3LMbVY:0... 14:11:55.693000 * Immediate connect fail for /tmp/curl-socksd-xe3LMbVY: Network down 14:11:55.693000 * Failed to connect to 127.0.0.1 port 64407 via localhost/tmp/curl-socksd-xe3LMbVY after 4 ms: Could not connect to server 14:11:55.693000 * closing connection #0 === End of file trace1467 test 1474...[--proto -all disables all protocols] -------em-- OK (1418 out of 1818, remaining: 01:15, took 0.437s, duration: 04:27) test 1468...[HTTP GET with hostname using SOCKS5h via Unix sockets] 1468: protocol FAILED! There was no content at all in the file log/3/server.input. Server glitch? Total curl failure? Returned: 7 == Contents of files in the log/3/ directory after test 1468 === Start of file commands.log ../src/curl.exe -q --output log/3/curl1468.out --include --trace-ascii log/3/trace1468 --trace-time http://this.is.a.host.name:64405/1468 --proxy socks5h://localhost/tmp/curl-socksd-YnbvRo98 > log/3/stdout1468 2> log/3/stderr1468 === End of file commands.log === Start of file http_server.log 14:11:54.529551 ====> Client connect 14:11:54.529749 accept_connection 268 returned 608 14:11:54.529878 accept_connection 268 returned 0 14:11:54.530268 Read 97 bytes 14:11:54.530361 Process 97 bytes request 14:11:54.530613 Got request: GET /verifiedserver HTTP/1.1 14:11:54.530826 Are-we-friendly question received 14:11:54.530987 Wrote request (97 bytes) input to log/3/server.input 14:11:54.531124 Identifying ourselves as friends 14:11:54.531384 Response sent (58 bytes) and written to log/3/server.response 14:11:54.531498 special request received, no persistency 14:11:54.531566 ====> Client disconnect 0 === End of file http_server.log === Start of file http_verify.log * !!! WARNING !! * This is a debug build of libcurl, do not use in production. * alloc connection, bits.close=0 * setup connection, bits.close=0 * setup connection, bits.close=0 * new connection, bits.close=0 * Trying 127.0.0.1:64405... * Established connection to 127.0.0.1 (127.0.0.1 port 64405) from 127.0.0.1 port 52515 * using HTTP/1.x * sending last upload chunk of 97 bytes * Curl_xfer_send(len=97, eos=1) -> 0, 97 > GET /verifiedserver HTTP/1.1 > Host: 127.0.0.1:64405 > User-Agent: curl/8.18.0-DEV > Accept: */* > * Request completely sent off < HTTP/1.1 200 OK < Content-Length: 19 < { [19 bytes data] * Connection #0 to host 127.0.0.1:64405 left intact === End of file http_verify.log === Start of file http_verify.out WE ROOLZ: 4197832 === End of file http_verify.out === Start of file server.cmd Testnum 1468 === End of file server.cmd === Start of file server.response HTTP/1.1 200 OK Content-Length: 19 WE ROOLZ: 4197832 === End of file server.response === Start of file socks2_server.log 14:11:54.597034 Running unix version 14:11:54.597968 Listening on Unix socket D:/a/_temp/msys64/tmp/curl-socksd-YnbvRo98 14:11:54.598176 Wrote pid 4203736 to log/3/server/socks2_server.pid === End of file socks2_server.log === Start of file stderr1468 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed to connect to this.is.a.host.name port 64405 via localhost/tmp/curl-socksd-YnbvRo98 after 4 ms: Could not connect to server === End of file stderr1468 === Start of file trace1468 14:11:55.693000 * !!! WARNING !! 14:11:55.693000 * This is a debug build of libcurl, do not use in production. 14:11:55.693000 * alloc connection, bits.close=0 14:11:55.693000 * setup connection, bits.close=0 14:11:55.693000 * setup connection, bits.close=0 14:11:55.693000 * new connection, bits.close=0 14:11:55.693000 * Trying /tmp/curl-socksd-YnbvRo98:0... 14:11:55.693000 * Immediate connect fail for /tmp/curl-socksd-YnbvRo98: Network down 14:11:55.693000 * Failed to connect to this.is.a.host.name port 64405 via localhost/tmp/curl-socksd-YnbvRo98 after 4 ms: Could not connect to server 14:11:55.693000 * closing connection #0 === End of file trace1468 test 1477...[Verify that error codes in headers and libcurl-errors.3 are in sync] s------e--- OK (1421 out of 1818, remaining: 01:14, took 0.140s, duration: 04:27) test 1470...[HTTPS GET with hostname using SOCKS5h via Unix sockets] 1470: protocol FAILED! There was no content at all in the file log/5/server.input. Server glitch? Total curl failure? Returned: 7 == Contents of files in the log/5/ directory after test 1470 === Start of file commands.log ../src/curl.exe -q --output log/5/curl1470.out --include --trace-ascii log/5/trace1470 --trace-time https://this.is.a.host.name:65483/1470 --insecure --proxy socks5h://localhost/tmp/curl-socksd-el7LUslB > log/5/stdout1470 2> log/5/stderr1470 === End of file commands.log === Start of file http_server.log 14:11:54.973870 ====> Client connect 14:11:54.974003 accept_connection 260 returned 560 14:11:54.974085 accept_connection 260 returned 0 14:11:54.974160 Read 97 bytes 14:11:54.974227 Process 97 bytes request 14:11:54.974297 Got request: GET /verifiedserver HTTP/1.1 14:11:54.974362 Are-we-friendly question received 14:11:54.974476 Wrote request (97 bytes) input to log/5/server.input 14:11:54.974579 Identifying ourselves as friends 14:11:54.974813 Response sent (58 bytes) and written to log/5/server.response 14:11:54.974889 special request received, no persistency 14:11:54.974944 ====> Client disconnect 0 === End of file http_server.log === Start of file https_verify.log * !!! WARNING !! * This is a debug build of libcurl, do not use in production. * alloc connection, bits.close=0 * setup connection, bits.close=0 * setup connection, bits.close=0 * new connection, bits.close=0 * Trying 127.0.0.1:65483... * GnuTLS priority: NORMAL:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509:-VERS-SSL3.0:-VERS-TLS-ALL:+VERS-TLS1.3:+VERS-TLS1.2 * ALPN: curl offers h2,http/1.1 * SSL Trust: peer verification disabled * SSL connection using TLS1.3 / ECDHE_RSA_AES_256_GCM_SHA384 * SSL certificate verification SKIPPED * SSL certificate expiration date OK * SSL certificate activation date OK * SSL certificate status verification SKIPPED * common name: localhost (does not match '127.0.0.1') * certificate public key: EC/ECDSA * certificate version: #3 * subject: C=NN,O=Edel curl Arctic Illudium Research Cloud,CN=localhost * start date: Wed, 03 Dec 2025 14:06:46 GMT * expire date: Tue, 29 Sep 2026 14:06:46 GMT * issuer: C=NN,O=Edel curl Arctic Illudium Research Cloud,CN=Northern Nowhere Trust Anchor * ALPN: server did not agree on a protocol. Uses default. * Established connection to 127.0.0.1 (127.0.0.1 port 65483) from 127.0.0.1 port 52518 * using HTTP/1.x * sending last upload chunk of 97 bytes * Curl_xfer_send(len=97, eos=1) -> 0, 97 > GET /verifiedserver HTTP/1.1 > Host: 127.0.0.1:65483 > User-Agent: curl/8.18.0-DEV > Accept: */* > * Request completely sent off < HTTP/1.1 200 OK < Content-Length: 19 < { [19 bytes data] * Connection #0 to host 127.0.0.1:65483 left intact === End of file https_verify.log === Start of file https_verify.out WE ROOLZ: 4196540 === End of file https_verify.out === Start of file server.cmd Testnum 1470 === End of file server.cmd === Start of file server.response HTTP/1.1 200 OK Content-Length: 19 WE ROOLZ: 4196540 === End of file server.response === Start of file socks2_server.log 14:11:55.043373 Running unix version 14:11:55.044269 Listening on Unix socket D:/a/_temp/msys64/tmp/curl-socksd-el7LUslB 14:11:55.044474 Wrote pid 4196296 to log/5/server/socks2_server.pid === End of file socks2_server.log === Start of file stderr1470 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed to connect to this.is.a.host.name port 65483 via localhost/tmp/curl-socksd-el7LUslB after 3 ms: Could not connect to server === End of file stderr1470 === Start of file trace1470 14:11:56.178000 * !!! WARNING !! 14:11:56.178000 * This is a debug build of libcurl, do not use in production. 14:11:56.178000 * alloc connection, bits.close=0 14:11:56.178000 * setup connection, bits.close=0 14:11:56.178000 * setup connection, bits.close=0 14:11:56.178000 * new connection, bits.close=0 14:11:56.178000 * Trying /tmp/curl-socksd-el7LUslB:0... 14:11:56.178000 * Immediate connect fail for /tmp/curl-socksd-el7LUslB: Network down 14:11:56.178000 * Failed to connect to this.is.a.host.name port 65483 via localhost/tmp/curl-socksd-el7LUslB after 3 ms: Could not connect to server 14:11:56.178000 * closing connection #0 === End of file trace1470 [...] FAIL 1467: 'HTTP GET via SOCKS5 proxy via Unix sockets' HTTP, HTTP GET, SOCKS5, UnixSockets FAIL 1468: 'HTTP GET with hostname using SOCKS5h via Unix sockets' HTTP, HTTP GET, SOCKS5, SOCKS5h, UnixSockets FAIL 1470: 'HTTPS GET with hostname using SOCKS5h via Unix sockets' HTTPS, HTTP, HTTP GET, SOCKS5, SOCKS5h, UnixSockets ``` https://github.com/curl/curl/actions/runs/19896583933/job/57028545111?pr=19812
…ll operating systems" This reverts commit 9397e3b. Double leading slash breaks Cygwin and MSYS2 (slightly differently): https://github.com/curl/curl/actions/runs/19928374178/job/57133768163?pr=19812 This is how it looked before: https://github.com/curl/curl/actions/runs/19898592049
This reverts commit 4b57337. This would likely need passing specially formatted filenames depending on platform. It also doesn't fix curl touching up the URL/filename later and breaking it on native Windows: ../src/Debug/curl.exe -q --output log/3/curl1467.out --include --trace-ascii log/3/trace1467 --trace-time --socks5 localhost/D:/a/curl/curl/bld/tests/log/3/server/socks-uds http://127.0.0.1:58215/1467 > log/3/stdout1467 2> log/3/stderr1467 [...] 12:14:08.042000 * !!! WARNING !! 12:14:08.042000 * This is a debug build of libcurl, do not use in production. 12:14:08.042000 * alloc connection, bits.close=0 12:14:08.042000 * Unsupported proxy syntax in 'localhost\D;A:\curl\curl\bld\tests\log\3\server\socks-uds': Port number was not a decimal number between 0 and 65535 https://github.com/curl/curl/actions/runs/19928374178/job/57133768233?pr=19812
This reverts commit 09d870e.
Windows 10.17063+ (having unix socket support) fails to set for unix
sockets the
SO_REUSEADDRoption, with error 10045 (WSAEOPNOTSUPP),and also fails to set
SO_KEEPALIVEwith error 10042 (WSAENOPROTOOPT).Fix by not enabling these socket options on Windows for unix sockets.
Also:
socksdtest server for test 1467, 1468, 1470. But, alsodisable these for now due to another Windows issue: socks: not possible to use absolute Unix socket filename on Windows #19825
Ref: https://stackoverflow.com/questions/68791319/unix-domain-socket-bind-failed-in-windows/68794755#68794755
Ref: #19810
https://github.com/curl/curl/pull/19812/files?w=1
SO_REUSEADDR: probably not. https://gavv.net/articles/unix-socket-reuse/ (not Linux and BSD)SO_KEEPALIVE: it seems this one is used.https://www.man7.org/linux/man-pages/man7/socket.7.html
Anyway, turn them off for Windows-only just to avoid changing other platforms.