summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* sendf: move Curl_sendf to dict.c and make it staticDaniel Stenberg2020-09-284-76/+71
| | | | | | | ... as the only remaining user of that function. Also fix gopher.c to instead use Curl_write() Closes #6020
* schannel: return CURLE_PEER_FAILED_VERIFICATION for untrusted rootDaniel Stenberg2020-09-281-0/+4
| | | | | | | | | | | | This matches what is returned in other TLS backends in the same situation. Reviewed-by: Jay Satiro Reviewed-by: Emil Engler Follow-up to 5a3efb1 Reported-by: iammrtau on github Fixes #6003 Closes #6018
* ftp: make a 552 response return CURLE_REMOTE_DISK_FULLDaniel Stenberg2020-09-261-1/+10
| | | | | | | | | Added test 348 to verify. Added a 'STOR' command to the test FTP server to enable test 348. Documented the command in FILEFORMAT.md Reported-by: Duncan Wilcox Fixes #6016 Closes #6017
* 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
* ngtcp2: adapt to new NGTCP2_PROTO_VER_MAX defineDaniel Stenberg2020-09-251-8/+4
| | | | Closes #6012
* strerror: honor Unicode API choice on WindowsJavier Blazquez2020-09-251-15/+7
| | | | Closes #6005
* imap: make imap_send use dynbuf for the send buffer managementDaniel Stenberg2020-09-253-19/+18
| | | | | | Reuses the buffer and thereby reduces number of mallocs over a transfer. Closes #6010
* Curl_send: return error when pre_receive_plain can't mallocDaniel Stenberg2020-09-251-3/+9
| | | | | | | ... will probably trigger some false DEAD CODE positives on non-windows code analyzers for the conditional code. Closes #6011
* ftp: separate FTPS from FTP over "HTTPS proxy"Daniel Stenberg2020-09-242-10/+7
| | | | | | | | | | When using HTTPS proxy, SSL is used but not in the view of the FTP protocol handler itself so separate the connection's use of SSL from the FTP control connection's sue. Reported-by: Mingtao Yang Fixes #5523 Closes #6006
* pingpong: use a dynbuf for the *_pp_sendf() functionDaniel Stenberg2020-09-236-31/+32
| | | | | | | | | | | | | | ... reuses the same dynamic buffer instead of doing repeated malloc/free cycles. Test case 100 (FTP dir list PASV) does 7 fewer memory allocation calls after this change in my test setup (132 => 125), curl 7.72.0 needed 140 calls for this. Test case 103 makes 9 less allocations now (130). Down from 149 in 7.72.0. Closes #6004
* dynbuf: add Curl_dyn_vaddfDaniel Stenberg2020-09-232-8/+24
| | | | Closes #6004
* dynbuf: make *addf() not require extra mallocsDaniel Stenberg2020-09-234-18/+45
| | | | | | | | | | | | ... by introducing a printf() function that appends directly into a dynbuf: Curl_dyn_vprintf(). This avoids the mandatory extra malloc so if the buffer is already big enough it can just printf directly into it. Since this less-malloc version requires tthe use of a library internal printf function, we only provide this version when building libcurl and not for the dynbuf code that is used when building the curl tool. Closes #5998
* pingpong: remove a malloc per Curl_pp_vsendf callDaniel Stenberg2020-09-221-9/+11
| | | | | | This typically makes 7-9 fewer mallocs per FTP transfer. Closes #5997
* symbian: drop supportDaniel Stenberg2020-09-2210-836/+9
| | | | | | | | | 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
* curl_krb5.h: rename from krb5.hDaniel Stenberg2020-09-224-6/+6
| | | | | | | | | Follow-up from f4873ebd0be32cf Turns out some older openssl installations go bananas otherwise. Reported-by: Tom van der Woerdt Fixes #5995 Closes #5996
* http_proxy: do not count proxy headers in the header bytecountDaniel Stenberg2020-09-221-1/+0
| | | | | | | | | | ... as that counter is subsequently used to detect if nothing was returned from the peer. This made curl return CURLE_OK when it should have returned CURLE_GOT_NOTHING. Fixes #5992 Reported-by: Tom van der Woerdt Closes #5994
* setopt: return CURLE_BAD_FUNCTION_ARGUMENT on bad argumentDaniel Stenberg2020-09-221-17/+9
| | | | | | | Fixed two return code mixups. CURLE_UNKNOWN_OPTION is saved for when the option is, yeah, not known. Clarified this in the setopt man page too. Closes #5993
* krb5: merged security.c and krb specific FTP functions in hereDaniel Stenberg2020-09-217-678/+591
| | | | | | | | | | | These two files were always tightly connected and it was hard to understand what went into which. This also allows us to make the ftpsend() function static (moved from ftp.c). Removed security.c Renamed curl_sec.h to krb5.h Closes #5987
* Curl_handler: add 'family' to each protocolDaniel Stenberg2020-09-2123-116/+63
| | | | | | | Makes get_protocol_family() faster and it moves the knowledge about the "families" to each protocol handler, where it belongs. Closes #5986
* parsedate: tune the date to epoch conversionDaniel Stenberg2020-09-211-46/+11
| | | | | | | | | By avoiding an unnecessary error check and the temp use of the tm struct, the time2epoch conversion function gets a little bit faster. When repeating test 517, the updated version is perhaps 1% faster (on one particular build on one particular architecture). Closes #5985
* ftp: avoid risk of reading uninitialized integersDaniel Stenberg2020-09-181-2/+2
| | | | | | | | | If the received PASV response doesn't match the expected pattern, we could end up reading uninitialized integers for IP address and port number. Issue pointed out by muse.dev Closes #5972
* easy_reset: clear retry counterQuentin Balland2020-09-181-0/+1
| | | | | Closes #5975 Fixes #5974
* ftp: get rid of the PPSENDF macroDaniel Stenberg2020-09-181-156/+150
| | | | | | | The use of such a macro hides some of what's actually going on to the reader and is generally disapproved of in the project. Closes #5971
* urlapi: use more Curl_safefreeEmil Engler2020-09-171-4/+2
| | | | Closes #5968
* multi: align WinSock mask variables in Curl_multi_waitMarc Hoersken2020-09-171-11/+11
| | | | | | | | | | Also skip pre-checking sockets to set timeout_ms to 0 after the first socket has been detected to be ready. Reviewed-by: rcombs on github Reviewed-by: Daniel Stenberg Follow up to #5886
* multi: reuse WinSock events variable in Curl_multi_waitMarc Hoersken2020-09-171-12/+11
| | | | | | | | | | | Since the struct is quite large (1 long and 10 ints) we declare it once at the beginning of the function instead of multiple times inside loops to avoid stack movements. Reviewed-by: Viktor Szakats Reviewed-by: Daniel Stenberg Closes #5886
* vtls: deduplicate client certificates in ssl_config_dataGergely Nagy2020-09-1411-38/+36
| | | | Closes #5629
* ftp: a 550 response to SIZE returns CURLE_REMOTE_FILE_NOT_FOUNDDaniel Stenberg2020-09-141-1/+5
| | | | | | | | | | | | | | | | | | | | This is primarily interesting for cases where CURLOPT_NOBODY is set as previously curl would not return an error for this case. MDTM getting 550 now also returns this error (it returned CURLE_FTP_COULDNT_RETR_FILE before) in order to unify return codes for missing files across protocols and specific FTP commands. libcurl already returns error on a 550 as a MDTM response (when CURLOPT_FILETIME is set). If CURLOPT_NOBODY is not set, an error would happen subsequently anyway since the RETR command would fail. Add test 1913 and 1914 to verify. Updated several tests accordingly due to the updated SIZE behavior. Reported-by: Tomas Berger Fixes #5953 Closes #5957
* imap: set cselect_bits to CURL_CSELECT_IN initiallyAntarpreet Singh2020-09-141-0/+3
| | | | | | | | | | | | | | | ... when continuing a transfer from a FETCH response. When the size of the file was small enough that the entirety of the transfer happens in a single go and schannel buffers holds the entire data. However, it wasn't completely read in Curl_pp_readresp since a line break was found before that could happen. So, by the time we are in imap_state_fetch_resp - there's data in buffers that needs to be read via Curl_read but nothing to read from the socket. After we setup a transfer (Curl_setup_transfer), curl just waits on the socket state to change - which doesn't happen since no new data ever comes. Closes #5961
* dynbuf: provide curlx_ names for reuse by the curl toolDaniel Stenberg2020-09-142-5/+24
| | | | Closes #5946
* dynbuf: make sure Curl_dyn_tail() zero terminatesDaniel Stenberg2020-09-141-0/+1
| | | | Closes #5959
* http: consolidate nghttp2_session_mem_recv() call pathsLaramie Leavitt2020-09-101-88/+29
| | | | | | | | | | | | | | | | | | | | | Previously there were several locations that called nghttp2_session_mem_recv and handled responses slightly differently. Those have been converted to call the existing h2_process_pending_input() function. Moved the end-of-session check to h2_process_pending_input() since the only place the end-of-session state can change is after nghttp2 processes additional input frames. This will likely fix the fuzzing error. While I don't have a root cause the out-of-bounds read seems like a use after free, so moving the nghttp2_session_check_request_allowed() call to a location with a guaranteed nghttp2 session seems reasonable. Also updated a few nghttp2 callsites to include error messages and added a few additional error checks. Closes #5648
* base64: also build for pop3 and imapDaniel Stenberg2020-09-101-0/+2
| | | | | | | | Follow-up to the fix in 20417a13fb8f83 Reported-by: Michael Olbrich Fixes #5937 Closes #5948
* base64: enable in build with SMTPDaniel Stenberg2020-09-091-1/+2
| | | | | | | | The oauth2 support is used with SMTP and it uses base64 functions. Reported-by: Michael Olbrich Fixes #5937 Closes #5938
* lib: fix -Wassign-enum warningsDaniel Stenberg2020-09-085-7/+8
| | | | | | | | | | configure --enable-debug now enables -Wassign-enum with clang, identifying several enum "abuses" also fixed. Reported-by: Gisle Vanem Bug: https://github.com/curl/curl/commit/879007f8118771f4896334731aaca5850a154675#commitcomment-42087553 Closes #5929
* url: use blank credentials when using proxy w/o username and passwordDiven Qi2020-09-081-2/+4
| | | | | | | Fixes proxy regression brought in commit ad829b21ae (7.71.0) Fixed #5911 Closes #5914
* openssl: consider ALERT_CERTIFICATE_EXPIRED a failed verificationDaniel Stenberg2020-09-071-1/+2
| | | | | | | | | | | If the error reason from the lib is SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED, libcurl will return CURLE_PEER_FAILED_VERIFICATION and not CURLE_SSL_CONNECT_ERROR. This unifies the libcurl return code and makes libressl run test 313 (CRL testing) fine. Closes #5934
* altsvc: clone setting in curl_easy_duphandlebagder/altsvc-duphandleDaniel Stenberg2020-09-064-7/+18
| | | | | | | | | | | | 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
* build: drop support for building with WatcomDaniel Stenberg2020-09-052-275/+1
| | | | | | | These files are not maintained, they seem to have no users, Watcom compilers look like not having users nor releases anymore. Closes #5918
* easygetopt: pass a valid enum to avoid compiler warningDaniel Stenberg2020-09-051-1/+2
| | | | | | | | | "integer constant not in range of enumerated type 'CURLoption'" Reported-by: Gisle Vanem Bug: https://github.com/curl/curl/commit/6ebe63fac23f38df911edc348e8ccc72280f9434#commitcomment-42042843 Closes #5915
* connect.c: remove superfluous 'else' in Curl_getconnectinfoihsinme2020-09-041-2/+1
| | | | Closes #5912
* libssh2: pass on the error from ssh_force_knownhost_key_typecbe2020-09-031-0/+1
| | | | Closes #5909
* http_proxy: do not crash with HTTPS_PROXY and NO_PROXY setMartin Bašti2020-09-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... in case NO_PROXY takes an effect Without this patch, the following command crashes: $ GIT_CURL_VERBOSE=1 NO_PROXY=github.com HTTPS_PROXY=https://example.com \ git clone https://github.com/curl/curl.git Minimal libcurl-based reproducer: #include <curl/curl.h> int main() { CURL *curl = curl_easy_init(); if(curl) { CURLcode ret; curl_easy_setopt(curl, CURLOPT_URL, "https://github.com/"); curl_easy_setopt(curl, CURLOPT_PROXY, "example.com"); /* set the proxy type */ curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS); curl_easy_setopt(curl, CURLOPT_NOPROXY, "github.com"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); ret = curl_easy_perform(curl); curl_easy_cleanup(curl); return ret; } return -1; } Assisted-by: Kamil Dudka Bug: https://bugzilla.redhat.com/1873327 Closes #5902
* openssl: avoid error conditions when importing native CADaniel Stenberg2020-09-021-2/+2
| | | | | | | | The code section that is OpenSSL 3+ specific now uses the same logic as is used in the version < 3 section. It caused a compiler error without it. Closes #5907
* setopt: avoid curl_ on local variableDaniel Stenberg2020-09-021-2/+2
| | | | Closes #5906
* mqtt.c: avoid curl_ prefix on local variableDaniel Stenberg2020-09-021-3/+3
| | | | Closes #5906
* wildcard: strip "curl_" prefix from private symbolsDaniel Stenberg2020-09-021-4/+4
| | | | Closes #5906
* vtls: make it 'struct Curl_ssl_session'Daniel Stenberg2020-09-025-11/+11
| | | | | | Use uppercase C for internal symbols. Closes #5906
* curl_threads: make it 'struct Curl_actual_call'Daniel Stenberg2020-09-021-3/+3
| | | | | | Internal names should not be prefixed "curl_" Closes #5906
* schannel: make it 'struct Curl_schannel*'Daniel Stenberg2020-09-022-13/+13
| | | | | | As internal global names should use captical C. Closes #5906