summaryrefslogtreecommitdiff
path: root/lib/easy.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* easy: Initialize info variables on easy init and duphandleJay Satiro2016-11-051-0/+2
| | | | | | | | | | | | - Call Curl_initinfo on init and duphandle. Prior to this change the statistical and informational variables were simply zeroed by calloc on easy init and duphandle. While zero is the correct default value for almost all info variables, there is one where it isn't (filetime initializes to -1). Bug: https://github.com/curl/curl/issues/1103 Reported-by: Neal Poole
* strcasecompare: is the new name for strequal()Daniel Stenberg2016-10-311-1/+0
| | | | | | | ... to make it less likely that we forget that the function actually does case insentive compares. Also replaced several invokes of the function with a plain strcmp when case sensitivity is not an issue (like comparing with "-").
* idn: switch to libidn2 use and IDNA2008 supportDaniel Stenberg2016-10-311-26/+0
| | | | | | | CVE-2016-8625 Bug: https://curl.haxx.se/docs/adv_20161102K.html Reported-by: Christian Heimes
* s/cURL/curlDaniel Stenberg2016-10-181-4/+4
| | | | | The tool was never called cURL, only the project. But even so, we have more and more over time switched to just use lower case.
* easy: Reset all statistical session info in curl_easy_resetJay Satiro2016-09-201-0/+3
| | | | | Bug: https://github.com/curl/curl/issues/1017 Reported-by: Jeroen Ooms
* multi: make Curl_expire() work with 0 ms timeoutsDaniel Stenberg2016-08-041-1/+1
| | | | | | | | | | Previously, passing a timeout of zero to Curl_expire() was a magic code for clearing all timeouts for the handle. That is now instead made with the new Curl_expire_clear() function and thus a 0 timeout is fine to set and will trigger a timeout ASAP. This will help removing short delays, in particular notable when doing HTTP/2.
* curl_global_init: Check if IPv6 worksBrian Prodoehl2016-07-181-0/+2
| | | | | | | | - Curl_ipv6works() is not thread-safe until after the first call, so call it once during global init to avoid a possible race condition. Bug: https://github.com/curl/curl/issues/915 PR: https://github.com/curl/curl/pull/918
* typedefs: use the full structs in internal code...Daniel Stenberg2016-06-221-18/+19
| | | | ... and save the typedef'ed names for headers and external APIs.
* internals: rename the SessionHandle struct to Curl_easyDaniel Stenberg2016-06-221-27/+17
|
* lib: include curl_printf.h as one of the last headersDaniel Stenberg2016-04-291-2/+1
| | | | | | | | | | | | | | | | | | | | curl_printf.h defines printf to curl_mprintf, etc. This can cause problems with external headers which may use __attribute__((format(printf, ...))) markers etc. To avoid that they cause problems with system includes, we include curl_printf.h after any system headers. That makes the three last headers to always be, and we keep them in this order: curl_printf.h curl_memory.h memdebug.h None of them include system headers, they all do funny #defines. Reported-by: David Benjamin Fixes #743
* code: style updatesDaniel Stenberg2016-04-031-4/+4
|
* easy: Minor coding standard and style updatesSteve Holme2016-03-191-11/+11
| | | | | Following commit c5744340db. Additionally removes the need for a second 'result code' variable as well.
* easy: Remove poll failure check in easy_transferJay Satiro2016-03-191-6/+1
| | | | | | | | .. because curl_multi_wait can no longer signal poll failure. follow-up to 77e1726 Bug: https://github.com/curl/curl/issues/707
* version: init moved to private name space, added protosDaniel Stenberg2016-03-171-2/+2
| | | | follow-up to 80015cdd52145
* version: thread safetyJay Satiro2016-03-161-1/+5
|
* easy: Removed redundant HTTP authentication include filesSteve Holme2016-03-161-1/+0
|
* easy: add check to malloc() when running event-basedDaniel Stenberg2016-03-141-9/+13
| | | | ... to allow torture tests then too.
* URLs: change all http:// URLs to https://Daniel Stenberg2016-02-031-1/+1
|
* Revert "cleanup: general removal of TODO (and similar) comments"Daniel Stenberg2015-11-241-1/+1
| | | | | | | This reverts commit 64e959ffe37c436503f9fed1ce2d6ee6ae50bd9a. Feedback-by: Dan Fandrich URL: http://curl.haxx.se/mail/lib-2015-11/0062.html
* cleanup: general removal of TODO (and similar) commentsDaniel Stenberg2015-11-131-1/+1
| | | | | | They tend to never get updated anyway so they're frequently inaccurate and we never go back to revisit them anyway. We document issues to work on properly in KNOWN_BUGS and TODO instead.
* curl_global_init: set the memory function pointers correctDaniel Stenberg2015-10-091-10/+22
| | | | follow-up from 6f8ecea0
* curl_global_init_mem: set function pointers before doing initDaniel Stenberg2015-10-091-12/+9
| | | | ... as in the polarssl TLS backend for example it uses memory functions.
* curl_memory: make curl_memory.h the second-last header file loadedDan Fandrich2015-03-241-2/+2
| | | | | | | This header file must be included after all header files except memdebug.h, as it does similar memory function redefinitions and can be similarly affected by conflicting definitions in system or dependent library headers.
* mprintf.h: remove #ifdef CURLDEBUGDaniel Stenberg2015-03-031-4/+2
| | | | | ... and as a consequence, introduce curl_printf.h with that re-define magic instead and make all libcurl code use that instead.
* Curl_client_write() & al.: chop long data, convert data only once.Patrick Monnerat2014-12-091-64/+6
|
* easy.c: Fixed compilation warning when no verbose string supportSteve Holme2014-11-161-0/+4
| | | | warning: unused parameter 'easy'
* libssh2: detect features based on version, not configure checksDaniel Stenberg2014-11-091-0/+1
| | | | | ... so that non-configure builds get the correct functions too based on the libssh2 version used.
* code cleanup: we prefer 'CURLcode result'Daniel Stenberg2014-10-241-47/+47
| | | | | | | | | | | | | | ... for the local variable name in functions holding the return code. Using the same name universally makes code easier to read and follow. Also, unify code for checking for CURLcode errors with: if(result) or if(!result) instead of if(result == CURLE_OK), if(CURLE_OK == result) or if(result != CURLE_OK)
* wait_or_timeout: return failure when Curl_poll() failsDaniel Stenberg2014-10-021-0/+3
| | | | | | Coverity detected this. CID 1241954. When Curl_poll() returns a negative value 'mcode' was uninitialized. Pretty harmless since this is debug code only and would at worst cause an error to _not_ be returned...
* compiler warnings: potentially uninitialized variablesMarcel Raad2014-07-051-1/+1
| | | | | | ... pointed out by MSVC2013 Bug: http://curl.haxx.se/bug/view.cgi?id=1391
* easy_perform: spelling mistake in error messageDaniel Stenberg2014-05-031-1/+1
|
* curl_global_init_mem: bump initialized even if already initializedDaniel Stenberg2014-04-221-3/+7
| | | | | | | | | | As this makes curl_global_init_mem() behave the same way as curl_global_init() already does in that aspect - the same number of curl_global_cleanup() calls is then required to again decrease the counter and then eventually do the cleanup. Bug: http://curl.haxx.se/bug/view.cgi?id=1362 Reported-by: Tristan
* easy: Fixed a memory leak on OOM conditionDan Fandrich2014-02-221-0/+9
|
* vtls: renamed sslgen.[ch] to vtls.[ch]Daniel Stenberg2013-12-201-1/+1
|
* vtls: created subdir, moved sslgen.[ch] there, updated all include linesDaniel Stenberg2013-12-201-1/+1
|
* sigpipe: factor out sigpipe_reset from easy.cJeff King2013-11-271-55/+1
| | | | | | | | | | | | | Commit 7d80ed64e43515 introduced some helpers to handle sigpipe in easy.c. However, that fix was incomplete, and we need to add more callers in other files. The first step is making the helpers globally accessible. Since the functions are small and should generally end up inlined anyway, we simply define them in the header as static functions. Signed-off-by: Jeff King <peff@peff.net>
* easy.c: Fixed compilation warningSteve Holme2013-09-011-1/+1
| | | | warning: `code' might be used uninitialized in this function