summaryrefslogtreecommitdiff
path: root/lib/easy.c
Commit message (Collapse)AuthorAgeFilesLines
* unpause: trigger a timeout for event-based transfersDaniel Stenberg2019-06-091-1/+4
| | | | | | | | | | ... so that timeouts or other state machine actions get going again after a changing pause state. For example, if the last delivery was paused there's no pending socket activity. Reported-by: sstruchtrup on github Fixes #3994 Closes #4001
* cleanup: remove FIXME and TODO commentsDaniel Stenberg2019-05-161-1/+1
| | | | | | | | | They serve very little purpose and mostly just add noise. Most of them have been around for a very long time. I read them all before removing or rephrasing them. Ref: #3876 Closes #3883
* auth: Rename the various authentication clean up functionsSteve Holme2019-05-121-1/+1
| | | | | | For consistency and to a avoid confusion. Closes #3869
* easy: fix another "clarify calculation precedence" warningMarcel Raad2019-05-121-2/+2
| | | | I missed this one in commit 6b3dde7fe62ea5a557fd1fd323fac2bcd0c2e9be.
* build: fix "clarify calculation precedence" warningsMarcel Raad2019-05-121-2/+2
| | | | | | | Codacy/CppCheck warns about this. Consistently use parentheses as we already do in some places to silence the warning. Closes https://github.com/curl/curl/pull/3866
* http_digest: Don't expose functions when HTTP and Crypto Auth are disabledSteve Holme2019-05-111-0/+3
| | | | Closes #3861
* CURLOPT_DNS_USE_GLOBAL_CACHE: removeDaniel Stenberg2019-04-111-1/+0
| | | | | | | | Remove the code too. The functionality has been disabled in code since 7.62.0. Setting this option will from now on simply be ignored and have no function. Closes #3654
* system_win32: move win32_init here from easy.cJay Satiro2019-03-021-90/+2
| | | | | | | | | | .. since system_win32 is a more appropriate location for the functions and to extern the globals. Ref: https://github.com/curl/curl/commit/ca597ad#r32446578 Reported-by: Gisle Vanem Closes https://github.com/curl/curl/pull/3625
* Fix strict-prototypes GCC warningMarcel Raad2019-02-221-1/+1
| | | | | As seen in the MinGW autobuilds. Caused by commit f26bc29cfec0be84c67cf74065cf8e5e78fd68b7.
* easy: fix win32 init to work without CURL_GLOBAL_WIN32Jay Satiro2019-02-181-49/+60
| | | | | | | | | | | | | | | | | | | | | | | - Change the behavior of win32_init so that the required initialization procedures are not affected by CURL_GLOBAL_WIN32 flag. libcurl via curl_global_init supports initializing for win32 with an optional flag CURL_GLOBAL_WIN32, which if omitted was meant to stop Winsock initialization. It did so internally by skipping win32_init() when that flag was set. Since then win32_init() has been expanded to include required initialization routines that are separate from Winsock and therefore must be called in all cases. This commit fixes it so that CURL_GLOBAL_WIN32 only controls the optional win32 initialization (which is Winsock initialization, according to our doc). The only users affected by this change are those that don't pass CURL_GLOBAL_WIN32 to curl_global_init. For them this commit removes the risk of a potential crash. Ref: https://github.com/curl/curl/pull/3573 Fixes https://github.com/curl/curl/issues/3313 Closes https://github.com/curl/curl/pull/3575
* Curl_now: figure out windows version in win32_initDaniel Stenberg2019-02-151-0/+16
| | | | | | | | | | ... and avoid use of static variables that aren't thread safe. Fixes regression from e9ababd4f5a (present in the 7.64.0 release) Reported-by: Paul Groke Fixes #3572 Closes #3573
* urldata: rename easy_conn to just connDaniel Stenberg2019-01-111-2/+2
| | | | | | | | | | | | | | | We use "conn" everywhere to be a pointer to the connection. Introduces two functions that "attaches" and "detaches" the connection to and from the transfer. Going forward, we should favour using "data->conn" (since a transfer always only has a single connection or none at all) to "conn->data" (since a connection can have none, one or many transfers associated with it and updating conn->data to be correct is error prone and a frequent reason for internal issues). Closes #3442
* curl_easy_perform: fix timeout handlingDaniel Stenberg2018-11-251-3/+4
| | | | | | | | | | | | | curl_multi_wait() was erroneously used from within curl_easy_perform(). It could lead to it believing there was no socket to wait for and then instead sleep for a while instead of monitoring the socket and then miss acting on that activity as swiftly as it should (causing an up to 1000 ms delay). Reported-by: Antoni Villalonga Fixes #3305 Closes #3306 Closes #3308
* ares: remove fd from multi fd set when ares is about to close the fdRomain Fliedel2018-11-201-1/+2
| | | | | | | | | | | | | | | | | | | When using c-ares for asyn dns, the dns socket fd was silently closed by c-ares without curl being aware. curl would then 'realize' the fd has been removed at next call of Curl_resolver_getsock, and only then notify the CURLMOPT_SOCKETFUNCTION to remove fd from its poll set with CURL_POLL_REMOVE. At this point the fd is already closed. By using ares socket state callback (ARES_OPT_SOCK_STATE_CB), this patch allows curl to be notified that the fd is not longer needed for neither for write nor read. At this point by calling Curl_multi_closed we are able to notify multi with CURL_POLL_REMOVE before the fd is actually closed by ares. In asyn-ares.c Curl_resolver_duphandle we can't use ares_dup anymore since it does not allow passing a different sock_state_cb_data Closes #3238
* whitespace fixesViktor Szakats2018-09-231-1/+0
| | | | | | | | | | | - replace tabs with spaces where possible - remove line ending spaces - remove double/triple newlines at EOF - fix a non-UTF-8 character - cleanup a few indentations/line continuations in manual examples Closes https://github.com/curl/curl/pull/3037
* url: use the URL API internally as wellDaniel Stenberg2018-09-221-4/+0
| | | | | | ... to make it a truly unified URL parser. Closes #3017
* curl_easy_upkeep: removed 'conn' from the nameDaniel Stenberg2018-09-071-2/+2
| | | | | | | ... including the associated option. Fixes #2951 Closes #2952
* upkeep: add a connection upkeep API: curl_easy_conn_upkeep()Max Dymond2018-09-071-0/+20
| | | | | | | | | Add functionality so that protocols can do custom keepalive on their connections, when an external API function is called. Add docs for the new options in 7.62.0 Closes #1641
* vtls: reinstantiate engine on duplicated handlesLaurent Bonnans2018-08-181-0/+7
| | | | | | | | | | | | Handles created with curl_easy_duphandle do not use the SSL engine set up in the original handle. This fixes the issue by storing the engine name in the internal url state and setting the engine from its name inside curl_easy_duphandle. Reported-by: Anton Gerasimov Signed-of-by: Laurent Bonnans Fixes #2829 Closes #2833
* easy_perform: use *multi_timeout() to get wait timesDaniel Stenberg2018-06-271-17/+6
| | | | | | | | | ... and trim the threaded Curl_resolver_getsock() to return zero millisecond wait times during the first three milliseconds so that localhost or names in the OS resolver cache gets detected and used faster. Closes #2685
* spelling fixesViktor Szakats2018-06-031-2/+2
| | | | | | Detected using the `codespell` tool (version 1.13.0). Also secure and fix an URL.
* duphandle: make sure CURLOPT_RESOLVE is duplicated fine tooDaniel Stenberg2018-04-121-0/+3
| | | | | | | | Verified in test 1502 now Fixes #2485 Closes #2486 Reported-by: Ernst Sjöstrand
* add_handle/easy_perform: clear errorbuffer on start if setDaniel Stenberg2018-03-171-0/+4
| | | | | | | | | | To offer applications a more defined behavior, we clear the buffer as early as possible. Assisted-by: Jay Satiro Fixes #2190 Closes #2377
* pause: when changing pause state, update socket stateDaniel Stenberg2018-03-161-0/+4
| | | | | | | | | | | | 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
* header callback: don't chop headers into smaller piecesDaniel Stenberg2018-02-161-4/+2
| | | | | | Reported-by: Guido Berhoerster Fixes #2314 Closes #2316
* TODO fixed: Detect when called from within callbacksBjörn Stenberg2018-02-151-0/+13
| | | | Closes #2302
* curl_easy_reset: clear digest auth stateDaniel Stenberg2018-01-301-0/+2
| | | | | | | Bug: https://curl.haxx.se/mail/lib-2018-01/0074.html Reported-by: Ruurd Beerstra Fixes #2255 Closes #2272
* mime: clone mime tree upon easy handle duplication.Patrick Monnerat2018-01-141-2/+7
| | | | | | | | | | | | | | | | | | | | | A mime tree attached to an easy handle using CURLOPT_MIMEPOST is strongly bound to the handle: there is a pointer to the easy handle in each item of the mime tree and following the parent pointer list of mime items ends in a dummy part stored within the handle. Because of this binding, a mime tree cannot be shared between different easy handles, thus it needs to be cloned upon easy handle duplication. There is no way for the caller to get the duplicated mime tree handle: it is then set to be automatically destroyed upon freeing the new easy handle. New test 654 checks proper mime structure duplication/release. Add a warning note in curl_mime_data_cb() documentation about sharing user data between duplicated handles. Closes #2235
* easy: fix connection ownership in curl_easy_pauseBasuke Suzuki2018-01-091-1/+14
| | | | | | | | Before calling Curl_client_chop_write(), change the owner of connection to the current Curl_easy handle. This will fix the issue #2217. Fixes https://github.com/curl/curl/issues/2217 Closes https://github.com/curl/curl/pull/2221
* curl_easy_reset: release mime-related data.Patrick Monnerat2017-12-201-1/+1
| | | | | | | | | | | Move curl_mime_initpart() and curl_mime_cleanpart() calls to lower-level functions dealing with UserDefined structure contents. This avoids memory leakages on curl-generated part mime headers. New test 2073 checks this using the cli tool --next option: it triggers a valgrind error if bug is present. Bug: https://curl.haxx.se/mail/lib-2017-12/0060.html Reported-by: Martin Galvan
* Added support for libssh SSH SCP back-endNikos Mavrogiannopoulos2017-12-011-0/+11
| | | | | | | | | | libssh is an alternative library to libssh2. https://www.libssh.org/ That patch set also introduces support for ECDSA ed25519 keys, as well as gssapi authentication. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
* global_init: ignore CURL_GLOBAL_SSL's absenseDaniel Stenberg2017-11-271-9/+5
| | | | | | | | | | | | | | | | | This bit is no longer used. It is not clear what it meant for users to "init the TLS" in a world with different TLS backends and since the introduction of multissl, libcurl didn't properly work if inited without this bit set. Not a single user responded to the call for users of it: https://curl.haxx.se/mail/lib-2017-11/0072.html Reported-by: Evgeny Grin Assisted-by: Jay Satiro Fixes #2089 Fixes #2083 Closes #2107
* setopt: split out curl_easy_setopt() to its own fileDaniel Stenberg2017-11-101-23/+37
| | | | | | ... to make url.c smaller. Closes #1944
* include: remove conncache.h inclusion from where its not neededDaniel Stenberg2017-11-011-1/+0
|
* time: rename Curl_tvnow to Curl_nowDaniel Stenberg2017-10-251-4/+4
| | | | | | | | | | ... 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-6/+6
| | | | | | | | | | | | | | | ... 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
* code style: use spaces around equals signsDaniel Stenberg2017-09-111-8/+8
|
* easy_events: make event data staticDaniel Stenberg2017-08-061-1/+3
| | | | | | | | | | | | First: this function is only used in debug-builds and not in release/real builds. It is used to drive tests using the event-based API. A pointer to the local struct is passed to CURLMOPT_TIMERDATA, but the CURLMOPT_TIMERFUNCTION calback can in fact be called even after this funtion returns, namely when curl_multi_remove_handle() is called. Reported-by: Brian Carpenter
* timeval: struct curltime is a struct timeval replacementDaniel Stenberg2017-07-281-4/+4
| | | | | | | | | ... 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
* time: fix type conversions and compiler warningsMichael Kaufmann2017-05-241-3/+9
| | | | | | | | | Fix bugs and compiler warnings on systems with 32-bit long and 64-bit time_t. Reviewed-by: Daniel Stenberg Closes #1499
* multi: use a fixed array of timers instead of mallocDaniel Stenberg2017-05-101-1/+1
| | | | | | | | | | ... since the total amount is low this is faster, easier and reduces memory overhead. Also, Curl_expire_done() can now mark an expire timeout as done so that it never times out. Closes #1472
* multi: assign IDs to all timers and make each timer singletonDaniel Stenberg2017-05-101-1/+1
| | | | | | | A) reduces the timeout lists drastically B) prevents a lot of superfluous loops for timers that expires "in vain" when it has actually already been extended to fire later on
* buffer_size: make sure it always has the correct sizeDaniel Stenberg2017-05-011-1/+1
| | | | Removes the need for CURL_BUFSIZE
* lib: fix maybe-uninitialized warningsMarcel Raad2017-04-221-1/+1
| | | | | | | | | | | | | | With -Og, GCC complains: easy.c:628:7: error: ‘mcode’ may be used uninitialized in this function [-Werror=maybe-uninitialized] ../lib/strcase.h:35:29: error: ‘tok_buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized] vauth/digest.c:208:9: note: ‘tok_buf’ was declared here ../lib/strcase.h:35:29: error: ‘tok_buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized] vauth/digest.c:566:15: note: ‘tok_buf’ was declared here Fix this by initializing the variables.
* code: fix typos and style in commentsDaniel Gustafsson2017-04-171-1/+1
| | | | | | | A few random typos, and minor whitespace cleanups, found in comments while reading code. Closes #1423
* easy: silence compiler warningJay Satiro2017-04-041-1/+1
| | | | | | | | Safe to silence warning adding time delta of poll, which can trigger on Windows since sizeof time_t > sizeof long. warning C4244: '+=' : conversion from 'time_t' to 'long', possible loss of data
* pause: handle mixed types of data when pausedDaniel Stenberg2017-03-281-14/+27
| | | | | | | | | | | | When receiving chunked encoded data with trailers, and the write callback returns PAUSE, there might be both body and header to store to resend on unpause. Previously libcurl returned error for that case. Added test case 1540 to verify. Reported-by: Stephen Toub Fixes #1354 Closes #1357
* Improve code readbilitySylvestre Ledru2017-03-131-2/+1
| | | | | | ... by removing the else branch after a return, break or continue. Closes #1310
* curl_easy_reset: Also reset the authentication stateMichael Kaufmann2017-03-111-0/+4
| | | | | Follow-up to 5278462 See https://github.com/curl/curl/issues/1095
* CURLOPT_BUFFERSIZE: support enlarging receive bufferRichy Kim2017-01-191-0/+6
| | | | | | | | | | Replace use of fixed macro BUFSIZE to define the size of the receive buffer. Reappropriate CURLOPT_BUFFERSIZE to include enlarging receive buffer size. Upon setting, resize buffer if larger than the current default size up to a MAX_BUFSIZE (512KB). This can benefit protocols like SFTP. Closes #1222