A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and
Go to file
Viktor Szakats e95f509c66
tests/server: make the signal handler signal-safe
Before this patch the signal handler called `logmsg()` which in turn
called `printf()` variants (internal implementations), and `FILE *`
functions, `localtime()`. Some of these called `malloc`/`free`, which
isn't supported in s signal handler. Replace them with `write` calls,
losing some logging functionality.

Also:
- De-dupe and move `STD*_FILENO` macros to `lib/curl_setup.h`. Revert
  the `src` definition to point to `stderr`, instead of `tool_stderr`.
  Follow-up to e5bb88b8f8 #11958

POSIX specs with list of functions allowed in a signal handler:
2004: https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
2017: https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03
2024: https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_04_03

Linux CI run with the thread sanitizer going crazy when
hitting the signal handler in test 1238 and 1242 (TFTP):
```
WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=12582)
    #0 malloc <null> (servers+0x5ed70)
    #1 _IO_file_doallocate <null> (libc.so.6+0x851b4)
    #2 formatf /home/runner/work/curl/curl/bld/tests/server/../../lib/../../lib/mprintf.c:886:9 (servers+0xdff77)
[...]
WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=12582)
    #0 free <null> (servers+0x5f453)
    #1 fclose <null> (libc.so.6+0x8532f)
    #2 logmsg /home/runner/work/curl/curl/bld/tests/server/../../../tests/server/util.c:134:5 (servers+0xe684d)
```
Ref: https://github.com/curl/curl/actions/runs/14118903372/job/39555309490?pr=16851

Closes #16852
2025-03-28 12:02:38 +01:00
.circleci GHA/linux: enable wolfSSH in a wolfSSL job 2025-01-17 00:20:54 +01:00
.github GHA/linux: move pytests to non-valgrind job variants, drop 2 redundant runs 2025-03-28 01:25:48 +01:00
CMake cmake: replace CMAKE_COMPILER_IS_GNUCC with CMAKE_C_COMPILER_ID 2025-03-23 00:06:25 +01:00
docs docs: add rustls --ca-native & CURLSSLOPT_NATIVE_CA 2025-03-27 22:54:24 +01:00
include cmake: fix clang-tidy builds to verify tests, fix fallouts 2025-03-24 10:14:58 +01:00
lib tests/server: make the signal handler signal-safe 2025-03-28 12:02:38 +01:00
LICENSES copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
m4 build: do not apply curl debug macros to tests/server by default 2025-03-14 12:59:32 +01:00
packages core: stop redefining E* macros on Windows, map EACCES, related fixes 2025-03-13 00:03:25 +01:00
plan9 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
projects curltime: use libcurl time functions in src and tests/server 2025-03-12 11:33:26 +01:00
scripts configure: tidy up shell completion rules 2025-03-26 15:31:54 +01:00
src tests/server: make the signal handler signal-safe 2025-03-28 12:02:38 +01:00
tests tests/server: make the signal handler signal-safe 2025-03-28 12:02:38 +01:00
winbuild curltime: use libcurl time functions in src and tests/server 2025-03-12 11:33:26 +01:00
.dir-locals.el copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.git-blame-ignore-revs copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
.gitattributes winbuild: MS-DOS batch tidy-ups 2024-07-02 19:26:15 +02:00
.gitignore tidy-up: .gitignore lines mostly 2025-01-27 20:59:46 +01:00
.mailmap ECH: update APIs to those agreed with OpenSSL maintainers 2025-01-10 08:36:25 +01:00
acinclude.m4 configure: silence compiler warnings in feature checks, drop duplicates 2025-02-21 13:59:51 +01:00
appveyor.sh runtests: drop logic calling the handle tool (Windows) 2025-03-19 18:49:54 +01:00
appveyor.yml appveyor: run VS2008 job with old CMake 3.12.2 2025-02-27 12:11:08 +01:00
buildconf copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
CHANGES.md CHANGES: rename to CHANGES.md, no longer generated 2024-08-01 13:37:12 +02:00
CMakeLists.txt rustls: support ECH GREASE 2025-03-27 08:47:51 +01:00
configure.ac runtests: generate certs dynamically, bump to EC-256, tidy up 2025-03-27 10:21:57 +01:00
COPYING COPYING: bump copyright year range to 1996 - 2025 2025-01-01 21:12:12 +01:00
curl-config.in curl-config: tidy up, optimize 2024-12-24 01:21:38 +01:00
Dockerfile docker: update debian:bookworm-slim Docker digest to ceac69a 2025-03-03 08:58:32 +01:00
GIT-INFO.md build: drop tool_hugehelp.c.cvs, tidy up macros, drop buildconf.bat 2025-01-26 14:22:49 +01:00
libcurl.pc.in configure: do not echo most inherited LDFLAGS to config files 2024-11-14 09:55:45 +01:00
Makefile.am cmake: add pre-fill for Unix, enable in GHA/macos, verify pre-fills 2025-02-16 01:59:59 +01:00
README docs: minor grammar fixes 2022-09-29 10:44:12 +02:00
README.md docs: use lowercase curl and libcurl 2025-01-02 17:15:54 +01:00
RELEASE-NOTES RELEASE-NOTES: synced 2025-03-26 07:54:09 +01:00
renovate.json GHA: drop "3" from openssl names and keys 2024-10-23 19:36:03 +02:00
REUSE.toml projects/Windows: remove wolfSSL from legacy projects 2024-12-22 03:10:35 -05:00
SECURITY.md docs: Clarify OpenSSF Best Practices vs Scorecard 2024-08-22 11:50:20 +02:00

curl logo

curl is a command-line tool for transferring data specified with URL syntax. Learn how to use curl by reading the manpage or everything curl.

Find out how to install curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl manpage to learn how.

Open Source

curl is Open Source and is distributed under an MIT-like license.

Contact

Contact us on a suitable mailing list or use GitHub issues/ pull requests/ discussions.

All contributors to the project are listed in the THANKS document.

Commercial support

For commercial support, maybe private and dedicated help with your problems or applications using (lib)curl visit the support page.

Website

Visit the curl website for the latest news and downloads.

Source code

Download the latest source from the Git server:

git clone https://github.com/curl/curl.git

Security problems

Report suspected security problems via our HackerOne page and not in public.

Notice

curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.

Backers

Thank you to all our backers 🙏 Become a backer.

Sponsors

Support this project by becoming a sponsor.