Go to file
Stefan Eissing 47f5b1a37f
lib: introduce struct easy_poll_set for poll information
Connection filter had a `get_select_socks()` method, inspired by the
various `getsocks` functions involved during the lifetime of a
transfer. These, depending on transfer state (CONNECT/DO/DONE/ etc.),
return sockets to monitor and flag if this shall be done for POLLIN
and/or POLLOUT.

Due to this design, sockets and flags could only be added, not
removed. This led to problems in filters like HTTP/2 where flow control
prohibits the sending of data until the peer increases the flow
window. The general transfer loop wants to write, adds POLLOUT, the
socket is writeable but no data can be written.

This leads to cpu busy loops. To prevent that, HTTP/2 did set the
`SEND_HOLD` flag of such a blocked transfer, so the transfer loop cedes
further attempts. This works if only one such filter is involved. If a
HTTP/2 transfer goes through a HTTP/2 proxy, two filters are
setting/clearing this flag and may step on each other's toes.

Connection filters `get_select_socks()` is replaced by
`adjust_pollset()`. They get passed a `struct easy_pollset` that keeps
up to `MAX_SOCKSPEREASYHANDLE` sockets and their `POLLIN|POLLOUT`
flags. This struct is initialized in `multi_getsock()` by calling the
various `getsocks()` implementations based on transfer state, as before.

After protocol handlers/transfer loop have set the sockets and flags
they want, the `easy_pollset` is *always* passed to the filters. Filters
"higher" in the chain are called first, starting at the first
not-yet-connection one. Each filter may add sockets and/or change
flags. When all flags are removed, the socket itself is removed from the
pollset.

Example:

 * transfer wants to send, adds POLLOUT
 * http/2 filter has a flow control block, removes POLLOUT and adds
   POLLIN (it is waiting on a WINDOW_UPDATE from the server)
 * TLS filter is connected and changes nothing
 * h2-proxy filter also has a flow control block on its tunnel stream,
   removes POLLOUT and adds POLLIN also.
 * socket filter is connected and changes nothing
 * The resulting pollset is then mixed together with all other transfers
   and their pollsets, just as before.

Use of `SEND_HOLD` is no longer necessary in the filters.

All filters are adapted for the changed method. The handling in
`multi.c` has been adjusted, but its state handling the the protocol
handlers' `getsocks` method are untouched.

The most affected filters are http/2, ngtcp2, quiche and h2-proxy. TLS
filters needed to be adjusted for the connecting handshake read/write
handling.

No noticeable difference in performance was detected in local scorecard
runs.

Closes #11833
2023-10-25 09:34:32 +02:00
.circleci CI: run Circle macOS builds on x86 for now 2023-09-05 22:53:40 -07:00
.github GHA: move mod_h2 version in CI to v2.0.25 2023-10-19 16:51:59 +02:00
.reuse tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
CMake cmake: pre-fill rest of detection values for Windows 2023-10-24 21:06:36 +00:00
docs page-footer: clarify exit code 25 2023-10-24 03:51:28 -04:00
include RELEASE-NOTES: synced 2023-10-22 10:58:08 +02:00
lib lib: introduce struct easy_poll_set for poll information 2023-10-25 09:34:32 +02:00
LICENSES
m4 cmake: pre-fill rest of detection values for Windows 2023-10-24 21:06:36 +00:00
packages spelling: fix codespell 2.2.6 typos 2023-10-03 21:37:56 +00:00
plan9
projects tidy-up: mostly whitespace nits 2023-08-31 23:02:10 +00:00
scripts scripts/cijobs.pl: adjust for appveyor 2023-10-24 09:25:19 +02:00
src tool: fix --capath when proxy support is disabled 2023-10-21 14:52:47 +02:00
tests lib: introduce struct easy_poll_set for poll information 2023-10-25 09:34:32 +02:00
winbuild build: do not publish HAVE_BORINGSSL, HAVE_AWSLC macros 2023-10-08 22:29:45 +00:00
.azure-pipelines.yml CI: move distcheck job from Azure Pipelines to GitHub Actions 2023-10-08 19:36:16 +02:00
.cirrus.yml CI: bump OpenLDAP package version on FreeBSD 2023-10-07 12:52:07 -07:00
.dcignore
.dir-locals.el
.git-blame-ignore-revs
.gitattributes
.gitignore tidy-up: mostly whitespace nits 2023-08-31 23:02:10 +00:00
.mailmap mailmap: unify Michael Osipov under a single email 2023-09-21 14:18:49 +02:00
acinclude.m4 cmake: pre-fill rest of detection values for Windows 2023-10-24 21:06:36 +00:00
appveyor.yml cmake: pre-fill rest of detection values for Windows 2023-10-24 21:06:36 +00:00
buildconf
buildconf.bat
CHANGES
CMakeLists.txt cmake: pre-fill rest of detection values for Windows 2023-10-24 21:06:36 +00:00
configure.ac cmake: pre-fill rest of detection values for Windows 2023-10-24 21:06:36 +00:00
COPYING
curl-config.in
GIT-INFO
libcurl.def curl_multi_get_handles: get easy handles from a multi handle 2023-09-25 20:16:58 +02:00
libcurl.pc.in
MacOSX-Framework
Makefile.am cmake: add support for single libcurl compilation pass 2023-08-01 08:12:26 +00:00
Makefile.dist
maketgz
README
README.md tidy-up: mostly whitespace nits 2023-08-31 23:02:10 +00:00
RELEASE-NOTES RELEASE-NOTES: synced 2023-10-22 10:58:08 +02:00
SECURITY.md SECURITY-PROCESS.md. call it vulnerability disclosure policy 2023-09-14 17:04:33 +02:00

curl logo

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. 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.3 man page to learn how.

You can find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

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.

Git

To download the latest source from the Git server, do this:

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

(you will get a directory named curl created, filled with the source code)

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.