summaryrefslogtreecommitdiff
path: root/lib/multihandle.h
Commit message (Collapse)AuthorAgeFilesLines
* openssl: avoid static variable for seed flagDaniel Stenberg2021-06-291-0/+3
| | | | | | | | | | | Avoid the race condition risk by instead storing the "seeded" flag in the multi handle. Modern OpenSSL versions handle the seeding itself so doing the seeding once per multi-handle instead of once per process is less of an issue. Reported-by: Gerrit Renker Fixes #7296 Closes #7306
* Revert "Revert 'multi: implement wait using winsock events'"Marc Hoersken2021-04-211-0/+4
| | | | | | | | | | | | | | This reverts commit 2260e0ebe6d45529495231b3e37a0c58fb92a6a2, also restoring previous follow up changes which were reverted. Authored-by: rcombs on github Authored-by: Marc Hörsken Reviewed-by: Jay Satiro Reviewed-by: Marcel Raad Restores #5634 Reverts #6281 Part of #6245
* build: remove all traces of USE_BLOCKING_SOCKETSDaniel Stenberg2021-02-251-1/+1
| | | | | | libcurl doesn't behave properly with the define set Closes #6655
* multi: rename the multi transfer statesDaniel Stenberg2021-02-161-22/+21
| | | | | | | | | | While working on documenting the states it dawned on me that step one is to use more descriptive names on the states. This also changes prefix on the states to make them shorter in the source. State names NOT ending with *ing are transitional ones. Closes #6612
* lib: drop USE_SOCKETPAIR in favor of CURL_DISABLE_SOCKETPAIRJay Satiro2021-02-091-2/+1
| | | | | | .. since the former is undocumented and they both do the same thing. Closes https://github.com/curl/curl/pull/6517
* urldata: make magic be the first struct fieldDaniel Stenberg2021-01-201-2/+2
| | | | | | | | | | | | | By making the `magic` identifier the same size and at the same place within the structs (easy, multi, share), libcurl will be able to more reliably detect and safely error out if an application passes in the wrong handle to APIs. Easier to detect and less likely to cause crashes if done. Such mixups can't be detected at compile-time due to them being typedefed void pointers - unless `CURL_STRICTER` is defined. Closes #6484
* tests/server/disabled: add "wakeup"Daniel Stenberg2020-12-111-0/+4
| | | | | To allow the test suite to know if wakeup support is disabled in the build.
* Revert "multi: implement wait using winsock events"Daniel Stenberg2020-12-061-4/+0
| | | | | | | | | | | This reverts commit d2a7d7c185f98df8f3e585e5620cbc0482e45fac. This commit also reverts the subsequent follow-ups to that commit, which were all done within windows #ifdefs that are removed in this change. Marc helped me verify this. Fixes #6146 Closes #6281
* curl.se: new homeDaniel Stenberg2020-11-041-1/+1
| | | | Closes #6172
* hash: make it 'struct Curl_hash'Daniel Stenberg2020-09-021-2/+2
| | | | | | As internal global names should use captical C. Closes #5906
* llist: make it "struct Curl_llist"Daniel Stenberg2020-09-021-3/+3
| | | | | | As internal global names should use captical C. Closes #5906
* socketpair: allow CURL_DISABLE_SOCKETPAIRDaniel Stenberg2020-08-261-2/+2
| | | | | | ... to completely disable the use of socketpair Closes #5850
* multi: implement wait using winsock eventsrcombs2020-08-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids using a pair of TCP ports to provide wakeup functionality for every multi instance on Windows, where socketpair() is emulated using a TCP socket on loopback which could in turn lead to socket resource exhaustion. A previous version of this patch failed to account for how in WinSock, FD_WRITE is set only once when writing becomes possible and not again until after a send has failed due to the buffer filling. This contrasts to how FD_READ and FD_OOB continue to be set until the conditions they refer to no longer apply. This meant that if a user wrote some data to a socket, but not enough data to completely fill its send buffer, then waited on that socket to become writable, we'd erroneously stall until their configured timeout rather than returning immediately. This version of the patch addresses that issue by checking each socket we're waiting on to become writable with select() before the wait, and zeroing the timeout if it's already writable. Assisted-by: Marc Hörsken Reviewed-by: Marcel Raad Reviewed-by: Daniel Stenberg Tested-by: Gergely Nagy Tested-by: Rasmus Melchior Jacobsen Tested-by: Tomas Berger Replaces #5397 Reverts #5632 Closes #5634
* multi: update comment to say easyp list is linearJonathan Nieder2020-07-281-1/+1
| | | | | | | | | Since 09b9fc900 (multi: remove 'Curl_one_easy' struct, phase 1, 2013-08-02), the easy handle list is not circular but ends with ->next pointing to NULL. Reported-by: Masaya Suzuki <masayasuzuki@google.com> Closes #5737
* Revert "multi: implement wait using winsock events"Daniel Stenberg2020-06-301-4/+0
| | | | | | | | | | This reverts commit 8bc25c590e530de87595d1bb3577f699eb1309b9. That commit (from #5397) introduced a regression in 7.71.0. Reported-by: tmkk on github Fixes #5631 Closes #5632
* multi: implement wait using winsock eventsrcombs2020-06-171-0/+4
| | | | | | | | | | | | This avoids using a pair of TCP ports to provide wakeup functionality for every multi instance on Windows, where socketpair() is emulated using a TCP socket on loopback which could in turn lead to socket resource exhaustion. Reviewed-by: Gergely Nagy Reviewed-by: Marc Hörsken Closes #5397
* global_init: move the IPv6 works status bool to multi handleDaniel Stenberg2020-01-281-6/+5
| | | | | | | | | Previously it was stored in a global state which contributed to curl_global_init's thread unsafety. This boolean is now instead figured out in curl_multi_init() and stored in the multi handle. Less effective, but thread safe. Closes #4851
* ConnectionExists: respect the max_concurrent_streams limitsDaniel Stenberg2020-01-131-1/+1
| | | | | | | | | | | | | | | A regression made the code use 'multiplexed' as a boolean instead of the counter it is intended to be. This made curl try to "over-populate" connections with new streams. This regression came with 41fcdf71a1, shipped in curl 7.65.0. Also, respect the CURLMOPT_MAX_CONCURRENT_STREAMS value in the same check. Reported-by: Kunal Ekawde Fixes #4779 Closes #4784
* multi.h: move INITIAL_MAX_CONCURRENT_STREAMS from public headerDaniel Stenberg2020-01-061-1/+5
| | | | | | | ... to the private multihhandle.h. It is not for public use and it wasn't prefixed correctly anyway! Closes #4790
* multi: add curl_multi_wakeup()Gergely Nagy2019-11-251-0/+10
| | | | | | | | | | | | This commit adds curl_multi_wakeup() which was previously in the TODO list under the curl_multi_unblock name. On some platforms and with some configurations this feature might not be available or can fail, in these cases a new error code (CURLM_WAKEUP_FAILURE) is returned from curl_multi_wakeup(). Fixes #4418 Closes #4608
* CURLMOPT_MAX_CONCURRENT_STREAMS: new setoptKunal Ekawde2019-10-021-0/+1
| | | | Closes #4410
* pipelining: removedDaniel Stenberg2019-04-061-34/+14
| | | | | | | As previously planned and documented in DEPRECATE.md, all pipelining code is removed. Closes #3651
* psl: use latest psl and refresh it periodicallyPatrick Monnerat2018-05-281-1/+7
| | | | | | | | | | | The latest psl is cached in the multi or share handle. It is refreshed before use after 72 hours. New share lock CURL_LOCK_DATA_PSL controls the psl cache sharing. If the latest psl is not available, the builtin psl is used. Reported-by: Yaakov Selkowitz Fixes #2553 Closes #2601
* TODO fixed: Detect when called from within callbacksBjörn Stenberg2018-02-151-0/+1
| | | | Closes #2302
* share: add support for sharing the connection cacheDaniel Stenberg2017-11-091-4/+0
|
* timeval: struct curltime is a struct timeval replacementDaniel Stenberg2017-07-281-1/+1
| | | | | | | | | ... to make all libcurl internals able to use the same data types for the struct members. The timeval struct differs subtly on several platforms so it makes it cumbersome to use everywhere. Ref: #1652 Closes #1693
* llist: no longer uses mallocDaniel Stenberg2017-04-221-0/+1
| | | | | | | | | | | | The 'list element' struct now has to be within the data that is being added to the list. Removes 16.6% (tiny) mallocs from a simple HTTP transfer. (96 => 80) Also removed return codes since the llist functions can't fail now. Test 1300 updated accordingly. Closes #1435
* llist: replace Curl_llist_alloc with Curl_llist_initDaniel Stenberg2017-04-041-8/+8
| | | | | | | | No longer allocate the curl_llist head struct for lists separately. Removes 17 (15%) tiny allocations in a normal "curl localhost" invoke. closes #1381
* proxy: Support HTTPS proxy and SOCKS+HTTP(s)Alex Rousskov2016-11-241-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * HTTPS proxies: An HTTPS proxy receives all transactions over an SSL/TLS connection. Once a secure connection with the proxy is established, the user agent uses the proxy as usual, including sending CONNECT requests to instruct the proxy to establish a [usually secure] TCP tunnel with an origin server. HTTPS proxies protect nearly all aspects of user-proxy communications as opposed to HTTP proxies that receive all requests (including CONNECT requests) in vulnerable clear text. With HTTPS proxies, it is possible to have two concurrent _nested_ SSL/TLS sessions: the "outer" one between the user agent and the proxy and the "inner" one between the user agent and the origin server (through the proxy). This change adds supports for such nested sessions as well. A secure connection with a proxy requires its own set of the usual SSL options (their actual descriptions differ and need polishing, see TODO): --proxy-cacert FILE CA certificate to verify peer against --proxy-capath DIR CA directory to verify peer against --proxy-cert CERT[:PASSWD] Client certificate file and password --proxy-cert-type TYPE Certificate file type (DER/PEM/ENG) --proxy-ciphers LIST SSL ciphers to use --proxy-crlfile FILE Get a CRL list in PEM format from the file --proxy-insecure Allow connections to proxies with bad certs --proxy-key KEY Private key file name --proxy-key-type TYPE Private key file type (DER/PEM/ENG) --proxy-pass PASS Pass phrase for the private key --proxy-ssl-allow-beast Allow security flaw to improve interop --proxy-sslv2 Use SSLv2 --proxy-sslv3 Use SSLv3 --proxy-tlsv1 Use TLSv1 --proxy-tlsuser USER TLS username --proxy-tlspassword STRING TLS password --proxy-tlsauthtype STRING TLS authentication type (default SRP) All --proxy-foo options are independent from their --foo counterparts, except --proxy-crlfile which defaults to --crlfile and --proxy-capath which defaults to --capath. Curl now also supports %{proxy_ssl_verify_result} --write-out variable, similar to the existing %{ssl_verify_result} variable. Supported backends: OpenSSL, GnuTLS, and NSS. * A SOCKS proxy + HTTP/HTTPS proxy combination: If both --socks* and --proxy options are given, Curl first connects to the SOCKS proxy and then connects (through SOCKS) to the HTTP or HTTPS proxy. TODO: Update documentation for the new APIs and --proxy-* options. Look for "Added in 7.XXX" marks.
* internals: rename the SessionHandle struct to Curl_easyDaniel Stenberg2016-06-221-4/+4
|
* URLs: change all http:// URLs to https://Daniel Stenberg2016-02-031-1/+1
|
* http2: initial implementation of the push callbackDaniel Stenberg2015-06-241-0/+4
|
* http2: set default concurrency, fix ConnectionExists for multiplexDaniel Stenberg2015-05-181-1/+2
|
* CURLMOPT_PIPELINE: bit 1 is for multiplexingDaniel Stenberg2015-05-181-2/+4
|
* hostcache: made all host caches use structs, not pointersDaniel Stenberg2015-05-121-1/+1
| | | | | | This avoids unnecessary dynamic allocs and as this also removed the last users of *hash_alloc() and *hash_destroy(), those two functions are now removed.
* multi: converted socket hash into non-allocated structDaniel Stenberg2015-05-121-1/+1
| | | | avoids extra dynamic allocation
* connection cache: avoid Curl_hash_alloc()Daniel Stenberg2015-05-121-1/+3
| | | | | ... by using plain structs instead of pointers for the connection cache, we can avoid several dynamic allocations that weren't necessary.
* multi: fix *getsock() with CONNECTDaniel Stenberg2015-03-071-15/+16
| | | | | | | | | | | | The code used some happy eyeballs logic even _after_ CONNECT has been sent to a proxy, while the happy eyeball phase is already (should be) over by then. This is solved by splitting the multi state into two separate states introducing the new SENDPROTOCONNECT state. Bug: http://curl.haxx.se/mail/lib-2015-01/0170.html Reported-by: Peter Laser
* multi: convert CURLM_STATE_CONNECT_PEND handling to a listDaniel Stenberg2014-09-021-1/+4
| | | | | | | | | | | | | | ... instead of scanning through all handles, stash only the actual handles that are in that state in the new ->pending list and scan that list only. It should be mostly empty or very short. And only used for pipelining. This avoids a rather hefty slow-down especially notable if you add many handles to the same multi handle. Regression introduced in commit 0f147887 (version 7.30.0). Bug: http://curl.haxx.se/mail/lib-2014-07/0206.html Reported-by: David Meyer
* multi: rename all Curl_one_easy to SessionHandleDaniel Stenberg2013-08-031-4/+2
|
* multi: remove 'Curl_one_easy' struct, phase 1Daniel Stenberg2013-08-031-21/+3
| | | | | | | | | | | | | | | | | | | | | The motivation for having a separate struct that keep track of an easy handle when using the multi handle was removed when we switched to always using the multi interface internally. Now they were just two separate struct that was always allocated for each easy handle. This first step just moves the Curl_one_easy struct members into the SessionHandle struct and hides this somehow (== keeps the source code changes to a minimum) by defining Curl_one_easy to SessionHandle The biggest changes in this commit are: 1 - the linked list of easy handles had to be changed somewhat due to the new struct layout. This made the main linked list pointer get renamed to 'easyp' and there's also a new pointer to the last node, called easylp. It is no longer circular but ends with ->next pointing to NULL. New nodes are still added last. 2 - easy->state is now called easy->mstate to avoid name collision
* Multiple pipelines and limiting the number of connections.Linus Nielsen Feltzing2013-03-131-19/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introducing a number of options to the multi interface that allows for multiple pipelines to the same host, in order to optimize the balance between the penalty for opening new connections and the potential pipelining latency. Two new options for limiting the number of connections: CURLMOPT_MAX_HOST_CONNECTIONS - Limits the number of running connections to the same host. When adding a handle that exceeds this limit, that handle will be put in a pending state until another handle is finished, so we can reuse the connection. CURLMOPT_MAX_TOTAL_CONNECTIONS - Limits the number of connections in total. When adding a handle that exceeds this limit, that handle will be put in a pending state until another handle is finished. The free connection will then be reused, if possible, or closed if the pending handle can't reuse it. Several new options for pipelining: CURLMOPT_MAX_PIPELINE_LENGTH - Limits the pipeling length. If a pipeline is "full" when a connection is to be reused, a new connection will be opened if the CURLMOPT_MAX_xxx_CONNECTIONS limits allow it. If not, the handle will be put in a pending state until a connection is ready (either free or a pipe got shorter). CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE - A pipelined connection will not be reused if it is currently processing a transfer with a content length that is larger than this. CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE - A pipelined connection will not be reused if it is currently processing a chunk larger than this. CURLMOPT_PIPELINING_SITE_BL - A blacklist of hosts that don't allow pipelining. CURLMOPT_PIPELINING_SERVER_BL - A blacklist of server types that don't allow pipelining. See the curl_multi_setopt() man page for details.
* always-multi: always use non-blocking internalsDaniel Stenberg2013-01-171-0/+134
Remove internal separated behavior of the easy vs multi intercace. curl_easy_perform() is now using the multi interface itself. Several minor multi interface quirks and bugs have been fixed in the process. Much help with debugging this has been provided by: Yang Tse