curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

curl exit code change after 335dc0e3c5968827 intentional?

From: Fabian Keil via curl-library <curl-library_at_lists.haxx.se>
Date: Mon, 13 Apr 2026 11:04:10 +0200

After updating my curl sources and running the Privoxy cts
tests I noticed two new test failures. One example is:

fk_at_t520 ~ $~/git/privoxy/tests/cts/run-privoxy-tests.sh -t acl-multiple-ip-addresses-specified-without-destination -- -p 4
Passing remaining arguments to runtests-wrapper.sh: -p 4
Test scenario: acl-multiple-ip-addresses-specified-without-destination
Setting TESTDIR to /home/fk/git/privoxy/tests/cts/acl-multiple-ip-addresses-specified-without-destination/data
Using curl: /home/fk/git/curl/src/curl
********* System characteristics ********
* curl 8.20.0-DEV (amd64-unknown-freebsd14.4)
* libcurl/8.20.0-DEV OpenSSL/3.0.19 zlib/1.3.1 brotli/1.2.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 nghttp2/1.68.0
* Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt mqtts pop3 pop3s smtp smtps telnet tftp ws wss
* Features: alt-svc AsynchDNS brotli Debug HSTS HTTP2 HTTPS-proxy IDN IPv6 Largefile libz PSL SSL threadsafe TLS-SRP UnixSockets zstd
* Disabled: win32-ca-searchpath, win32-ca-search-safe, override-dns, ssl-sessions
* Host: t520.local
* System: ElectroBSD t520.local 14.4-STABLE ElectroBSD 14.4-STABLE #61 electrobsd-14-n274143-3219e3d0ca58: 2026-03-26 14:39:27 +0000 fk_at_t520.local:/usr/obj/usr/src/amd64.amd64/sys/ELECTRO_BEER amd64
* OS: freebsd
* Perl: v5.42.2 (/usr/local/bin/perl)
* Args: -c /home/fk/git/curl/src/curl -o TESTDIR=/home/fk/git/privoxy/tests/cts/acl-multiple-ip-addresses-specified-without-destination/data -L /home/fk/git/privoxy/tests/cts/privoxy-runtests.pm -P http://127.0.0.1:9119/ -a -n HTTP !skip HTTP HTTPS -p 4
* Seed: 229333
* Servers: SSL HTTP-IPv6 HTTP-unix FTP-IPv6
*****************************************
test 0004...[Request from client address from denied network range]

curl returned 56, when expecting 52
 4: exit FAILED
== Contents of files in the log/ directory after test 4
=== Start of file commands.log
 /home/fk/git/curl/src/curl -q --output log/curl4.out --include --trace-ascii log/trace4 --trace-time --interface 127.0.1.3 http://127.0.0.1/4 --proxy http://127.0.0.1:9119/ > log/stdout4 2> log/stderr4
=== End of file commands.log
=== Start of file server.cmd
 Testnum 4
=== End of file server.cmd
=== Start of file stderr4
   % 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: (56) Recv failure: Connection reset by peer
=== End of file stderr4
=== Start of file trace4
 10:43:22.054636 * !!! WARNING !!
 10:43:22.054892 * This is a debug build of libcurl, do not use in production.
 10:43:22.054954 * alloc connection, bits.close=0
 10:43:22.055097 * setup connection, bits.close=0
 10:43:22.055103 * setup connection, bits.close=0
 10:43:22.055133 * new connection, bits.close=0
 10:43:22.055289 * Trying 127.0.0.1:9119...
 10:43:22.055376 * Name '127.0.1.3' family 2 resolved to '127.0.1.3' family 2
 10:43:22.055393 * Local port: 0
 10:43:22.055642 * Established connection to 127.0.0.1 (127.0.0.1 port 9119) from 127.0.1.3 port 58852
 10:43:22.057759 * using HTTP/1.x
 10:43:22.057856 * sending last upload chunk of 124 bytes
 10:43:22.057897 * Curl_xfer_send(len=124, eos=1) -> 0, 124
 10:43:22.057902 => Send header, 124 bytes (0x7c)
 0000: GET http://127.0.0.1/4 HTTP/1.1
 0021: Host: 127.0.0.1
 0032: User-Agent: curl/8.20.0-DEV
 004f: Accept: */*
 005c: Proxy-Connection: Keep-Alive
 007a:
 10:43:22.057991 * Request completely sent off
 10:43:22.058077 * Recv failure: Connection reset by peer
 10:43:22.058087 * sendrecv_dl() -> 56
 10:43:22.058092 * Curl_sendrecv() -> 56
 10:43:22.058136 * closing connection #0
=== End of file trace4
TESTDONE: 1 tests were considered during 0 seconds.
TESTDONE: 0 tests out of 1 reported OK: 0%

FAIL 4: 'Request from client address from denied network range' HTTP, HTTP GET

TESTFAIL: These test cases failed: 4

Bisecting resulted in:

335dc0e3c59688270140115c9f84ea5c929870d8 is the first bad commit
commit 335dc0e3c59688270140115c9f84ea5c929870d8 (HEAD)
Author: Stefan Eissing <stefan_at_eissing.org>
Date: Wed Mar 25 15:07:10 2026 +0100

    cf-dns: connection filter for DNS queries
    
    New connection filter `cf-dns` that manages DNS queries. If hands
    out addresses and HTTPS-RR records to anyone interested. Used by
    HTTPS and IP happy eyeballing.
    
    Information may become available *before* the libcurl "dns entry"
    is complete, e.g. all queries have been answered. The cf-ip-happy
    filter uses this information to start connection attempts as soon
    as the first address is available.
    
    The multi MSTATE_RESOLVING was removed. A new connection always
    goes to MSTATE_CONNECTING. The connectdata bit `dns_resolved`
    indicates when DNS information is complete. This is used for
    error reporting and starting the progress meter.
    
    Removed dns entries `data->state.dns[i]`, as the `cf-dns` filter
    now keeps the reference now.
    
    Many minor tweaks for making this work and pass address information
    around safely.
    
    Closes #21027

From the commit message it's not obvious to me if the change of
the exit code from 52 to 56 was intentional.

From the curl man page:

| 52 The server did not reply anything, which here is considered an
| error.
[...]
| 56 Failure in receiving network data.

While I can simply update the Privoxy test to expect exit code 56 now,
exit code 52 seems slightly more fitting to me.

Any opinions?

Fabian
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2026-04-13