summaryrefslogtreecommitdiff
path: root/lib/easy.c
Commit message (Collapse)AuthorAgeFilesLines
* easy: use a custom implementation of wcsdup on WindowsJeff Mears2021-08-091-1/+1
| | | | | | | ... so that malloc/free overrides from curl_global_init are used for wcsdup correctly. Closes #7540
* easy: during upkeep, attach Curl_easy to connections in the cacheJosie Huddleston2021-07-171-1/+8
| | | | | | | | | | | | | | During the protocol-specific parts of connection upkeep, some code assumes that the data->conn pointer already is set correctly. However, there's currently no guarantee of that in the code. This fix temporarily attaches each connection to the Curl_easy object before performing the protocol-specific connection check on it, in a similar manner to the connection checking in extract_if_dead(). Fixes #7386 Closes #7387 Reported-by: Josie Huddleston
* infof: remove newline from format strings, always append itDaniel Stenberg2021-07-071-5/+5
| | | | | | | | | | | | | | | | - the data needs to be "line-based" anyway since it's also passed to the debug callback/application - it makes infof() work like failf() and consistency is good - there's an assert that triggers on newlines in the format string - Also removes a few instances of "..." - Removes the code that would append "..." to the end of the data *iff* it was truncated in infof() Closes #7357
* dupset: remove totally off commentDaniel Stenberg2021-05-151-1/+0
| | | | Closes #7067
* easy: ignore sigpipe in curl_easy_sendDaniel Stenberg2021-04-261-0/+3
| | | | Closes #6965
* tidy-up: make conditional checks more consistentDaniel Stenberg2021-04-221-1/+1
| | | | | | ... remove '== NULL' and '!= 0' Closes #6912
* hsts: enable by defaultDaniel Stenberg2021-04-191-1/+1
| | | | | | No longer considered experimental. Closes #6700
* urldata: merge "struct DynamicStatic" into "struct UrlState"Daniel Stenberg2021-03-261-17/+17
| | | | | | | | Both were used for the same purposes and there was no logical separation between them. Combined, this also saves 16 bytes in less holes in my test build. Closes #6798
* multi: rename the multi transfer statesDaniel Stenberg2021-02-161-2/+2
| | | | | | | | | | 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: remove 'conn->data' completelyDaniel Stenberg2021-02-161-12/+0
| | | | | | | | The Curl_easy pointer struct entry in connectdata is now gone. Just before commit 215db086e0 landed on January 8, 2021 there were 919 references to conn->data. Closes #6608
* hostip: remove conn->data from resolver functionsDaniel Stenberg2021-01-221-2/+2
| | | | | | | This also moves the 'async' struct from the connectdata struct into the Curl_easy struct, which seems like a better home for it. Closes #6497
* lib: pass in 'struct Curl_easy *' to most functionsDaniel Stenberg2021-01-171-7/+17
| | | | | | | | | | | | | | | | | | | | | ... in most cases instead of 'struct connectdata *' but in some cases in addition to. - We mostly operate on transfers and not connections. - We need the transfer handle to log, store data and more. Everything in libcurl is driven by a transfer (the CURL * in the public API). - This work clarifies and separates the transfers from the connections better. - We should avoid "conn->data". Since individual connections can be used by many transfers when multiplexing, making sure that conn->data points to the current and correct transfer at all times is difficult and has been notoriously error-prone over the years. The goal is to ultimately remove the conn->data pointer for this reason. Closes #6425
* global_init: debug builds allocates a byte in initDaniel Stenberg2021-01-061-1/+14
| | | | | | | | | | ... to make build tools/valgrind warn if no curl_global_cleanup is called. This is conditionally only done for debug builds with the env variable CURL_GLOBAL_INIT set. Closes #6410
* speedcheck: exclude paused transfersDaniel Stenberg2020-12-221-0/+3
| | | | | | | | | | | Paused transfers should not be stopped due to slow speed even when CURLOPT_LOW_SPEED_LIMIT is set. Additionally, the slow speed timer is now reset when the transfer is unpaused - as otherwise it would easily just trigger immediately after unpausing. Reported-by: Harry Sintonen Fixes #6358 Closes #6359
* curl.se: new homeDaniel Stenberg2020-11-041-1/+1
| | | | Closes #6172
* hsts: add read/write callbacksDaniel Stenberg2020-11-031-1/+3
| | | | | | | | - read/write callback options - man pages for the 4 new setopts - test 1915 verifies the callbacks Closes #5896
* hsts: add support for Strict-Transport-SecurityDaniel Stenberg2020-11-031-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | - enable in the build (configure) - header parsing - host name lookup - unit tests for the above - CI build - CURL_VERSION_HSTS bit - curl_version_info support - curl -V output - curl-config --features - CURLOPT_HSTS_CTRL - man page for CURLOPT_HSTS_CTRL - curl --hsts (sets CURLOPT_HSTS_CTRL and works with --libcurl) - man page for --hsts - save cache to disk - load cache from disk - CURLOPT_HSTS - man page for CURLOPT_HSTS - added docs/HSTS.md - fixed --version docs - adjusted curl_easy_duphandle Closes #5896
* pause: only trigger a reread if the unpause sticksDaniel Stenberg2020-09-251-3/+4
| | | | | | | | | | | | As an unpause might itself get paused again and then triggering another reread doesn't help. Follow-up from e040146f22608fd9 (shipped since 7.69.1) Bug: https://curl.haxx.se/mail/lib-2020-09/0081.html Patch-by: Kunal Chandarana Fixes #5988 Closes #6013
* symbian: drop supportDaniel Stenberg2020-09-221-12/+0
| | | | | | | | | The OS is deprecated. I see no traces of anyone having actually built curl for Symbian after 2012. The public headers are unmodified. Closes #5989
* easy_reset: clear retry counterQuentin Balland2020-09-181-0/+1
| | | | | Closes #5975 Fixes #5974
* altsvc: clone setting in curl_easy_duphandlebagder/altsvc-duphandleDaniel Stenberg2020-09-061-0/+11
| | | | | | | | | | | | The cache content is not duplicated, like other caches, but the setting and specified file name are. Test 1908 is extended to verify this somewhat. Since the duplicated handle gets the same file name, the test unfortunately overwrites the same file twice (with different contents) which makes it hard to check automatically. Closes #5923
* Curl_easy: remember last connection by id, not by pointerDaniel Stenberg2020-08-171-2/+1
| | | | | | | | | CVE-2020-8231 Bug: https://curl.haxx.se/docs/CVE-2020-8231.html Reported-by: Marc Aldorasi Closes #5824
* timeouts: move ms timeouts to timediff_t from int and longMarc Hoersken2020-06-061-1/+1
| | | | | | | | | | | | | Now that all functions in select.[ch] take timediff_t instead of the limited int or long, we can remove type conversions and related preprocessor checks to silence compiler warnings. Avoiding conversions from time_t was already done in 842f73de. Based upon #5262 Supersedes #5214, #5220 and #5221 Follow up to #5343 and #5479 Closes #5490
* url: alloc the download buffer at transfer startDaniel Stenberg2020-05-301-17/+0
| | | | | | | | | | | ... and free it as soon as the transfer is done. It removes the extra alloc when a new size is set with setopt() and reduces memory for unused easy handles. In addition: the closure_handle now doesn't use an allocated buffer at all but the smallest supported size as a stack based one. Closes #5472
* setopt: support certificate options in memory with struct curl_blobGilles Vollant2020-05-151-0/+11
| | | | | | | | | | | | | This change introduces a generic way to provide binary data in setopt options, called BLOBs. This change introduces these new setopts: CURLOPT_ISSUERCERT_BLOB, CURLOPT_PROXY_SSLCERT_BLOB, CURLOPT_PROXY_SSLKEY_BLOB, CURLOPT_SSLCERT_BLOB and CURLOPT_SSLKEY_BLOB. Reviewed-by: Daniel Stenberg Closes #5357
* easy: fix dangling pointer on easy_perform faildenzor2020-05-121-0/+1
| | | | Closes https://github.com/curl/curl/pull/5363
* dynbuf: introduce internal generic dynamic buffer functionsDaniel Stenberg2020-05-041-10/+9
| | | | | | | | | | | | | A common set of functions instead of many separate implementations for creating buffers that can grow when appending data to them. Existing functionality has been ported over. In my early basic testing, the total number of allocations seem at roughly the same amount as before, possibly a few less. See docs/DYNBUF.md for a description of the API. Closes #5300
* easy: Fix curl_easy_duphandle for builds missing IPv6 that use c-aresJay Satiro2020-03-141-8/+19
| | | | | | | | | | | | | | | | | - Ignore CURLE_NOT_BUILT_IN errors returned by c-ares functions in curl_easy_duphandle. Prior to this change if c-ares was used as the resolver backend and either it was too old or libcurl was built without IPv6 support then some of our resolver functions could return CURLE_NOT_BUILT_IN to curl_easy_duphandle causing it to fail. Caused by c8f086b which shipped in 7.69.1. Reported-by: Karl Chen Fixes https://github.com/curl/curl/issues/5097 Closes https://github.com/curl/curl/pull/5100
* mime: latch last read callback status.Patrick Monnerat2020-03-071-0/+8
| | | | | | | | | | | | | In case a read callback returns a status (pause, abort, eof, error) instead of a byte count, drain the bytes read so far but remember this status for further processing. Takes care of not losing data when pausing, and properly resume a paused mime structure when requested. New tests 670-673 check unpausing cases, with easy or multi interface and mime or form api. Fixes #4813 Reported-by: MrdUkk on github
* ares: store dns parameters for duphandleErnst Sjöstrand2020-03-071-0/+11
| | | | | | | | | | | With c-ares the dns parameters lives in ares_channel. Store them in the curl handle and set them again in easy_duphandle. Regression introduced in #3228 (6765e6d), shipped in curl 7.63.0. Fixes #4893 Closes #5020 Signed-off-by: Ernst Sjöstrand <ernst.sjostrand@verisure.com>
* version: make curl_version* thread-safe without using global contextDaniel Stenberg2020-03-071-4/+0
| | | | Closes #5010
* pause: force a connection (re-)check after unpausingDaniel Stenberg2020-03-071-0/+4
| | | | | | | | | There might be data available that was already read off the socket, for example in the TLS layer. Reported-by: Anders Berg Fixes #4966 Closes #5049
* pause: bail out on bad inputDaniel Stenberg2020-03-061-6/+12
| | | | | | | A NULL easy handle or an easy handle without an associated connection cannot be paused or unpaused. Closes #5050
* pause: return early for calls that don't change pause stateDaniel Stenberg2020-03-061-0/+7
| | | | | | Reviewed-by: Patrick Monnerat Ref: #4833 Closes #5026
* Revert "pause: force-drain the transfer on unpause"bagder/revert-unpause-h2Daniel Stenberg2020-03-051-1/+0
| | | | | | | | | | This reverts commit fa0216b294af4c7113a9040ca65eefc7fc18ac1c (from #5000) Clearly that didn't solve the problem correctly. Reported-by: Christopher Reid Reopens #4966 Fixes #5044
* Revert "mime: latch last read callback status."Daniel Stenberg2020-03-021-8/+0
| | | | | | | | This reverts commit 87869e38d7afdec3ef1bb4965711458b088e254f. Fixes #5014 Closes #5015 Reopens #4833
* mime: latch last read callback status.Patrick Monnerat2020-03-021-0/+8
| | | | | | | | | | | | | | In case a read callback returns a status (pause, abort, eof, error) instead of a byte count, drain the bytes read so far but remember this status for further processing. Takes care of not losing data when pausing, and properly resume a paused mime structure when requested. New tests 670-673 check unpausing cases, with easy or multi interface and mime or form api. Fixes #4813 Reported-by: MrdUkk on github Closes #4833
* pause: force-drain the transfer on unpauseDaniel Stenberg2020-02-291-0/+1
| | | | | | | | | ... since the socket might not actually be readable anymore when for example the data is already buffered in the TLS layer. Fixes #4966 Reported-by: Anders Berg Closes #5000
* http2: make pausing/unpausing set/clear local stream windowDaniel Stenberg2020-02-271-33/+38
| | | | | | | | | | | | | This reduces the HTTP/2 window size to 32 MB since libcurl might have to buffer up to this amount of data in memory and yet we don't want it set lower to potentially impact tranfer performance on high speed networks. Requires nghttp2 commit b3f85e2daa629 (https://github.com/nghttp2/nghttp2/pull/1444) to work properly, to end up in the next release after 1.40.0. Fixes #4939 Closes #4940
* easy: remove dead codeJay Satiro2020-02-121-4/+0
| | | | | | multi is already assigned to data->multi by curl_multi_add_handle. Closes https://github.com/curl/curl/pull/4900
* global_init: move the IPv6 works status bool to multi handleDaniel Stenberg2020-01-281-2/+0
| | | | | | | | | 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
* global_init: assume the EINTR bit by defaultDaniel Stenberg2020-01-261-2/+6
| | | | | | | | | | | | - Removed from global_init since it isn't thread-safe. The symbol will still remain to not break compiles, it just won't have any effect going forward. - make the internals NOT loop on EINTR (the opposite from previously). It only risks returning from the select/poll/wait functions early, and that should be risk-free. Closes #4840
* wolfssh: make it init properly via Curl_ssh_init()Daniel Stenberg2020-01-241-7/+0
| | | | Closes #4846
* wolfSSH: new SSH backendDaniel Stenberg2020-01-121-1/+12
| | | | | | Adds support for SFTP (not SCP) using WolfSSH. Closes #4231
* global_init: undo the "intialized" bump in case of failureDaniel Stenberg2019-12-021-5/+9
| | | | | | | | | ... so that failures in the global init function don't count as a working init and it can then be called again. Reported-by: Paul Groke Fixes #4636 Closes #4653
* lib: Move lib/ssh.h -> lib/vssh/ssh.hJay Satiro2019-11-171-1/+1
| | | | | | Follow-up to 5b2d703 which moved ssh source files to vssh. Closes https://github.com/curl/curl/pull/4609
* pause: avoid updating socket if done was already calledDaniel Stenberg2019-11-101-3/+4
| | | | | | | | ... avoids unnecesary recursive risk when the transfer is already done. Reported-by: Richard Bowker Fixes #4563 Closes #4574
* url: make Curl_close() NULLify the pointer tooDaniel Stenberg2019-10-301-1/+1
| | | | | | | This is the common pattern used in the code and by a unified approach we avoid mistakes. Closes #4534
* easy: part of conditional expression is always true: !resultDaniel Stenberg2019-09-201-3/+2
| | | | | Fixes warning detected by PVS-Studio Fixes #4374
* cleanup: move functions out of url.c and make them staticDaniel Stenberg2019-09-031-1/+30
| | | | Closes #4289