summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* hostip: include easy_lock.h before using GLOBAL_INIT_IS_THREADSAFEDaniel Stenberg2023-05-172-15/+4
| | | | | | | | | | Since that header file is the only place that define can be defined. Reported-by: Marc Deslauriers Follow-up to 13718030ad4b3209 Closes #11121
* ssh: Add support for libssh2 read timeoutDaniel Silverstone2023-05-151-0/+10
| | | | | | | | | | | | Hook the new (1.11.0 or newer) libssh2 support for setting a read timeout into the SERVER_RESPONSE_TIMEOUT option. With this done, clients can use the standard curl response timeout setting to also control the time that libssh2 will wait for packets from a slow server. This is necessary to enable use of very slow SFTP servers. Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk> Closes #10965
* md(4|5): don't use deprecated iOS functionsMarcel Raad2023-05-132-6/+10
| | | | | | | | | | | They are marked as deprecated in iOS 13.0, which might result in warnings-as-errors. Also, use `*_MIN_REQUIRED` instead of `*_MIN_ALLOWED`, which seems to be what's currently used. Bug: https://github.com/curl/curl/issues/11098 Closes https://github.com/curl/curl/pull/11102
* md4: only build when usedMarcel Raad2023-05-131-2/+2
| | | | | | | | Its only usage in curl_ntlm_core.c is guarded by `USE_CURL_NTLM_CORE`, so let's use this here too. Ref: https://github.com/curl/curl/issues/11098 Closes https://github.com/curl/curl/pull/11102
* url: fix null dispname for --connect-to optionShohei Maeda2023-05-121-5/+5
| | | | Closes #11106
* headers: clear (possibly) lingering pointer in initDaniel Stenberg2023-05-121-0/+1
| | | | | | | | | | The "prevhead" pointer is used for the headers storage but was not cleared correctly in init, which made it possible to act up when a handle is reused. Reported-by: Steve Herrell Fixes #11101 Closes #11103
* ngtcp2: use 0.15.0Daniel Stenberg2023-05-121-20/+17
| | | | | | | | | - nghttp3 0.11.0 - nghttp2 1.53.0 Adapt to new API calls Closes #11031
* openssl: fix indentJay Satiro2023-05-101-1/+1
|
* hostip: use time_t for storing oldest DNS entryDaniel Stenberg2023-05-091-6/+10
| | | | | | | | | | Theoretically, the oldest time could overflow an int. In practice that won't happen, but let's do this to please analyzers. Follow-up to 9ed7d56e044f5aa1b2928ccde6245d0 Pointed out by Coverity. Closes #11094
* http: free the url before storing a new copyDaniel Stenberg2023-05-091-1/+1
| | | | | | | | To avoid a memory-leak. Reported-by: Hiroki Kurosawa Closes #11093
* libssh2: free fingerprint betterDaniel Stenberg2023-05-081-2/+1
| | | | | Reported-by: Wei Chong Tan Closes #11088
* hostip: enforce a maximum DNS cache size independent of timeout valueDaniel Stenberg2023-05-081-11/+32
| | | | | | | | | | To reduce the damage an application can cause if using -1 or other ridiculous timeout values and letting the cache live long times. The maximum number of entries in the DNS cache is now totally arbitrarily and hard-coded set to 29999. Closes #11084
* hostip: store dns timeout as 'int'Daniel Stenberg2023-05-081-2/+2
| | | | | ... because it set and held as an 'int' elsewhere and can never be larger.
* transfer: refuse POSTFIELDS + RESUME_FROM comboDaniel Stenberg2023-05-081-0/+6
| | | | | | | | | | | | | The code assumes that such a resume is wanting to continue an upload using the read callback, and since POSTFIELDS is done without callback libcurl will just misbehave. This combo will make the transfer fail with CURLE_BAD_FUNCTION_ARGUMENT with an explanation in the error message. Reported-by: Smackd0wn on github Fixes #11081 Closes #11083
* quiche: disable pacing while pacing is not actually performedFrançois Michel2023-05-031-0/+1
| | | | Closes #11068
* easy_cleanup: require a "good" handle to actDaniel Stenberg2023-05-021-8/+6
| | | | | | | | | By insisting that the passed in handle is "good" (the magic number is intact), this can limit the potential damage if a bad pointer is passed in. Like when this function is called twice on the same handle pointer. Ref: #10964 Closes #11061
* amiga: Fix CA certificate paths for AmiSSL and MorphOSAndreas Falkenhahn2023-05-011-0/+8
| | | | | | | AmiSSL stores certificates in `AmiSSL:Certs` and MorphOS stores them in `MOSSYS:Data/SSL/curl-ca-bundle.crt`. Closes https://github.com/curl/curl/pull/11059
* http2: (void)-mark when we explicitly ignore the return codeDaniel Stenberg2023-04-301-2/+2
| | | | | | When h2_progress_egress() is called. Pointed out by Coverity. Closes #11057
* checksrc: find bad indentation in conditions without open braceDaniel Stenberg2023-04-2812-15/+15
| | | | | | | | | | | If the previous line starts with if/while/for AND ends with a closed parenthesis and there's an equal number of open and closed parentheses on that line, verify that this line is indented $indent more steps, if not a cpp line. Also adjust the fall-out from this fix. Closes #11054
* multi: add multi-ignore logic to multi_socket_actionDaniel Stenberg2023-04-281-5/+16
| | | | | | | | | | | | The multi-ignore logic that was previously applied to curl_multi_perform() (#10750) is here applied to the loop within curl_multi_socket_action() to make it use the same optimization: most handles have the same signal-ignore option state so this drastically reduces the number of ignore/unignore calls per libcurl function invoke. Follow-up to bc90308328afb8 Closes #11045
* http2: do flow window accounting for cancelled streamsStefan Eissing2023-04-281-1/+14
| | | | | | | | | | - nghttp2 does not free connection level window flow for aborted streams - when closing transfers, make sure that any buffered response data is "given back" to the flow control window - add tests test_02_22 and test_02_23 to reproduce Closes #11052
* pingpong: fix compiler warning "assigning an enum to unsigned char"Stefan Eissing2023-04-281-2/+2
| | | | Closes #11050
* checksrc: check for spaces before the colon of switch labelsEmanuele Torre2023-04-272-3/+3
| | | | Closes #11047
* libssh: tell it to use SFTP non-blockingDaniel Stenberg2023-04-271-1/+1
| | | | | | Reported-by: Andreas Huebner Fixes #11020 Closes #11039
* http2: enlarge the connection windowStefan Eissing2023-04-271-4/+11
| | | | | | | | | | | - fixes stalled connections - Make the connection window large enough, so that there is some room left should 99/100 streams be PAUSED by the application Reported-by: Paweł Wegner Fixes #10988 Closes #11043
* checksrc: fix SPACEBEFOREPAREN for conditions starting with "*"Daniel Stenberg2023-04-2710-11/+11
| | | | | | | | | | | | | | | The open paren check wants to warn for spaces before open parenthesis for if/while/for but also for any function call. In order to avoid catching function pointer declarations, the logic allows a space if the first character after the open parenthesis is an asterisk. I also spotted what we did not include "switch" in the check but we should. This check is a little lame, but we reduce this problem by not allowing that space for if/while/for/switch. Reported-by: Emanuele Torre Closes #11044
* ws: fix CONT opcode checkDaniel Stenberg2023-04-271-1/+2
| | | | | | Detected by Coverity. Follow-up to 930c00c259 Closes #11037
* urlapi: make internal function start with Curl_Daniel Stenberg2023-04-273-3/+3
| | | | | | | | Curl_url_set_authority() it is. Follow-up to acd82c8bfd Closes #11035
* cf-socket: turn off IPV6_V6ONLY on Windows if it is supportedYX Hao2023-04-261-1/+19
| | | | | | | | | | | | | | IPV6_V6ONLY refs: https://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses https://github.com/golang/go/blob/master/src/net/ipsock_posix.go https://en.wikipedia.org/wiki/Unix-like https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options default value refs: https://datatracker.ietf.org/doc/html/rfc3493#section-5.3 https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables Closes #10975
* urldata: shrink *select_bits int => unsigned charDaniel Stenberg2023-04-266-16/+16
| | | | | | | | | | - dselect_bits - cselect_bits ... are using less than 8 bits. Changed types and moved them towards the end of the structs to fit better. Closes #11025
* tests/http: more tests with specific clientsStefan Eissing2023-04-265-78/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Makefile support for building test specific clients in tests/http/clients - auto-make of clients when invoking pytest - added test_09_02 for server PUSH_PROMISEs using clients/h2-serverpush - added test_02_21 for lib based downloads and pausing/unpausing transfers curl url parser: - added internal method `curl_url_set_authority()` for setting the authority part of a url (used for PUSH_PROMISE) http2: - made logging of PUSH_PROMISE handling nicer Placing python test requirements in requirements.txt files - separate files to base test suite and http tests since use and module lists differ - using the files in the gh workflows websocket test cases, fixes for we and bufq - bufq: account for spare chunks in space calculation - bufq: reset chunks that are skipped empty - ws: correctly encode frames with 126 bytes payload - ws: update frame meta information on first call of collect callback that fills user buffer - test client ws-data: some test/reporting improvements Closes #11006
* libssh2: fix crash in keyboard callbackJay Satiro2023-04-261-1/+1
| | | | | | | | | | | | | | | - Always set the libssh2 'abstract' user-pointer to the libcurl easy handle associated with the ssh session, so it is always passed to the ssh keyboard callback. Prior to this change and since 8b5f100 (precedes curl 8.0.0), if libcurl was built without CURL_DEBUG then it could crash during the ssh auth phase due to a null dereference in the ssh keyboard callback. Reported-by: Andreas Falkenhahn Fixes https://github.com/curl/curl/pull/11024 Closes https://github.com/curl/curl/pull/11026
* hostip: add locks around use of global buffer for alarm()Harry Sintonen2023-04-261-4/+15
| | | | | | | When building with the sync name resolver and timeout ability we now require thread-safety to be present to enable it. Closes #11030
* curl_path: bring back support for SFTP path ending in /~Daniel Stenberg2023-04-261-14/+17
| | | | | | | | | | | | | libcurl used to do a directory listing for this case (even though the documentation says a URL needs to end in a slash for this), but 4e2b52b5f7a3 modified the behavior. This change brings back a directory listing for SFTP paths that are specified exactly as /~ in the URL. Reported-by: Pavel Mayorov Fixes #11001 Closes #11023
* hostcheck: fix host name wildcard checkingDaniel Stenberg2023-04-261-28/+22
| | | | | | | | | | | The leftmost "label" of the host name can now only match against single '*'. Like the browsers have worked for a long time. - extended unit test 1397 for this - move some SOURCE variables from unit/Makefile.am to unit/Makefile.inc Reported-by: Hiroki Kurosawa Closes #11018
* Websocket en-/decodingStefan Eissing2023-04-257-502/+864
| | | | | | | | | | - state is fully kept at connection, since curl_ws_send() and curl_ws_rec() have lifetime beyond usual transfers - no more limit on frame sizes Reported-by: simplerobot on github Fixes #10962 Closes #10999
* urldata: copy CURLOPT_AWS_SIGV4 value on handle duplicationPatrick Monnerat2023-04-251-2/+1
| | | | | | | | | | Prior to this change STRING_AWS_SIGV4 (CURLOPT_AWS_SIGV4) was wrongly marked as binary data that could not be duplicated. Without this fix, this option's value is not copied upon calling curl_easy_duphandle(). Closes https://github.com/curl/curl/pull/11021
* http3: expire unpaused transfers in all HTTP/3 backendsStefan Eissing2023-04-253-0/+46
| | | | Closes #11005
* http2: always EXPIRE_RUN_NOW unpaused http/2 transfersStefan Eissing2023-04-251-0/+9
| | | | | | | | - just increasing the http/2 flow window does not necessarily make a server send new data. It may already have exhausted the window before Closes #11005
* http2: pass `stream` to http2_handle_stream_close to avoid NULL checksStefan Eissing2023-04-251-5/+5
| | | | Closes #11005
* h2/h3: replace `state.drain` counter with `state.dselect_bits`Stefan Eissing2023-04-257-168/+150
| | | | | | | | | | | | | | | | | | | | | - `drain` was used by http/2 and http/3 implementations to indicate that the transfer requires send/recv independant from its socket poll state. Intended as a counter, it was used as bool flag only. - a similar mechanism exists on `connectdata->cselect_bits` where specific protocols can indicate something similar, only for the whole connection. - `cselect_bits` are cleard in transfer.c on use and, importantly, also set when the transfer loop expended its `maxloops` tries. `drain` was not cleared by transfer and the http2/3 implementations had to take care of that. - `dselect_bits` is cleared *and* set by the transfer loop. http2/3 does no longer clear it, only set when new events happen. This change unifies the handling of socket poll overrides, extending `cselect_bits` by a easy handle specific value and a common treatment in transfers. Closes #11005
* socketpair: verify with a random valueDaniel Stenberg2023-04-252-6/+12
| | | | | | | | | | ... instead of using the curl time struct, since it would use a few uninitialized bytes and the sanitizers would complain. This is a neater approach I think. Reported-by: Boris Kuschel Fixes #10993 Closes #11015
* lib: unify the upload/method handlingDaniel Stenberg2023-04-2515-38/+36
| | | | | | | | By making sure we set state.upload based on the set.method value and not independently as set.upload, we reduce confusion and mixup risks, both internally and externally. Closes #11017
* http: store the password in the correct variableDaniel Stenberg2023-04-241-1/+1
| | | | | | | Typo from fc2f1e547a4a, detected by Coverity (because there's dead code due to this). Closes #11002
* HTTP3/quiche: terminate h1 response header when no body is sentStefan Eissing2023-04-241-0/+6
| | | | | | | - fixes a failure in test2501 where a response without body was missing the final empty line Closes #11003
* quiche: Enable IDLE egress handlingStefan Eissing2023-04-181-2/+2
| | | | | | | Follow-up to 544abeea which added the handling but wrongly left it commented out. Closes https://github.com/curl/curl/pull/11000
* http2: support HTTP/2 to forward proxies, non-tunnelingStefan Eissing2023-04-1716-678/+1165
| | | | | | | | | | | | | | | | | | | - with `--proxy-http2` allow h2 ALPN negotiation to forward proxies - applies to http: requests against a https: proxy only, as https: requests will auto-tunnel - adding a HTTP/1 request parser in http1.c - removed h2h3.c - using new request parser in nghttp2 and all h3 backends - adding test 2603 for request parser - adding h2 proxy test cases to test_10_* scorecard.py: request scoring accidentally always run curl with '-v'. Removed that, expect double numbers. labeller: added http1.* and h2-proxy sources to detection Closes #10967
* nbtlm: use semicolons instead of commas for (void) argsAndreas Falkenhahn2023-04-161-2/+2
| | | | Closes #10978
* multi: free up more data earleier in DONEDaniel Stenberg2023-04-151-8/+9
| | | | | | | | | Before checking for more users of the connection and possibly bailing out. Fixes #10971 Reported-by: Paweł Wegner Closes #10972
* url: fix PVS nitsDaniel Stenberg2023-04-141-22/+16
| | | | | | | | | | - expression 'hostptr' is always true - a part of conditional expression is always true: proxypasswd - expression 'proxyuser' is always true - avoid multiple Curl_now() calls in allocate_conn Ref: #10929 Closes #10959