curl-curl/docs/internals
Viktor Szakats 6d0ee7b17b
curlx: add curlx_rename(), fix to support long filenames on Windows
Move existing `Curl_rename()` `rename()` wrapper from lib to
curlx/fopen, and make it a curlx macro/function. To allow using
the local worker function to fixup long filenames on Windows.

Then fix the Windows-specific rename implementation to support long
filenames. This operation may happen when using a cookie jar, HSTS cache
or alt-svc cache, via libcurl or the curl tool.

Before this patch, when passing a long filename to the above options,
a `<random>.tmp` file was left on the disk without renaming it to the
filename passed to curl. There was also 1 second delay for each
attempted rename operation.

Also:
- checksrc: ban raw `rename()` and `MoveFileEx*()` functions.
- Note: `Curl_rename()` returned 1 on failure before this patch, while
  `curlx_rename()` returns -1 after, to match POSIX `rename()`.

Refs:
https://learn.microsoft.com/windows/win32/api/winbase/nf-winbase-movefileexa
https://learn.microsoft.com/windows/win32/fileio/maximum-file-path-limitation

Ref: #20040

Closes #20042
2025-12-20 16:03:11 +01:00
..
BUFQ.md docs: fold long lines 2025-12-11 11:42:28 +01:00
BUFREF.md bufref: add Curl_bufref_dup that returns a strdup()ed version 2025-12-04 19:04:19 +01:00
CHECKSRC.md build: stop overriding standard memory allocation functions 2025-11-28 10:44:26 +01:00
CLIENT-READERS.md docs: fold long lines 2025-12-11 11:42:28 +01:00
CLIENT-WRITERS.md docs: fold long lines 2025-12-11 11:42:28 +01:00
CODE_STYLE.md curlx: add curlx_rename(), fix to support long filenames on Windows 2025-12-20 16:03:11 +01:00
CONNECTION-FILTERS.md docs: fold long lines 2025-12-11 11:42:28 +01:00
CURLX.md curlx: move the docs to docs/internals/ 2025-05-13 10:30:02 +02:00
DYNBUF.md curlx: move into to curlx/ 2025-05-07 11:01:15 +02:00
HASH.md lib: add meta_hash to connection, eliminate hash_offt 2025-04-22 15:57:18 +02:00
LLIST.md docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
MID.md multi: do transfer book keeping using mid 2025-04-17 17:28:38 +02:00
MQTT.md docs: fold long lines 2025-12-11 11:42:28 +01:00
MULTI-EV.md multi: event based rework 2025-02-22 14:47:40 +01:00
NEW-PROTOCOL.md GHA: silence proselint warnings and an error 2024-10-15 16:44:17 +02:00
PORTING.md docs/internals/PORTING.md: new document 2025-03-29 14:10:10 +01:00
RATELIMITS.md ratelimit: redesign 2025-11-24 23:34:05 +01:00
README.md docs/internals: new subdirectory 2024-08-16 08:59:25 +02:00
SCORECARD.md docs: fold long lines 2025-12-11 11:42:28 +01:00
SPLAY.md internals/SPLAY.md: internal API documentation 2024-08-16 17:13:37 +02:00
STRPARSE.md spelling: call it null-terminate consistently 2025-05-30 17:29:45 +02:00
TIME-KEEPING.md TIME-KEEPING.md: fold long lines 2025-12-18 23:00:06 +01:00
TLS-SESSIONS.md docs: fold long lines 2025-12-11 11:42:28 +01:00
UINT_SETS.md TIME-KEEPING.md: fold long lines 2025-12-18 23:00:06 +01:00
WEBSOCKET.md websocket: add option to disable auto-pong reply 2025-04-19 00:01:28 +02:00

Internals

This directory contains documentation covering libcurl internals; APIs and concepts that are useful for contributors and maintainers.

Public APIs are documented in the public documentation, not here.