summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* mime: mention CURL_DISABLE_MIME in commentErik Stenlund2021-10-201-1/+2
| | | | | | | CURL_DISABLE_MIME is not mentioned in the comment describing the if else preprocessor directive. Closes #7882
* tls: remove newline from three infof() callsDaniel Stenberg2021-10-193-3/+3
| | | | | | | | Follow-up to e7416cf Reported-by: billionai on github Fixes #7879 Closes #7880
* curl_gssapi: fix build warnings by removing constDaniel Stenberg2021-10-191-2/+2
| | | | | | | | | Follow-up to 20e980f85b0ea6 In #7875 these inits were modified but I get two warnings that these new typecasts are necessary for. Closes #7876
* curl_gssapi: fix link error on macOS MontereyBo Anderson2021-10-191-4/+6
| | | | | Fixes #7657 Closes #7875
* checksrc: improve the SPACESEMICOLON error messageDaniel Stenberg2021-10-181-6/+2
| | | | | | and adjust the MULTISPACE one to use plural Closes #7866
* url: set "k->size" -1 at start of requestDaniel Stenberg2021-10-181-1/+1
| | | | | | | The size of the transfer is unknown at that point. Fixes #7871 Closes #7872
* doh: remove experimental code for DoH with GETDaniel Gustafsson2021-10-182-24/+2
| | | | | | | | | | The code for sending DoH requests with GET was never enabled in a way such that it could be used or tested. As there haven't been requests for this feature, and since it at this is effectively dead, remove it and favor reimplementing the feature in case anyone is interested. Closes #7870 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* checksrc: ignore preprocessor linesDaniel Stenberg2021-10-171-9/+28
| | | | | | | | | | | | | | | | In order to check the actual code better, checksrc now ignores everything that look like preprocessor instructions. It also means that code in macros are now longer checked. Note that some rules then still don't need to be followed when code is exactly below a cpp instruction. Removes two checksrc exceptions we needed previously because of preprocessor lines being checked. Reported-by: Marcel Raad Fixes #7863 Closes #7864
* urlapi: skip a strlen(), pass in zeroDaniel Stenberg2021-10-151-2/+1
| | | | | | | | | ... to let curl_easy_escape() itself do the strlen. This avoids a (false positive) Coverity warning and it avoids us having to store the strlen() return value in an int variable. Reviewed-by: Daniel Gustafsson Closes #7862
* misc: update copyright yearsDaniel Stenberg2021-10-152-2/+2
|
* http: set content length earlierJay Satiro2021-10-153-45/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Make content length (ie download size) accessible to the user in the header callback, but only after all headers have been processed (ie only in the final call to the header callback). Background: For a long time the content length could be retrieved in the header callback via CURLINFO_CONTENT_LENGTH_DOWNLOAD_T as soon as it was parsed by curl. Changes were made in 8a16e54 (precedes 7.79.0) to ignore content length if any transfer encoding is used. A side effect of that was that content length was not set by libcurl until after the header callback was called the final time, because until all headers are processed it cannot be determined if content length is valid. This change keeps the same intention --all headers must be processed-- but now the content length is available before the final call to the header function that indicates all headers have been processed (ie a blank header). Bug: https://github.com/curl/curl/commit/8a16e54#r57374914 Reported-by: sergio-nsk@users.noreply.github.com Co-authored-by: Daniel Stenberg Fixes https://github.com/curl/curl/issues/7804 Closes https://github.com/curl/curl/pull/7803
* aws-sigv4: make signature work when post data is binaryAbhinav Singh2021-10-151-1/+6
| | | | | | | | | User sets the post fields size for binary data. Hence, we should not be using strlen on it. Added test 1937 and 1938 to verify. Closes #7844
* openssl: with OpenSSL 1.1.0+ a failed RAND_status means goawayDaniel Stenberg2021-10-141-12/+23
| | | | | | | | | One reason we know it can fail is if a provider is used that doesn't do a proper job or is wrongly configured. Reported-by: Michael Baentsch Fixes #7840 Closes #7856
* http: remove assert that breaks hyperDaniel Stenberg2021-10-141-1/+1
| | | | | | Reported-by: Jay Satiro Fixes #7852 Closes #7855
* http_proxy: fix one more result assign for hyperDaniel Stenberg2021-10-141-1/+1
| | | | | | and remove the bad assert again, since it was run even with no error! Closes #7854
* c-hyper: make Curl_http propagate errors betterDaniel Stenberg2021-10-141-41/+78
| | | | | | | | Pass on better return codes when errors occur within Curl_http instead of insisting that CURLE_OUT_OF_MEMORY is the only possible one. Pointed-out-by: Jay Satiro Closes #7851
* http_proxy: make hyper CONNECT() return the correct error codeDaniel Stenberg2021-10-141-12/+39
| | | | | | | | | For every 'goto error', make sure the result variable holds the error code for what went wrong. Reported-by: RafaƂ Mikrut Fixes #7825 Closes #7846
* http2: make getsock not wait for write if there's no remote windowDaniel Stenberg2021-10-121-5/+21
| | | | | | | | | | While uploading, check for remote window availability in the getsock function so that we don't wait for a writable socket if no data can be sent. Reported-by: Steini2000 on github Fixes #7821 Closes #7839
* urlapi: URL decode percent-encoded host namesDaniel Stenberg2021-10-111-19/+90
| | | | | | | | | | | | | | | | | | | | | | The host name is stored decoded and can be encoded when used to extract the full URL. By default when extracting the URL, the host name will not be URL encoded to work as similar as possible as before. When not URL encoding the host name, the '%' character will however still be encoded. Getting the URL with the CURLU_URLENCODE flag set will percent encode the host name part. As a bonus, setting the host name part with curl_url_set() no longer accepts a name that contains space, CR or LF. Test 1560 has been extended to verify percent encodings. Reported-by: Noam Moshe Reported-by: Sharon Brizinov Reported-by: Raul Onitza-Klugman Reported-by: Kirill Efimov Fixes #7830 Closes #7834
* c-hyper: use hyper_request_set_uri_parts to make h2 betterDaniel Stenberg2021-10-081-6/+31
| | | | | | | | and make sure to not send Host: over h2. Fixes #7679 Reported-by: David Cook Closes #7827
* sha256: use high-level EVP interface for OpenSSLMarcel Raad2021-10-071-41/+70
| | | | | | | Available since OpenSSL 0.9.7. The low-level SHA256 interface is deprecated in OpenSSL v3, and its usage was discouraged even before. Closes https://github.com/curl/curl/pull/7808
* curl_ntlm_core: use OpenSSL only if DES is availableMarcel Raad2021-10-071-5/+12
| | | | | | | This selects another SSL backend then if available, or otherwise at least gives a meaningful error message. Closes https://github.com/curl/curl/pull/7808
* md5: fix compilation with OpenSSL 3.0 APIMarcel Raad2021-10-071-7/+15
| | | | | | | | | | Only use OpenSSL's MD5 code if it's available. Also fix wolfSSL build with `NO_MD5`, in which case neither the wolfSSL/OpenSSL implementation nor the fallback implementation was used. Closes https://github.com/curl/curl/pull/7808
* version_win32: use actual version instead of manifested versionJay Satiro2021-10-072-5/+48
| | | | | | | | | | | | | | | | | | - Use RtlVerifyVersionInfo instead of VerifyVersionInfo, when possible. Later versions of Windows have normal version functions that compare and return versions based on the way the application is manifested, instead of the actual version of Windows the application is running on. We prefer the actual version of Windows so we'll now call the Rtl variant of version functions (RtlVerifyVersionInfo) which does a proper comparison of the actual version. Reported-by: Wyatt O'Day Ref: https://github.com/curl/curl/pull/7727 Fixes https://github.com/curl/curl/issues/7742 Closes https://github.com/curl/curl/pull/7810
* http: fix Basic auth with empty name field in URLDaniel Stenberg2021-10-061-1/+1
| | | | | | | | Add test 367 to verify. Reported-by: Rick Lane Fixes #7819 Closes #7820
* CURLOPT_MAXLIFETIME_CONN: maximum allowed lifetime for conn reuseJeffrey Tolar2021-10-064-5/+30
| | | | | | | | | ... and close connections that are too old instead of reusing them. By default, this behavior is disabled. Bug: https://curl.se/mail/lib-2021-09/0058.html Closes #7751
* sasl: binary messagesPatrick Monnerat2021-10-025-225/+304
| | | | | | | | | | Capabilities of sasl module are extended to exchange messages in binary as an alternative to base64. If http authentication flags have been set, those are used as sasl default preferred mechanisms. Closes #6930
* wolfssl: use for SHA256, MD4, MD5, and setting DES odd parityHayden Roche2021-10-025-7/+37
| | | | | | | | Prior to this commit, OpenSSL could be used for all these functions, but not wolfSSL. This commit makes it so wolfSSL will be used if USE_WOLFSSL is defined. Closes #7806
* lib/mk-ca-bundle.pl: skip certs passed Not Valid After dateDaniel Stenberg2021-09-301-2/+18
| | | | | | | | | With this change applied, the now expired 'DST Root CA X3' cert will no longer be included in the output. Details: https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/ Closes #7801
* wolfssl: allow setting of groups/curvesAnthony Hu2021-09-301-1/+70
| | | | | | | In particular, the quantum safe KEM and hybrid curves if wolfSSL is built to support them. Closes #7728
* connnect: use sysaddr_un fron sys/un.h or custom-defined for windowsJan Mazur2021-09-302-2/+3
| | | | Closes #7737
* hostip: Move allocation to clarify there is no memleakRikard Falkeborn2021-09-301-3/+3
| | | | | | | | | | By just glancing at the code, it looks like there is a memleak if the call to Curl_inet_pton() fails. Looking closer, it is clear that the call to Curl_inet_pton() can not fail, so the code will never leak memory. However, we can make this obvious by moving the allocation after the if-statement. Closes https://github.com/curl/curl/pull/7796
* CMake: remove `HAVE_WINSOCK_H` definitionMarcel Raad2021-09-291-3/+0
| | | | | | It's not used anymore. Closes https://github.com/curl/curl/pull/7795
* config: remove `HAVE_WINSOCK_H` definitionMarcel Raad2021-09-296-20/+0
| | | | | | It's not used anymore. Closes https://github.com/curl/curl/pull/7795
* lib: remove `HAVE_WINSOCK_H` usageMarcel Raad2021-09-293-12/+3
| | | | | | | WinSock v1 is not supported anymore. Exclusively use `HAVE_WINSOCK2_H` instead. Closes https://github.com/curl/curl/pull/7795
* easyoptions: add the two new PRE* optionsDaniel Stenberg2021-09-292-1/+3
| | | | | | | | | | Follow-up to a517378de58358a Also fix optiontable.pl to do the correct remainder on the entry. Reported-by: Gisle Vanem Bug: https://github.com/curl/curl/commit/a517378de58358a85b7cfe9efecb56051268f629#commitcomment-57224830 Closes #7791
* Revert "build: remove checks for WinSock 1"Daniel Stenberg2021-09-2910-3/+35
| | | | | | | | Due to CI issues This reverts commit c2ea04f92b00b6271627cb218647527b5a50f2fc. Closes #7790
* lib: avoid fallthrough cases in switch statementsDaniel Gustafsson2021-09-299-65/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit b5a434f7f0ee4d64857f8592eced5b9007d83620 inhibits the warning on implicit fallthrough cases, since the current coding of indicating fallthrough with comments is falling out of fashion with new compilers. This attempts to make the issue smaller by rewriting fallthroughs to no longer fallthrough, via either breaking the cases or turning switch statements into if statements. lib/content_encoding.c: the fallthrough codepath is simply copied into the case as it's a single line. lib/http_ntlm.c: the fallthrough case skips a state in the state- machine and fast-forwards to NTLMSTATE_LAST. Do this before the switch statement instead to set up the states that we actually want. lib/http_proxy.c: the fallthrough is just falling into exiting the switch statement which can be done easily enough in the case. lib/mime.c: switch statement rewritten as if statement. lib/pop3.c: the fallthrough case skips to the next state in the statemachine, do this explicitly instead. lib/urlapi.c: switch statement rewritten as if statement. lib/vssh/wolfssh.c: the fallthrough cases fast-forwards the state machine, do this by running another iteration of the switch statement instead. lib/vtls/gtls.c: switch statement rewritten as if statement. lib/vtls/nss.c: the fallthrough codepath is simply copied into the case as it's a single line. Also twiddle a comment to not be inside a non-brace if statement. Closes: #7322 See-also: #7295 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* config-win32ce: enable WinSock 2Marcel Raad2021-09-281-2/+2
| | | | | | | | | WinSock 2.2 is supported by Windows CE .NET 4.1 (from 2002, out of support since 2013). Ref: https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms899586(v=msdn.10) Closes https://github.com/curl/curl/pull/7778
* build: remove checks for WinSock 1Marcel Raad2021-09-2810-35/+3
| | | | | | It's not supported anymore. Closes https://github.com/curl/curl/pull/7778
* NTLM: use DES_set_key_unchecked with OpenSSLDaniel Stenberg2021-09-271-1/+1
| | | | | | | | | | ... as the previously used function DES_set_key() will in some cases reject using a key that it deems "weak" which will cause curl to continue using the unitialized buffer content as key instead. Assisted-by: Harry Sintonen Fixes #7779 Closes #7781
* CURLOPT_PREREQFUNCTION: add new callbackMax Dymond2021-09-274-1/+31
| | | | | | | | | | | | | | Triggered before a request is made but after a connection is set up Changes: - callback: Update docs and callback for pre-request callback - Add documentation for CURLOPT_PREREQDATA and CURLOPT_PREREQFUNCTION, - Add redirect test and callback failure test - Note that the function may be called multiple times on a redirection - Disable new 2086 test due to Windows weirdness Closes #7477
* urlapi: support UNC paths in file: URLs on WindowsSergey Markelov2021-09-271-6/+34
| | | | | | | | | | - file://host.name/path/file.txt is a valid UNC path \\host.name\path\files.txt to a non-local file transformed into URI (RFC 8089 Appendix E.3) - UNC paths on other OSs must be smb: URLs Closes #7366
* urlapi: add curl_url_strerror()i-ky2021-09-272-1/+74
| | | | | | | | | | Add curl_url_strerror() to convert CURLUcode into readable string and facilitate easier troubleshooting in programs using URL API. Extend CURLUcode with CURLU_LAST for iteration in unit tests. Update man pages with a mention of new function. Update example code and tests with new functionality where it fits. Closes #7605
* libssh2: add SHA256 fingerprint supportMats Lindestam2021-09-264-24/+143
| | | | | | | Added support for SHA256 fingerprint in command line curl and in libcurl. Closes #7646
* libcurl.rc: switch out the copyright symbol for plain ASCIIDaniel Stenberg2021-09-261-2/+2
| | | | | | | Reported-by: Vitaly Varyvdin Assisted-by: Viktor Szakats Fixes #7765 Closes #7776
* ngtcp2: fix QUIC transport parameter versionJun-ya Kato2021-09-251-6/+5
| | | | | | | fix inappropriate version setting for QUIC transport parameters. this patch keeps curl with ngtcp2 uses QUIC draft version (h3-29). Closes #7771
* vtls: Fix a memory leak if an SSL session cannot be added to the cacheMichael Kaufmann2021-09-2410-16/+36
| | | | | | | | | | | | | | | On connection shutdown, a new TLS session ticket may arrive after the SSL session cache has already been destructed. In this case, the new SSL session cannot be added to the SSL session cache. The callers of Curl_ssl_addsessionid() need to know whether the SSL session has been added to the cache. If it has not been added, the reference counter of the SSL session must not be incremented, or memory used by the SSL session must be freed. This is now possible with the new output parameter "added" of Curl_ssl_addsessionid(). Fixes #7683 Closes #7752
* llist: remove redundant code, branch will not be executedh1zzz2021-09-241-3/+1
| | | | Closes #7770
* libssh2: Get the version at runtime if possibleJoel Depooter2021-09-241-1/+1
| | | | | | | | | | | Previously this code used a compile time constant, meaning that libcurl always reported the libssh2 version that libcurl was built with. This could differ from the libssh2 version actually being used. The new code uses the CURL_LIBSSH2_VERSION macro, which is defined in ssh.h. The macro calls the libssh2_version function if it is available, otherwise it falls back to the compile time version. Closes https://github.com/curl/curl/pull/7768