summaryrefslogtreecommitdiff
path: root/lib/sendf.c
Commit message (Collapse)AuthorAgeFilesLines
* WRITEFUNCTION: add missing set_in_callback around callbackTaiyu Len2019-05-051-1/+4
| | | | Closes #3837
* pipelining: removedDaniel Stenberg2019-04-061-33/+2
| | | | | | | As previously planned and documented in DEPRECATE.md, all pipelining code is removed. Closes #3651
* strerror: make the strerror function use local buffersDaniel Stenberg2019-02-261-3/+5
| | | | | | | | | | | | | | | | Instead of using a fixed 256 byte buffer in the connectdata struct. In my build, this reduces the size of the connectdata struct by 11.8%, from 2160 to 1904 bytes with no functionality or performance loss. This also fixes a bug in schannel's Curl_verify_certificate where it called Curl_sspi_strerror when it should have called Curl_strerror for string from GetLastError. the only effect would have been no text or the wrong text being shown for the error. Co-authored-by: Jay Satiro Closes #3612
* snprintf: renamed and we now only use msnprintf()Daniel Stenberg2018-11-231-4/+4
| | | | | | | | | | | 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
* infof: clearly indicate truncationDaniel Gustafsson2018-11-031-1/+12
| | | | | | | | | | | | | | | | | | The internal buffer in infof() is limited to 2048 bytes of payload plus an additional byte for NULL termination. Servers with very long error messages can however cause truncation of the string, which currently isn't very clear, and leads to badly formatted output. This appends a "...\n" (or just "..." in case the format didn't with a newline char) marker to the end of the string to clearly show that it has been truncated. Also include a unittest covering infof() to try and catch any bugs introduced in this quite important function. Closes #3216 Reviewed-by: Daniel Stenberg <daniel@haxx.se> Reviewed-by: Marcel Raad <Marcel.Raad@teamviewer.com>
* Curl_debug: remove dead printhost codeDaniel Stenberg2018-06-121-43/+5
| | | | | | | | | The struct field is never set (since 5e0d9aea3) so remove the use of it and remove the connectdata pointer from the prototype. Reported-by: Tejas Bug: https://curl.haxx.se/mail/lib-2018-06/0054.html Closes #2647
* cppcheck: fix warningsMarian Klymov2018-06-111-1/+1
| | | | | | | | | | | | | - 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-02-231-2/+2
| | | | | | | | Detected using the `codespell` tool. Also contains one URL protocol upgrade. Closes https://github.com/curl/curl/pull/2334
* header callback: don't chop headers into smaller piecesDaniel Stenberg2018-02-161-26/+30
| | | | | | Reported-by: Guido Berhoerster Fixes #2314 Closes #2316
* TODO fixed: Detect when called from within callbacksBjörn Stenberg2018-02-151-2/+9
| | | | Closes #2302
* include: get netinet/in.h before linux/tcp.hPer Malmberg2017-12-071-0/+4
| | | | | | | ... to allow build on older Linux dists (specifically CentOS 4.8 on gcc 4.8.5) Closes #2160
* connect: add support for new TCP Fast Open API on LinuxAlessandro Ghedini2017-11-241-1/+5
| | | | | | | | | | | The new API added in Linux 4.11 only requires setting a socket option before connecting, without the whole sento() machinery. Notably, this makes it possible to use TFO with SSL connections on Linux as well, without the need to mess around with OpenSSL (or whatever other SSL library) internals. Closes #2056
* failf: skip the sprintf() if there are no consumersDaniel Stenberg2017-10-041-17/+17
| | | | Closes #1936
* code style: use spaces around plusesDaniel Stenberg2017-09-111-4/+4
|
* code style: use spaces around equals signsDaniel Stenberg2017-09-111-6/+6
|
* BUFSIZE: rename to READBUFFER_*, make separate MASTERBUF_SIZEDaniel Stenberg2017-05-011-1/+1
|
* sendf: remove use of BUFSIZE from debug data conversionsDaniel Stenberg2017-05-011-25/+26
| | | | The buffer can have other sizes.
* buffer: use data->set.buffer_size instead of BUFSIZEDaniel Stenberg2017-05-011-6/+5
| | | | ... to properly use the dynamically set buffer size!
* failf: use private buffer, don't clobber receive bufferDaniel Stenberg2017-05-011-8/+7
|
* pause: handle mixed types of data when pausedDaniel Stenberg2017-03-281-34/+53
| | | | | | | | | | | | 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
* spelling fixesklemens2017-03-261-2/+2
| | | | Closes #1356
* Improve code readbilitySylvestre Ledru2017-03-131-5/+3
| | | | | | ... by removing the else branch after a return, break or continue. Closes #1310
* Curl_recv_has_postponed_data: silence compiler warningsDaniel Stenberg2016-12-191-0/+2
| | | | Follow-up to d00f2a8f2
* http_proxy: Fix proxy CONNECT hang on pending dataJay Satiro2016-12-191-0/+11
| | | | | | | - Check for pending data before waiting on the socket. Bug: https://github.com/curl/curl/issues/1156 Reported-by: Adam Langley
* checksrc: stricter no-space-before-paren enforcementDaniel Stenberg2016-12-131-3/+3
| | | | In order to make the code style more uniform everywhere
* checksrc: code style: use 'char *name' styleDaniel Stenberg2016-11-241-1/+1
|
* internals: rename the SessionHandle struct to Curl_easyDaniel Stenberg2016-06-221-9/+9
|
* lib: include curl_printf.h as one of the last headersDaniel Stenberg2016-04-291-2/+2
| | | | | | | | | | | | | | | | | | | | 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
* sendf.c: added ability to call recv() before send() as workaroundKarlson2k2016-04-201-1/+101
| | | | | | | | | | | | WinSock destroys recv() buffer if send() is failed. As result - server response may be lost if server sent it while curl is still sending request. This behavior noticeable on HTTP server short replies if libcurl use several send() for request (usually for POST request). To workaround this problem, libcurl use recv() before every send() and keeps received data in intermediate buffer for further processing. Fixes: #657 Closes: #668
* connect: implement TCP Fast Open for LinuxAlessandro Ghedini2016-04-181-2/+13
| | | | Closes #660
* Curl_read: check for activated HTTP/1 pipelining, not only requestedDaniel Stenberg2016-02-241-2/+5
| | | | | | | | | ... as when pipelining is used, we read things into a unified buffer and we don't do that with HTTP/2. This could then easily make programs that set CURLMOPT_PIPELINING = CURLPIPE_HTTP1|CURLPIPE_MULTIPLEX to get data intermixed or plain broken between HTTP/2 streams. Reported-by: Anders Bakken
* URLs: change all http:// URLs to https://Daniel Stenberg2016-02-031-1/+1
|
* Curl_read_plain: clean up ifdefs that break statementsFlavio Medeiros2015-11-301-2/+4
| | | | Closes #546
* CURLMOPT_PIPELINE: bit 1 is for multiplexingDaniel Stenberg2015-05-181-2/+1
|
* http2: Curl_read should not use the single bufferDaniel Stenberg2015-05-181-1/+2
| | | | | ... as it does for pipelining when we're multiplexing, as we need the different buffers to store incoming data correctly for all streams.
* 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.
* checksrc: use space before paren in "return (expr);"Daniel Stenberg2015-03-171-3/+3
|
* mprintf.h: remove #ifdef CURLDEBUGDaniel Stenberg2015-03-031-5/+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-72/+97
|
* code cleanup: we prefer 'CURLcode result'Daniel Stenberg2014-10-241-17/+17
| | | | | | | | | | | | | | ... 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)
* Curl_debug: document switch fallthroughsDaniel Stenberg2014-10-031-0/+2
|
* handler: make 'protocol' always specified as a single bitDaniel Stenberg2014-04-231-2/+2
| | | | | | | | | | | | | | | | This makes the findprotocol() function work as intended so that libcurl can properly be restricted to not support HTTP while still supporting HTTPS - since the HTTPS handler previously set both the HTTP and HTTPS bits in the protocol field. This fixes --proto and --proto-redir for most SSL protocols. This is done by adding a few new convenience defines that groups HTTP and HTTPS, FTP and FTPS etc that should then be used when the code wants to check for both protocols at once. PROTO_FAMILY_[protocol] style. Bug: https://github.com/bagder/curl/pull/97 Reported-by: drizzt
* sendf.c: Fixed compilation warning from f2d234a4dd9bccSteve Holme2013-12-271-3/+3
| | | | sendf.c:450:81: warning: Longer than 79 columns
* FILE: Fixed sending of data would always return CURLE_WRITE_ERRORSteve Holme2013-12-271-10/+10
| | | | | | Introduced in commit 2a4ee0d2215556 sending of data via the FILE protocol would always return CURLE_WRITE_ERROR regardless of whether CURL_WRITEFUNC_PAUSE was returned from the callback function or not.
* FILE: we don't support paused transfers using this protocolDaniel Stenberg2013-12-261-2/+10
| | | | | | | | | Make sure that we detect such attempts and return a proper error code instead of silently handling this in problematic ways. Updated the documentation to mention this limitation. Bug: http://curl.haxx.se/bug/view.cgi?id=1286
* 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
|
* FTP: remove krb4 supportDaniel Stenberg2013-08-251-9/+1
| | | | | | | | | | We've announced this pending removal for a long time and we've repeatedly asked if anyone would care or if anyone objects. Nobody has objected. It has probably not even been working for a good while since nobody has tested/used this code recently. The stuff in krb4.h that was generic enough to be used by other sources is now present in security.h
* Multiple pipelines and limiting the number of connections.Linus Nielsen Feltzing2013-03-131-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introducing a number of options to the multi interface that allows for multiple pipelines to the same host, in order to optimize the balance between the penalty for opening new connections and the potential pipelining latency. Two new options for limiting the number of connections: CURLMOPT_MAX_HOST_CONNECTIONS - Limits the number of running connections to the same host. When adding a handle that exceeds this limit, that handle will be put in a pending state until another handle is finished, so we can reuse the connection. CURLMOPT_MAX_TOTAL_CONNECTIONS - Limits the number of connections in total. When adding a handle that exceeds this limit, that handle will be put in a pending state until another handle is finished. The free connection will then be reused, if possible, or closed if the pending handle can't reuse it. Several new options for pipelining: CURLMOPT_MAX_PIPELINE_LENGTH - Limits the pipeling length. If a pipeline is "full" when a connection is to be reused, a new connection will be opened if the CURLMOPT_MAX_xxx_CONNECTIONS limits allow it. If not, the handle will be put in a pending state until a connection is ready (either free or a pipe got shorter). CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE - A pipelined connection will not be reused if it is currently processing a transfer with a content length that is larger than this. CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE - A pipelined connection will not be reused if it is currently processing a chunk larger than this. CURLMOPT_PIPELINING_SITE_BL - A blacklist of hosts that don't allow pipelining. CURLMOPT_PIPELINING_SERVER_BL - A blacklist of server types that don't allow pipelining. See the curl_multi_setopt() man page for details.
* build: fix circular header inclusion with other packagesYang Tse2013-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit renames lib/setup.h to lib/curl_setup.h and renames lib/setup_once.h to lib/curl_setup_once.h. Removes the need and usage of a header inclusion guard foreign to libcurl. [1] Removes the need and presence of an alarming notice we carried in old setup_once.h [2] ---------------------------------------- 1 - lib/setup_once.h used __SETUP_ONCE_H macro as header inclusion guard up to commit ec691ca3 which changed this to HEADER_CURL_SETUP_ONCE_H, this single inclusion guard is enough to ensure that inclusion of lib/setup_once.h done from lib/setup.h is only done once. Additionally lib/setup.h has always used __SETUP_ONCE_H macro to protect inclusion of setup_once.h even after commit ec691ca3, this was to avoid a circular header inclusion triggered when building a c-ares enabled version with c-ares sources available which also has a setup_once.h header. Commit ec691ca3 exposes the real nature of __SETUP_ONCE_H usage in lib/setup.h, it is a header inclusion guard foreign to libcurl belonging to c-ares's setup_once.h The renaming this commit does, fixes the circular header inclusion, and as such removes the need and usage of a header inclusion guard foreign to libcurl. Macro __SETUP_ONCE_H no longer used in libcurl. 2 - Due to the circular interdependency of old lib/setup_once.h and the c-ares setup_once.h header, old file lib/setup_once.h has carried back from 2006 up to now days an alarming and prominent notice about the need of keeping libcurl's and c-ares's setup_once.h in sync. Given that this commit fixes the circular interdependency, the need and presence of mentioned notice is removed. All mentioned interdependencies come back from now old days when the c-ares project lived inside a curl subdirectory. This commit removes last traces of such fact.