summaryrefslogtreecommitdiff
path: root/lib/multi.c
Commit message (Collapse)AuthorAgeFilesLines
...
* multi: avoid double-freeDaniel Stenberg2018-10-191-9/+4
| | | | | | | | | | | Curl_follow() no longer frees the string. Make sure it happens in the caller function, like we normally handle allocations. This bug was introduced with the use of the URL API internally, it has never been in a release version Reported-by: Dario Weißer Closes #3149
* multi: make the closure handle "inherit" CURLOPT_NOSIGNALDaniel Stenberg2018-10-191-0/+2
| | | | | | | | Otherwise, closing that handle can still cause surprises! Reported-by: Martin Ankerl Fixes #3138 Closes #3147
* Curl_follow: Always free the passed new URLMichael Kaufmann2018-10-131-0/+1
| | | | Closes #3124
* multi: fix memory leak in content encoding related error pathDaniel Stenberg2018-09-291-3/+7
| | | | | | | | ... a missing multi_done() call. Credit to OSS-Fuzz Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10728 Closes #3063
* multi: fix location URL memleak in error pathDaniel Stenberg2018-09-281-1/+4
| | | | | Follow-up to #3044 - fix a leak OSS-Fuzz detected Closes #3057
* url: use the URL API internally as wellDaniel Stenberg2018-09-221-7/+2
| | | | | | ... to make it a truly unified URL parser. Closes #3017
* curl_multi_wait: call getsock before figuring out timeoutDaniel Stenberg2018-09-181-7/+7
| | | | | | | .... since getsock may update the expiry timer. Fixes #2996 Closes #3000
* setopt: add CURLOPT_DOH_URLDaniel Stenberg2018-09-061-12/+18
| | | | Closes #2668
* multiplex: enable by defaultDaniel Stenberg2018-09-051-0/+1
| | | | Starting 7.62.0, multiplexing is enabled by default in multi handles.
* pipelining: deprecatedDaniel Stenberg2018-09-051-1/+1
| | | | | | | | | | | | Transparently. The related curl_multi_setopt() options all still returns OK when pipelining is selected. To re-enable the support, the single line change in lib/multi.c needs to be reverted. See docs/DEPRECATE.md Closes #2705
* upload: allocate upload buffer on-demandDaniel Stenberg2018-08-181-0/+3
| | | | | | | Saves 16KB on the easy handle for operations that don't need that buffer. Part 1 of #2888
* urldata: remove unused pipe_broke struct fieldDaniel Stenberg2018-08-161-25/+3
| | | | | | | This struct field is never set TRUE in any existing code path. This change removes the field completely. Closes #2871
* retry: return error if rewind was necessary but didn't happenDaniel Jelinski2018-07-311-0/+2
| | | | | Fixes #2801 Closes #2812
* multi: always do the COMPLETED procedure/stateDaniel Stenberg2018-07-111-23/+30
| | | | | | | | | | | It was previously erroneously skipped in some situations. libtest/libntlmconnect.c wrongly depended on wrong behavior (that it would get a zero timeout) when no handles are "running" in a multi handle. That behavior is no longer present with this fix. Now libcurl will always return a -1 timeout when all handles are completed. Closes #2733
* conn: remove the boolean 'inuse' fieldDaniel Stenberg2018-07-111-21/+27
| | | | ... as the usage needs to be counted.
* multi: fix crash due to dangling entry in connect-pending listJavier Blazquez2018-06-231-0/+5
| | | | | Fixes #2677 Closes #2679
* multi: fix memory leak when stopped during name resolveDaniel Stenberg2018-06-161-11/+23
| | | | | | | | | | | | When the application just started the transfer and then stops it while the name resolve in the background thread hasn't completed, we need to wait for the resolve to complete and then cleanup data accordingly. Enabled test 1553 again and added test 1590 to also check when the host name resolves successfully. Detected by OSS-fuzz. Closes #1968
* cppcheck: fix warningsMarian Klymov2018-06-111-4/+3
| | | | | | | | | | | | | - Get rid of variable that was generating false positive warning (unitialized) - Fix issues in tests - Reduce scope of several variables all over etc Closes #2631
* spelling fixesViktor Szakats2018-06-031-1/+1
| | | | | | Detected using the `codespell` tool (version 1.13.0). Also secure and fix an URL.
* multi: remove a DEBUGF()Daniel Stenberg2018-06-011-2/+0
| | | | | | | | ... it might call infof() with a NULL first argument that isn't harmful but makes it not do anything. The infof() line is not very useful anymore, it has served it purpose. Good riddance! Fixes #2627
* strictness: correct {infof, failf} format specifiersRikard Falkeborn2018-05-311-2/+2
| | | | Closes #2623
* psl: use latest psl and refresh it periodicallyPatrick Monnerat2018-05-281-0/+21
| | | | | | | | | | | 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
* checksrc: force indentation of lines after an elseDaniel Gustafsson2018-04-271-2/+1
| | | | | | | | This extends the INDENTATION case to also handle 'else' statements and require proper indentation on the following line. Also fixes the offending cases found in the codebase. Closes #2532
* http2: handle GOAWAY properlyDaniel Stenberg2018-04-201-1/+3
| | | | | | | | | | When receiving REFUSED_STREAM, mark the connection for close and retry streams accordingly on another/fresh connection. Reported-by: Terry Wu Fixes #2416 Fixes #1618 Closes #2510
* add_handle/easy_perform: clear errorbuffer on start if setDaniel Stenberg2018-03-171-0/+2
| | | | | | | | | | To offer applications a more defined behavior, we clear the buffer as early as possible. Assisted-by: Jay Satiro Fixes #2190 Closes #2377
* multi: improved pending transfers handling => improved performanceDaniel Stenberg2018-03-161-25/+21
| | | | | | | | | | | | | | | | When a transfer is requested to get done and it is put in the pending queue when limited by number of connections, total or per-host, libcurl would previously very aggressively retry *ALL* pending transfers to get them transferring. That was very time consuming. By reducing the aggressiveness in how pending are being retried, we waste MUCH less time on putting transfers back into pending again. Some test cases got a factor 30(!) speed improvement with this change. Reported-by: Cyril B Fixes #2369 Closes #2383
* pause: when changing pause state, update socket stateDaniel Stenberg2018-03-161-0/+6
| | | | | | | | | | | | Especially unpausing a transfer might have to move the socket back to the "currently used sockets" hash to get monitored. Otherwise it would never get any more data and get stuck. Easily triggered with pausing using the multi_socket API. Reported-by: Philip Prindeville Bug: https://curl.haxx.se/mail/lib-2018-03/0048.html Fixes #2393 Closes #2391
* rate-limit: use three second window to better handle high speedsDaniel Stenberg2018-03-161-13/+18
| | | | | | | | | | | | | | | Due to very frequent updates of the rate limit "window", it could attempt to rate limit within the same milliseconds and that then made the calculations wrong, leading to it not behaving correctly on very fast transfers. This new logic updates the rate limit "window" to be no shorter than the last three seconds and only updating the timestamps for this when switching between the states TOOFAST/PERFORM. Reported-by: 刘佩东 Fixes #2386 Closes #2388
* http2: mark the connection for close on GOAWAYDaniel Stenberg2018-03-121-6/+3
| | | | | | | | | ... don't consider it an error! Assisted-by: Jay Satiro Reported-by: Łukasz Domeradzki Fixes #2365 Closes #2375
* TODO fixed: Detect when called from within callbacksBjörn Stenberg2018-02-151-6/+59
| | | | Closes #2302
* http2: don't close connection when single transfer is stoppedKartik Mahajan2018-01-181-1/+2
| | | | | Fixes #2237 Closes #2249
* multi_done: prune DNS cacheDaniel Stenberg2017-12-101-0/+1
| | | | | | | | | | | | | Prune the DNS cache immediately after the dns entry is unlocked in multi_done. Timed out entries will then get discarded in a more orderly fashion. Test506 is updated Reported-by: Oleg Pudeyev Fixes #2169 Closes #2170
* conncache: fix several lock issuesDaniel Stenberg2017-12-051-42/+14
| | | | | | | | | If the lock is released before the dealings with the bundle is over, it may have changed by another thread in the mean time. Fixes #2132 Fixes #2151 Closes #2139
* share: add support for sharing the connection cacheDaniel Stenberg2017-11-091-53/+9
|
* Curl_timeleft: change return type to timediff_tDaniel Stenberg2017-10-281-1/+1
| | | | | | | | returning 'time_t' is problematic when that type is unsigned and we return values less than zero to signal "already expired", used in several places in the code. Closes #2021
* wildcards: don't use with non-supported protocolsMax Dymond2017-10-261-2/+8
| | | | | | Fixes timeouts in the fuzzing tests for non-FTP protocols. Closes #2016
* multi: allow table handle sizes to be overriddenMax Dymond2017-10-251-0/+2
| | | | | | | Allow users to specify their own hash define for CURL_CONNECTION_HASH_SIZE so that both values can be overridden. Closes #1982
* time: rename Curl_tvnow to Curl_nowDaniel Stenberg2017-10-251-6/+6
| | | | | | | | | | ... since the 'tv' stood for timeval and this function does not return a timeval struct anymore. Also, cleaned up the Curl_timediff*() functions to avoid typecasts and clean up the descriptive comments. Closes #2011
* timediff: return timediff_t from the time diff functionsDaniel Stenberg2017-10-251-10/+14
| | | | | | | | | | | | | | | ... to cater for systems with unsigned time_t variables. - Renamed the functions to curlx_timediff and Curl_timediff_us. - Added overflow protection for both of them in either direction for both 32 bit and 64 bit time_ts - Reprefixed the curlx_time functions to use Curl_* Reported-by: Peter Piekarski Fixes #2004 Closes #2005
* Revert "multi_done: wait for name resolve to finish if still ongoing"Daniel Stenberg2017-10-081-6/+0
| | | | | | | | | This reverts commit f3e03f6c0ac52a1bf396e03f7d7e9b5b3b7165fe. Caused memory leaks in the fuzzer, needs to be done differently. Disable test 1553 for now too, as it causes memory leaks without this commit!
* remove_handle: call multi_done() first, then clear dns cache pointerDaniel Stenberg2017-10-071-6/+7
| | | | Closes #1960
* multi_done: wait for name resolve to finish if still ongoingDaniel Stenberg2017-10-071-0/+6
| | | | ... as we must clean up memory.
* multi_cleanup: call DONE on handles that never got thatDaniel Stenberg2017-10-061-18/+21
| | | | | | | | | | | ... fixes a memory leak with at least IMAP when remove_handle is never called and the transfer is abruptly just abandoned early. Test 1552 added to verify Detected by OSS-fuzz Assisted-by: Max Dymond Closes #1954
* code style: use spaces around plusesDaniel Stenberg2017-09-111-1/+1
|
* code style: use spaces around equals signsDaniel Stenberg2017-09-111-30/+30
|
* multi: fix request timer managementBrad Spencer2017-08-011-14/+13
| | | | | | | | | | | | | There are some bugs in how timers are managed for a single easy handle that causes the wrong "next timeout" value to be reported to the application when a new minimum needs to be recomputed and that new minimum should be an existing timer that isn't currently set for the easy handle. When the application drives a set of easy handles via the `curl_multi_socket_action()` API (for example), it gets told to wait the wrong amount of time before the next call, which causes requests to linger for a long time (or, it is my guess, possibly forever). Bug: https://curl.haxx.se/mail/lib-2017-07/0033.html
* timeval: struct curltime is a struct timeval replacementDaniel Stenberg2017-07-281-15/+15
| | | | | | | | | ... 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
* multi: mention integer overflow risk if using > 500 million socketsDaniel Stenberg2017-07-271-0/+4
| | | | | | | Reported-by: ovidiu-benea@users.noreply.github.com Closes #1675 Closes #1683
* http-proxy: do the HTTP CONNECT process entirely non-blockingDaniel Stenberg2017-06-141-5/+13
| | | | | | | Mentioned as a problem since 2007 (8f87c15bdac63) and of course it existed even before that. Closes #1547
* expire: remove Curl_expire_latest()Daniel Stenberg2017-06-081-50/+6
| | | | | | | | | | | | | | | | | With the introduction of expire IDs and the fact that existing timers can be removed now and thus never expire, the concept with adding a "latest" timer is not working anymore as it risks to not expire at all. So, to be certain the timers actually are in line and will expire, the plain Curl_expire() needs to be used. The _latest() function was added as a sort of shortcut in the past that's quite simply not necessary anymore. Follow-up to 31b39c40cf90 Reported-by: Paul Harris Closes #1555