summaryrefslogtreecommitdiff
path: root/lib/transfer.c
Commit message (Collapse)AuthorAgeFilesLines
* curl.se: new homeDaniel Stenberg2020-11-041-1/+1
| | | | Closes #6172
* hsts: add read/write callbacksDaniel Stenberg2020-11-031-0/+2
| | | | | | | | - read/write callback options - man pages for the 4 new setopts - test 1915 verifies the callbacks Closes #5896
* sendf: move the verbose-check into Curl_debugDaniel Stenberg2020-11-021-4/+3
| | | | | | Saves us from having the same check done everywhere. Closes #6159
* transfer: move retrycount from connect struct to easy handleStefan Yohansson2020-08-101-2/+4
| | | | | | | | | | This flag was applied to the connection struct that is released on retry. These changes move the retry counter into Curl_easy struct that lives across retries and retains the new connection. Reported-by: Cherish98 on github Fixes #5794 Closes #5800
* transfer: fix data_pending for builds with both h2 and h3 enabledDaniel Stenberg2020-07-281-2/+6
| | | | Closes #5734
* transfer: fix memory-leak with CURLOPT_CURLU in a duped handleDaniel Stenberg2020-07-121-1/+2
| | | | | | | | Added test case 674 to reproduce and verify the bug report. Fixes #5665 Reported-by: NobodyXu on github Closes #5673
* urldata: let the HTTP method be in the set.* structDaniel Stenberg2020-06-021-19/+20
| | | | | | | | | | | | When the method is updated inside libcurl we must still not change the method as set by the user as then repeated transfers with that same handle might not execute the same operation anymore! This fixes the libcurl part of #5462 Test 1633 added to verify. Closes #5499
* transfer: remove k->str NULL checkDaniel Stenberg2020-06-011-1/+1
| | | | | | | | | | "Null-checking k->str suggests that it may be null, but it has already been dereferenced on all paths leading to the check" - and it can't legally be NULL at this point. Remove check. Detected by Coverity CID 1463884 Closes #5495
* url: alloc the download buffer at transfer startDaniel Stenberg2020-05-301-7/+7
| | | | | | | | | | | ... 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
* transfer: close connection after excess data has been readMichael Kaufmann2020-05-271-0/+1
| | | | | | | | For HTTP 1.x, it's a protocol error when the server sends more bytes than announced. If this happens, don't reuse the connection, because the start position of the next response is undefined. Closes #5440
* dynbuf: introduce internal generic dynamic buffer functionsDaniel Stenberg2020-05-041-21/+21
| | | | | | | | | | | | | 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
* transfer: Switch PUT to GET/HEAD on 303 redirectJay Satiro2020-04-221-6/+13
| | | | | | | | | | | | | | Prior to this change if there was a 303 reply to a PUT request then the subsequent request to respond to that redirect would also be a PUT. It was determined that was most likely incorrect based on the language of the RFCs. Basically 303 means "see other" resource, which implies it is most likely not the same resource, therefore we should not try to PUT to that different resource. Refer to the discussions in #5237 and #5248 for more information. Fixes https://github.com/curl/curl/issues/5237 Closes https://github.com/curl/curl/pull/5248
* http: don't consider upload done if the request isn't completely sent offDaniel Stenberg2020-04-081-2/+7
| | | | | Fixes #4919 Closes #5197
* build: fixed build for systems with select() in unistd.hHarry Sintonen2020-03-311-0/+2
| | | | Closes #5169
* http2: Fix erroneous debug message that h2 connection closedJay Satiro2020-03-181-6/+14
| | | | | | | | | | | | | Prior to this change in libcurl debug builds http2 stream closure was erroneously referred to as connection closure. Before: * nread <= 0, server closed connection, bailing After: * nread == 0, stream closed, bailing Closes https://github.com/curl/curl/pull/5118
* transfer: cap retries of "dead connections" to 5Daniel Stenberg2020-03-151-0/+6
| | | | | | | | | | When libcurl retries a connection due to it being "seemingly dead" or by REFUSED_STREAM, it will now only do it up five times before giving up, to avoid never-ending loops. Reported-by: Dima Tisnek Bug: https://curl.haxx.se/mail/lib-2020-03/0044.html Closes #5074
* transfer: set correct copyright year rangeDaniel Stenberg2020-03-061-1/+1
|
* urldata: remove the 'stream_was_rewound' connectdata struct memberDaniel Stenberg2020-03-061-4/+2
| | | | | | | ... as it is never set anywhere. Follow-up to 2f44e94ef Closes #5046
* Revert "pause: force-drain the transfer on unpause"bagder/revert-unpause-h2Daniel Stenberg2020-03-051-3/+2
| | | | | | | | | | This reverts commit fa0216b294af4c7113a9040ca65eefc7fc18ac1c (from #5000) Clearly that didn't solve the problem correctly. Reported-by: Christopher Reid Reopens #4966 Fixes #5044
* pause: force-drain the transfer on unpauseDaniel Stenberg2020-02-291-2/+3
| | | | | | | | | ... 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
* build: Disable Visual Studio warning "conditional expression is constant"Jay Satiro2019-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Disable warning C4127 "conditional expression is constant" globally in curl_setup.h for when building with Microsoft's compiler. This mainly affects building with the Visual Studio project files found in the projects dir. Prior to this change the cmake and winbuild build systems already disabled 4127 globally for when building with Microsoft's compiler. Also, 4127 was already disabled for all build systems in the limited circumstance of the WHILE_FALSE macro which disabled the warning specifically for while(0). This commit removes the WHILE_FALSE macro and all other cruft in favor of disabling globally in curl_setup. Background: We have various macros that cause 0 or 1 to be evaluated, which would cause warning C4127 in Visual Studio. For example this causes it: #define Curl_resolver_asynch() 1 Full behavior is not clearly defined and inconsistent across versions. However it is documented that since VS 2015 Update 3 Microsoft has addressed this somewhat but not entirely, not warning on while(true) for example. Prior to this change some C4127 warnings occurred when I built with Visual Studio using the generated projects in the projects dir. Closes https://github.com/curl/curl/pull/4658
* ngtcp2: use overflow buffer for extra HTTP/3 dataJavier Blazquez2019-11-181-2/+5
| | | | | Fixes #4525 Closes #4603
* http2: move state-init from creation to pre-transferDaniel Stenberg2019-10-031-0/+1
| | | | | | | | | | | To make sure that the HTTP/2 state is initialized correctly for duplicated handles. It would otherwise easily generate "spurious" PRIORITY frames to get sent over HTTP/2 connections when duplicated easy handles were used. Reported-by: Daniel Silverstone Fixes #4303 Closes #4442
* redirect: when following redirects to an absolute URL, URL encode itDaniel Stenberg2019-10-021-1/+2
| | | | | | | | ... to make it handle for example (RFC violating) embeded spaces. Reported-by: momala454 on github Fixes #4445 Closes #4447
* chunked-encoding: stop hiding the CURLE_BAD_CONTENT_ENCODING errorDaniel Stenberg2019-10-021-5/+5
| | | | | | | | | Unknown content-encoding would get returned as CURLE_WRITE_ERROR if the response is chunked-encoded. Reported-by: Ilya Kosarev Fixes #4310 Closes #4449
* Curl_fillreadbuffer: avoid double-free trailer buf on errorbagder/trailer-buf-freeDaniel Stenberg2019-09-091-5/+6
| | | | | | | Reviewed-by: Jay Satiro Reported-by: Thomas Vegas Closes #4307
* ngtcp2: accept upload via callbackDaniel Stenberg2019-08-231-0/+2
| | | | Closes #4256
* quiche: first working HTTP/3 requestDaniel Stenberg2019-08-061-1/+1
| | | | | | | | | - enable debug log - fix use of quiche API - use download buffer - separate header/body Closes #4193
* cleanup: remove the 'numsocks' argument used in many placesDaniel Stenberg2019-07-301-8/+2
| | | | | | | | | It was used (intended) to pass in the size of the 'socks' array that is also passed to these functions, but was rarely actually checked/used and the array is defined to a fixed size of MAX_SOCKSPEREASYHANDLE entries that should be used instead. Closes #4169
* readwrite_data: repair setting the TIMER_STARTTRANSFER stampDaniel Stenberg2019-07-301-1/+1
| | | | | | | | | | Regression, broken in commit 65eb65fde64bd5f (curl 7.64.1) Reported-by: Jonathan Cardoso Machado Assisted-by: Jay Satiro Fixes #4136 Closes #4162
* lib: Use UTF-8 encoding in commentsGergely Nagy2019-07-061-1/+1
| | | | | | | | | | Some editors and IDEs assume that source files use UTF-8 file encodings. It also fixes the build with MSVC when /utf-8 command line option is used (this option is mandatory for some other open-source projects, this is useful when using the same options is desired for building all libraries of a project). Closes https://github.com/curl/curl/pull/4087
* http2: call done_sending on end of uploadDaniel Stenberg2019-06-241-4/+4
| | | | | | | | | To make sure a HTTP/2 stream registers the end of stream. Bug #4043 made me find this problem but this fix doesn't correct the reported issue. Closes #4068
* lib: reduce variable scopesMarcel Raad2019-05-201-8/+6
| | | | | | Fixes Codacy/CppCheck warnings. Closes https://github.com/curl/curl/pull/3872
* cleanup: remove FIXME and TODO commentsDaniel Stenberg2019-05-161-1/+0
| | | | | | | | | 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
* wildcard: disable from build when FTP isn't presentDaniel Stenberg2019-05-131-0/+2
|
* pipelining: removedDaniel Stenberg2019-04-061-72/+13
| | | | | | | As previously planned and documented in DEPRECATE.md, all pipelining code is removed. Closes #3651
* transfer: fix LGTM alert "Comparison is always true"Marcel Raad2019-04-051-1/+1
| | | | | | | Just remove the redundant condition, which also makes it clear that k->buf is always 0-terminated if this break is not hit. Closes https://github.com/curl/curl/pull/3732
* urldata: simplify bytecountersDaniel Stenberg2019-03-011-21/+7
| | | | | | | | | | | | | - no need to have them protocol specific - no need to set pointers to them with the Curl_setup_transfer() call - make Curl_setup_transfer() operate on a transfer pointer, not connection - switch some counters from long to the more proper curl_off_t type Closes #3627
* transfer.c: do not compute length of undefined hex buffer.Patrick Monnerat2019-02-141-8/+10
| | | | | | | | | On non-ascii platforms, the chunked hex header was measured for char code conversion length, even for chunked trailers that do not have an hex header. In addition, the efective length is already known: use it. Since the hex length can be zero, only convert if needed. Reported by valgrind.
* pretransfer: don't strlen() POSTFIELDS set for GET requestsDaniel Stenberg2019-02-121-1/+4
| | | | | | | | ... since that data won't be used in the request anyway. Fixes #3548 Reported-by: Renaud Allard Close #3549
* multi: set the EXPIRE_*TIMEOUT timers at TIMER_STARTSINGLE timeDaniel Stenberg2019-02-011-6/+0
| | | | | | | | | To make sure Curl_timeleft() also thinks the timeout has been reached when one of the EXPIRE_*TIMEOUTs expires. Bug: https://curl.haxx.se/mail/lib-2019-01/0073.html Reported-by: Zhao Yisha Closes #3501
* printf: introduce CURL_FORMAT_TIMEDIFF_TRikard Falkeborn2019-01-041-4/+4
|
* printf: fix format specifiersRikard Falkeborn2019-01-041-2/+2
| | | | Closes #3426
* http: Implement trailing headers for chunked transfersAyoub Boudhar2018-12-141-21/+147
| | | | | | | | | | | | | This adds the CURLOPT_TRAILERDATA and CURLOPT_TRAILERFUNCTION options that allow a callback based approach to sending trailing headers with chunked transfers. The test server (sws) was updated to take into account the detection of the end of transfer in the case of trailing headers presence. Test 1591 checks that trailing headers can be sent using libcurl. Closes #3350
* Curl_follow: extract the Location: header field unvalidatedDaniel Stenberg2018-12-121-5/+15
| | | | | | | | | | | ... when not actually following the redirect. Otherwise we return error for this and an application can't extract the value. Test 1518 added to verify. Reported-by: Pavel Pavlov Fixes #3340 Closes #3364
* snprintf: renamed and we now only use msnprintf()Daniel Stenberg2018-11-231-2/+2
| | | | | | | | | | | The function does not return the same value as snprintf() normally does, so readers may be mislead into thinking the code works differently than it actually does. A different function name makes this easier to detect. Reported-by: Tomas Hoger Assisted-by: Daniel Gustafsson Fixes #3296 Closes #3297
* setopt: add CURLOPT_CURLUJim Fuller2018-11-091-1/+14
| | | | | | Allows an application to pass in a pre-parsed URL via a URL handle. Closes #3227
* libcurl: stop reading from paused transfersSangamkar2018-11-061-0/+5
| | | | | | | In the transfer loop it would previously not acknwledge the pause bit and continue until drained or loop ended. Closes #3240
* Curl_follow: accept non-supported schemes for "fake" redirectsDaniel Stenberg2018-11-021-1/+2
| | | | | | | | | | When not actually following the redirect and the target URL is only stored for later retrieval, curl always accepted "non-supported" schemes. This was a regression from 46e164069d1a5230. Reported-by: Brad King Fixes #3210 Closes #3215
* Fix for compiling with lwIP (3)Gisle Vanem2018-10-231-1/+1
| | | | lwIP on Windows does not have a WSAIoctl() function. But it do have a SO_SNDBUF option to lwip_setsockopt(). But it currently does nothing.