To contain the logic of checking for both `EWOULDBLOCK` and/or `EAGAIN` depending on platform/availability. Also to avoid checking for both if they mapp to the same value, and to avoid PP guards around use. This also ensures `EAGAIN` is consistently not checked on Windows, where headers defined it, but `SOCKERRNO` never returns it, because curl maps it to `WSAGetLastError()`. If they map to the same value, checking them both in an `if` expression trips GCC warning `-Wlogical-op` (the same way it triggers duplicate case value error in `switch`). Also: - replace two `switch()` statements with the new macro. - tests/server/sws: make two outliers use the new macro that were only checking for `EWOULDBLOCK` before this patch, in `connect_to()`. - move variables to the left-side of expressions, where missing. - rustls: use a variant of this macro that uses raw `EWOULDBLOCK`. Tried tracing it back to the origins, but I couldn't figure out if this is working as expected on all supported Windows versions in Rust. It seems to be using `GetLastError()`, according to https://docs.rs/system_error/0.2.0/system_error/, which would be probably incorrect. Notes: - it's probably a good idea to assign `SOCKERRNO` to a variable before passing it to this macro. Cherry-picked from #21893 Closes #21992 |
||
|---|---|---|
| .circleci | ||
| .github | ||
| CMake | ||
| docs | ||
| include | ||
| lib | ||
| LICENSES | ||
| m4 | ||
| projects | ||
| scripts | ||
| src | ||
| tests | ||
| .clang-tidy.yml | ||
| .dir-locals.el | ||
| .editorconfig | ||
| .git-blame-ignore-revs | ||
| .gitattributes | ||
| .gitignore | ||
| .mailmap | ||
| acinclude.m4 | ||
| appveyor.sh | ||
| appveyor.yml | ||
| CHANGES.md | ||
| CMakeLists.txt | ||
| configure.ac | ||
| COPYING | ||
| curl-config.in | ||
| Dockerfile | ||
| GIT-INFO.md | ||
| libcurl.pc.in | ||
| Makefile.am | ||
| README | ||
| README.md | ||
| RELEASE-NOTES | ||
| renovate.json | ||
| REUSE.toml | ||
| SECURITY.md | ||
curl is a command-line tool for transferring data from or to a server using URLs. It supports these protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, MQTTS, POP3, POP3S, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS.
Learn how to use curl by reading the man page 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 man page 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
Security problems
Report suspected security problems privately and not in public.
Backers
Thank you to all our backers 🙏 Become a backer.
Sponsors
Support this project by becoming a sponsor.