Iterating unit test 1627 50,000 times show the new version to be 31%
faster on my machine.
- unit1627: add more test strings, In particular three, five and six letter
non-existing schemes.
- remove scripts/schemetable.c, not used anymore
Closes#22658
Seen in the 'curl-for-win / Windows gcc zlib-classic (x64)' CI job,
after it got an upstream upgrade from gcc-15 to gcc-16:
```
lib/http.c:206:6: error: 'out.str' may be used uninitialized [-Werror=maybe-uninitialized]
206 | if(header_has_value(&header, &out)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/api.h:188:3: error: 'guard.data' may be used uninitialized [-Werror=maybe-uninitialized]
188 | Curl_mapi_enter((g), (m), CURL_MAPI_FN_##fn, (r)) && (m)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/multi.c:1695:6: note: in expansion of macro 'CURL_MAPI_ENTER'
1695 | if(CURL_MAPI_ENTER(&guard, m, multi_poll, &mresult)) {
| ^~~~~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/32626356576/job/97162205296#step:3:4906Closes#22651
Correct grammar and spelling in documentation and source comments. Also
fix the Aspell configuration key and one user-facing OpenSSL error
message.
Closes#22647
The added code to avoid loading PSL cookies from files from PR #22500
(c041895, not shipped in a release), calls psl_is_public_suffix(),
returns TRUE also for "localhost" (!).
We now allow cookies again for localhost. Added test 320 to verify.
Reported-by: Athos Ribeiro
Fixes#22645Closes#22646
When websocket writes out data thought the registered write callback and
that returns an error, clear the write buffers, so a sub-sequent flush
will not attempt another write. The transfer is failed at that point and
should no longer invoke the callback.
Fixes#22627
Reported-by: Scott Talbert
Closes#22634
The previous 4 entries were exhausted on simple command lines, depending
on environment/build. Grow the initial size to 8 to avoid early allocs.
Closes#22633
Change the storage of easy handle option strings from an array sized for
all possible options to a hash set to reduce memory footprint.
Give the hash set initially room for 4 strings, with first allocation
happening when it goes beyond that. Measurements without test suite
and a forced fail on growing the set gives:
Size Result
2 1261 tests out of 1951 reported OK: 64%
4 1792 tests out of 1951 reported OK: 91%
8 1944 tests out of 1951 reported OK: 99%
16 1949 tests out of 1951 reported OK: 99%
32 single fail of 3211, unit test for u8_strset
Add u8_strset that keeps the tuples (uint8_t id, char *str)
and allows set/unset by `id`. Add that as data->set.strings.
Define MACROS
* CURL_EASY_STR(data, id) for access
* CURL_EASY_STR_SET(data, id, s) for setting, making a copy
* CURL_EASY_STR_SETN(data, id, s) for setting, no copy
* CURL_EASY_STR_CLEAR(data, id) for unsetting
* CURL_EASY_STR_CLEAR0(data, id) for unsetting and zero-ing value
Add `data->set.str_copypostfields` to handle former `STRING_COPYPOSTFIELDS`
string that was not always a string and could carry NUL bytes.
Add unit tests to test3211.
Closes#22628
`ossl_chain_get_der()` allocates a DER encoding of each peer certificate
via `i2d_X509()`, but `Curl_vtls_apple_verify()` only copies it into a
CFData and never frees the original. This leaks per certificate, per
handshake, whenever USE_APPLE_SECTRUST is used with the
OpenSSL/LibreSSL/BoringSSL backend.
Fix frees the buffer inside openssl.c itself, so the GnuTLS backend
(which borrows rather than allocates) is unaffected.
Closes#22631
A value whose first byte is ':' or '<' is not a SAFE-INIT-CHAR per RFC
2849 and must be base64-encoded, but ldap_value_needs_base64() and the
inline check in oldap_recv() only encoded on a control byte or
leading/trailing blank. Such a value was emitted verbatim, producing
LDIF that strict parsers reject.
Closes#22339
Line should already have been removed in 7103a93, but neither
humans nor clankers caught it. tststs...
Prior to this change it appears all reuse of empty cred connection was
blocked for ntlm instead of the intended behavior of allowing
reuse in the limited circumstance when it is the same connection used by
the transfer before.
Closes https://github.com/curl/curl/pull/22629
As documented and as it does for other methods.
Difficult to test since it needs a successful kerberos ticket.
Reported-by: sdgh179 on github
Fixes#22610Closes#22622
Move the two remaining fields into the state struct instead, within the
HTTP ifdef.
Also: make the AWS sigv4 code always rely on the http_host value. It
was previously conditionally trying to also work if it was not set, but
that logic was not creating an identical copy so it would fail.
Closes#22620
After telemetry data from Mozilla reported the P99 DNS resolution
differences between A and AAAA responses to by 21ms, reduce curl's
resolution delay to 25ms.
What could possibly go wrong?
Closes#22612
Eleven arguments are named one way in the header and another in the
definition. the compiler only checks types so nothing is broken, but the
header is what people read first, and then the name changes under them
in the source:
```
curl_dbg_malloc size -> wantedsize
curl_dbg_calloc n, size -> wanted_elements, wanted_size
curl_dbg_realloc size -> wantedsize
curl_dbg_strdup src -> source
r_freeaddrinfo res -> cahead
my_get_line fp, db -> input, buf
curl_slist_append_ccsid l -> list
curl_version_info_ccsid cid -> ccsid
curl_easy_setopt_ccsid curl -> easy
```
Follow-up to df6014894b#20794Closes#22550
Replace the QUERY filter methods for connect and appconnect time with a
new control CF_CTRL_REPORT_STATS that is triggered when a connect ends
(successful or not).
Filters in the connection can then report their statistics. Socket and
TLS filters do this only once. Subsequent CF_CTRL_REPORT_STATS will do
nothing.
This prevents timers to be reported twice in STARTTLS scenarios.
Fixes#22587 (again)
Closes#22596
To simplify and to remove an exception where `errno` was reused to
return a socket error codes on Windows.
The error was used by one call site (`sockaddr2string()` in
`cf-socket.c`), but it was in practice always propagated as
`SOCKEAFNOSUPPORT` to callers.
Also:
- cf-socket: update 3 error messages to show `CURLcode` accordingly.
- if2ip: handle `curlx_inet_ntop()` error in `Curl_if2ip()`.
- dnsd: display `CURLcode` on two errors.
Follow-up to 39dec13ec0#22170Closes#22229
When creating a multi handle, global_init() may not have been
invoked that. There is a lazy check for this in easy_init()
that trigger global_init().
Create the admin handle for a multi first, before any further
operations, so easy_init() can trigger a global_init() when
necessary.
Closes#22606
- 'rtsp_transport'
There is no need to keep this data around once the RTSP request has been
issued.
- 'accept_encoding'
Only needed when creating the RTSP request.
- 'uagent'
The header is generated on demand from set.str[STRING_USERAGENT]
- 'ref'
Not necessary to keep around
Closes#22603
- sockindex: int -> int8_t
- move connectdata members around for fun and profit
- remove data->state.current_speed as unused
- remove data->state.trailers_bytes_sent as unsed
- remove data->state.trailers_buf as unsed
The sockindex type change spread a little.
Closes#22604
According to the content of the latest downloadable builds available at
(from 2022): https://www.riscos.info/packages/src/Network/, these builds
used autotools, not the handcrafted header. Also the handcrafted header
did not see an update (that I could find) since
0866c1b52d (2002-04-08), other than
source-wide maintenance updates.
Closes#22598
This is the only purpose it's maintained for.
Drop mingw-w64 and other logic falling outside of VS2010-2013 needs.
mingw-w64/MSVC platform differences keep being maintained/documented as
part of the CMake pre-fill logic in `CMake/win32-cache.cmake`.
Follow-up to ba8752e556#12224Closes#22595
- Move expire timeout code from multi into splay.c
- keep a "time_base" timestamp to calculate timediff_t for
actual timeout values. Unfortunately this means our
timeouts will go wrong after ~500,000 years of continuous
operations...
- use timediff_t as key in splay instead of curltime
- use timediff_t in transfers expire times instead of curltime
- re-comment splay.c for better understanding how it works
- replace splay nodes double-linked "same" list with a single link,
we almost never have duplicate keys
- keep transfer `mid` in splay nodes instead of the transfer pointer
- keep registered bit in splay node for tracking instead of separate
bit in transfer
- adapt unit1309.c to changes in timediff_t and mid
Closes#22584
struct SingleRequest tweaks
- 'upgr101' from enum upgrade101 => 'unsigned char', saves three bytes
- made some 'unsigned char' => uint8_t
- moved 'io_flags' to fill a hole on 64-bit arch
struct UserDefined tweaks
- Sort the fields by size. Larger to smaller. Helps avoding holes.
- httpsig_algorithm moved
- FTP uint8_t fields moved
- new_file_perms moved
- rtspreq moved
- sort fields on size
- urldata: drop 'struct Curl_data_priority'
It only had a single struct member 'weight'. Use that directly instead
to save indirections and struct alignments. Move field for size order.
- urldata: move the RTSP fields in the UrlState struct to be ordered by
size
struct PureInfo tweaks
- make 'pxcode' a uint8_t
- move 'conn_protocol' to fill a hole
- sort 'struct PureInfo' fields by size
Closes#22585
Maintenance tasks like connection upkeep, liveliness checks and cache
eviction must only run on an admin handle, not the application transfer
from the calling context.
Then application transfers will get only attached to the connections
they actually work on. This makes `data->state.recent_conn_id`
meaningful for checks if a subsequent address is finding the previous
connection again.
One thing led to another:
- add Curl_get_admin(data), to obtain an admin handle for
an application handle, inheriting some properties for
connection operation.
- rename `Curl_easy *data` parameter to `Curl_easy *admin`
where only admin handles should be passed. Add DEBUGASSERTs
in the called function.
- rename `Curl_conn_terminate()` to `Curl_conn_close()`
because this makes connections enter the shutdown close
where possible.
- rename `Curl_cshutdn_terminate()` to `Curl_conn_terminate()`
since this definitely kills the connection and does not
involve a `cshutdn` instance.
- add Curl_share_lock_share(), Curl_share_unlock_share()
so it possible to operate on a share without the passed
easy handle having the share set.
This catches a case where a shared needed to be locked
but was not before. Adjust test1554 results.
Fixes#22567
Reported-by: cybertron10 on github
Closes#22572
When the time-out value is passed to the outside world it needs to fit
in a signed 32-bit variable (on Windows and 32-bit architectures)
anyway. Also, this is 3.5 weeks and we should not knowingly set timeouts
that long anyway.
The previous cap introduced in 3089e7eec8 was only partial.
Closes#22579
Curl_xfer_send() reports CURLE_AGAIN as a successful zero-byte send, so
the retry loop spun at 100% CPU and ignored the timeout when the peer
stopped draining. Wait for writability and check the remaining time
between retries.
Closes#22576
In the totally unlikely event that next_easy_id would ever wrap, avoid
undefined behavior. It is a signed type.
Also: update the related comment in urldata.h that mentioned LONG_MAX
but is nowadays CURL_OFF_T_MAX
Closes#22569
Since this code needs to work (identically) on systems with 32 bit longs
anyway, this might just as well always use 32 bit to save space and make
the code work the same everywhere.
Closes#22564
Reorder logic when looking for matching connections. Check candidate
Negotiate/NTLM state first. Require same "input" parameters when
connection is already authenticated. Same for proxy.
Deny connection reuse for empty usernames for NTLM/Negotiate using
connections.
Reported-by: Martin Dukek
Closes#22528
- drop redundant casts for `CURL_UNCONST()` pointers (Windows).
- GHA/linux: delete redundant/dupe `-g` C flag in memory sanitizer job.
Spotted-by: Daniel Stenberg
- examples/http2-upload: drop local macro.
- examples/http2-upload: drop leading underscore from union name.
- examples/http2-upload: drop interim macro.
- tests/server/util: reapply patch lost in a rebase.
- sync `main()` declarations across the codebase.
Closes#22559
Keep only a single `start` time and calculate the rest in delta
microseconds since then. Separate timestamps and durations into separate
sub-structures for clarity.
remove progress.t_acceptdata
It was recorded in FTP accept but never used anywhere.
Closes#22547
The only usage of the thread queue and pool is for "DNS" which is a
static string. No point in strdup'ing it (twice). Future users are
*likely* to also used fixed strings, otherwise we revert this change
when dynamic names are introduced.
Reported-by: Max Dymond
Closes#22555
The dedotdotify() function that removes ./ and ../ sequences from paths
juggles memory and is slow. Now needs_dedotdot() is called first to
determine if the removal process is necessary and otherwise avoids doing
it. Avoids unnecessary memory operations.
Adjusted unit test 1395 accordingly because now a lot of input strings
return NULL for "no change necessary".
Suggested-by: Max Dymond
Closes#22557