Commit Graph

5138 Commits

Author SHA1 Message Date
Patrick Monnerat
9d51329047
setopt: use the handler table for protocol name to number conversions
This also returns error CURLE_UNSUPPORTED_PROTOCOL rather than
CURLE_BAD_FUNCTION_ARGUMENT when a listed protocol name is not found.

A new schemelen parameter is added to Curl_builtin_scheme() to support
this extended use.

Note that disabled protocols are not recognized anymore.

Tests adapted accordingly.

Closes #9472
2022-09-16 23:29:01 +02:00
Daniel Stenberg
1edb15925e
test1948: verify PUT + POST reusing the same handle
Reproduced #9507, verifies the fix
2022-09-15 23:44:15 +02:00
Daniel Stenberg
c4768f168c
lib1560: extended to verify detect/reject of unknown schemes
... when no guessing is allowed.
2022-09-15 09:31:45 +02:00
Daniel Stenberg
7f5fe74323
strerror: improve two URL API error messages 2022-09-15 09:31:29 +02:00
Marcel Raad
d7dceb57d1
lib and tests: add missing curl.h includes
Closes https://github.com/curl/curl/pull/9453
2022-09-12 09:41:47 +02:00
Daniel Stenberg
5d254bbced
tool_setopt: use better English in --libcurl source comments
Like this:

  XYZ was set to an object pointer
  ABC was set to a function pointer

Closes #9475
2022-09-12 08:38:14 +02:00
Daniel Stenberg
22e34da091
tests/libtest/Makefile.inc: fixup merge conflict mistake 2022-09-09 15:13:15 +02:00
Daniel Stenberg
0aaebf62ec
tests: add websockets tests
- add websockets support to sws
 - 2300: first very basic websockets test
 - 2301: first libcurl test for ws (not working yet)
 - 2302: use the ws callback
 - 2303: test refused upgrade
2022-09-09 15:11:14 +02:00
Daniel Stenberg
ef80a87f40
libtest/lib1560: test basic websocket URL parsing 2022-09-09 15:11:14 +02:00
Daniel Stenberg
d96ccab4d6
test415: verify Content-Length parser with control code + negative value 2022-09-09 15:02:23 +02:00
Daniel Stenberg
9c9e83931e
headers: reset the requests counter at transfer start
If not, reusing an easy handle to do a subsequent transfer would
continue the counter from the previous invoke, which then would make use
of the header API difficult/impossible as the request counter
mismatched.

Add libtest 1947 to verify.

Reported-by: Andrew Lambert
Fixes #9424
Closes #9447
2022-09-09 14:46:06 +02:00
Michael Heimpold
d668685657
ftp: ignore a 550 response to MDTM
The 550 is overused as a return code for multiple error case, e.g.
file not found and/or insufficient permissions to access the file.

So we cannot fail hard in this case.

Adjust test 511 since we now fail later.
Add new test 3027 which check that when MDTM failed, but the file could
actually be retrieved, that in this case no filetime is provided.

Reported-by: Michael Heimpold
Fixes #9357
Closes #9387
2022-09-07 10:26:55 +02:00
Daniel Stenberg
f703cf971c
urlapi: leaner with fewer allocs
Slightly faster with more robust code. Uses fewer and smaller mallocs.

- remove two fields from the URL handle struct
- reduce copies and allocs
- use dynbuf buffers more instead of custom malloc + copies
- uses dynbuf to build the host name in reduces serial alloc+free within
  the same function.
- move dedotdotify into urlapi.c and make it static, not strdup the input
  and optimize it by checking for . and / before using strncmp
- remove a few strlen() calls
- add Curl_dyn_setlen() that can "trim" an existing dynbuf

Closes #9408
2022-09-07 10:21:45 +02:00
Dan Fandrich
2a0a62a5d1 tests: fix tag syntax errors in test files 2022-09-06 11:31:07 -07:00
Daniel Stenberg
f65f750742
curl_ctype: convert to macros-only
This no longer provide functions, only macros. Runs faster and produces
smaller output.

The biggest precaution this change brings:

DO NOT use post/pre-increments when passing arguments to the macros.

Closes #9429
2022-09-06 08:36:33 +02:00
Daniel Stenberg
8dd95da35b
ctype: remove all use of <ctype.h>, use our own versions
Except in the test servers.

Closes #9433
2022-09-06 08:32:36 +02:00
Daniel Stenberg
9178208a8e
tests/certs/scripts: insert standard curl source headers
... including the SPDX-License-Identifier.

These omissions were not detected by the RUEUSE CI job nor the copyright.pl
scanners because we have a general wildcard in .reuse/dep5 for
"tests/certs/*".

Reported-by: Samuel Henrique
Fixes #9417
Closes #9420
2022-09-04 15:55:19 +02:00
Samuel Henrique
464ff5a610
manpages: Fix spelling of "allows to" -> "allows one to"
References:
 https://salsa.debian.org/lintian/lintian/-/blob/master/tags/t/typo-in-manual-page.tag
 https://english.stackexchange.com/questions/60271/grammatical-complements-for-allow/60285#60285

Closes #9419
2022-09-02 14:45:01 +02:00
Viktor Szakats
c9061f242b
misc: spelling fixes
Found using codespell 2.2.1.

Also delete the redundant protocol designator from an archive.org URL.

Reviewed-by: Daniel Stenberg
Closes #9403
2022-08-31 14:31:01 +00:00
Daniel Stenberg
592290ed75
lib530: simplify realloc failure exit path
To make code analyzers happier

Closes #9392
2022-08-30 15:38:20 +02:00
Orgad Shaneh
56f1bbdd0c
tests: add tests for netrc login/password combinations
Covers the following PRs:

- #9066
- #9247
- #9248

Closes #9256
2022-08-29 17:26:21 +02:00
Daniel Stenberg
2fc031d834
test8: verify that "ctrl-byte cookies" are ignored 2022-08-29 11:20:53 +02:00
Daniel Stenberg
7632c0d25a
multi: use larger dns hash table for multi interface
Have curl_multi_init() use a much larger DNS hash table than used for
the easy interface to scale and perform better when used with _many_
host names.

curl_share_init() sets an in-between size.

Inspired-by: Ivan Tsybulin
See #9340
Closes #9376
2022-08-29 00:07:09 +02:00
Marc Hoersken
c5c6e86783
CI/runtests.pl: add param for dedicated curl to talk to APIs
This should make it possible to also report test failures
if our freshly build curl binary is not fully functional.

Reviewed-by: Daniel Stenberg
Closes #9360
2022-08-28 19:18:22 +02:00
Jay Satiro
ef121401d6 tests: fix http2 tests to use CRLF headers
Prior to this change some tests that rely on nghttpx proxy did not use
CRLF headers everywhere. A recent change in nghttp2, which updated its
version of llhttp (HTTP parser), requires curl's HTTP/1.1 test server to
use CRLF headers.

Ref: https://github.com/nghttp2/nghttp2/commit/9d389e8

Fixes https://github.com/curl/curl/issues/9364
Closes https://github.com/curl/curl/pull/9365
2022-08-25 12:05:30 -04:00
Daniel Stenberg
3f98eaafa0
unit1303: four tests should have TRUE for 'connecting'
To match the comments.

Reported-by: Wu Zheng

See #9355
Closes #9356
2022-08-23 17:39:37 +02:00
Marc Hoersken
91948a9eaf
tests/server/sockfilt.c: avoid race condition without a mutex
Avoid loosing any triggered handles by first aborting and joining
the waiting threads before evaluating the individual signal state.

This removes the race condition and therefore need for a mutex.

Closes #9023
2022-08-23 12:17:20 +02:00
Daniel Stenberg
d162fca69a
tests/data/CMakeLists: remove making the 'show' makefile target
It is not used by runtests since 3c0f462

Closes #9333
2022-08-18 11:40:12 +02:00
Daniel Stenberg
aedd0a7c9b
tests/data/Makefile: remove 'filecheck' target
No practical use anymore since 3c0f4622cd

Closes #9332
2022-08-18 11:39:12 +02:00
Daniel Stenberg
04427fc207
test399: switch it to use a config file instead
... as using a 65535 bytes host name in a URL does not fit on the
command line on some systems - like Windows.

Reported-by: Marcel Raad
Fixes #9321
Closes #9322
2022-08-16 16:35:47 +02:00
Daniel Stenberg
88f1f11e01
test399: verify check of too long host name 2022-08-15 10:57:16 +02:00
Daniel Stenberg
b5c0fe20e3
hostip: resolve *.localhost to 127.0.0.1/::1
Following the footsteps of other clients like Firefox/Chrome.  RFC 6761
says clients SHOULD do this.

Add test 389 to verify.

Reported-by: TheKnarf on github
Fixes #9192
Closes #9296
2022-08-11 14:01:37 +02:00
Daniel Stenberg
d48dd1573c
config: remove the check for and use of SIZEOF_SHORT
shorts are 2 bytes on all platforms curl runs and have ever run on.

Closes #9291
2022-08-11 09:07:06 +02:00
Sean McArthur
d6010c2106
hyper: customize test1274 to how hyper unfolds headers
Closes #9217
2022-08-10 23:49:18 +02:00
Daniel Stenberg
0ad7c8d7d5
digest: pass over leading spaces in qop values
When parsing the "qop=" parameter of the digest authentication, and the
value is provided within quotes, the list of values can have leading
white space which the parser previously did not handle correctly.

Add test case 388 to verify.

Reported-by: vlubart on github
Fixes #9264
Closes #9270
2022-08-08 08:28:04 +02:00
Fabian Keil
073268a6de
test44[2-4]: add '--resolve' to the keywords
... so the tests can be automatically skipped when
using an external proxy like Privoxy.

Closes #9250
2022-08-07 14:24:18 +02:00
Sean McArthur
3b52a80c05
hyper: enable obs-folded multiline headers
Closes #9216
2022-07-28 00:36:18 +02:00
Marc Hoersken
40b6206085
test3026: add support for Windows using native Win32 threads
Reviewed-by: Viktor Szakats
Reviewed-by: Jay Satiro
Reviewed-by: Daniel Stenberg

Follow up to 7ade9c50b3
Closes #9012
2022-07-25 21:24:57 +02:00
Daniel Stenberg
6fa89fa893
tests: several enumerated type cleanups
To please icc

Closes #9179
2022-07-23 13:39:29 +02:00
Daniel Stenberg
4c0ac2aa59
cookie: treat a blank domain in Set-Cookie: as non-existing
This matches what RFC 6265 section 5.2.3 says.

Extended test 31 to verify.

Fixes #9164
Reported-by: Gwen Shapira
Closes #9177
2022-07-19 11:52:54 +02:00
Patrick Monnerat
c2e72c7812
base64: base64url encoding has no padding
See RFC4648 section 5 and RFC7540 section 3.2.1.

Suppress generation of '=' padding of base64url encoding. This is
accomplished by considering the string beginning at offset 64 in the
character table as the padding: this is "=" for base64, "" for base64url.

Also use strchr() to replace character search loops where possible.

Suppress erroneous comments about empty encoding results.

Adjust unit test 1302 to unpadded base64url encoding and add tests for
empty results.

Closes #9139
2022-07-19 11:06:20 +02:00
Daniel Stenberg
0484127805
lib3026: reduce the number of threads to 100
Down from 1000, to make it run and work in more systems.

Fixes #9172
Reported-by: Érico Nogueira Rolim
Closes #9173
2022-07-18 11:58:38 +02:00
Daniel Stenberg
0e48ac1f99
mprintf: make dprintf_formatf never return negative
This function no longer returns a negative value if the formatting
string is bad since the return value would sometimes be propagated as a
return code from the mprintf* functions and they are documented to
return the length of the output. Which cannot be negative.

Fixes #9149
Closes #9151
Reported-by: yiyuaner on github
2022-07-17 23:27:02 +02:00
Daniel Stenberg
945a81e143
test3026: require 'threadsafe'
Reported-by: Sukanya Hanumanthu
Fixes #9141
Closes #9142
2022-07-12 22:56:48 +02:00
Daniel Stenberg
e6f8445ede
setopt: add CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR
... as replacements for deprecated CURLOPT_PROTOCOLS and
CURLOPT_REDIR_PROTOCOLS as these new ones do not risk running into the
32 bit limit the old ones are facing.

CURLINFO_PROTCOOL is now deprecated.

The curl tool is updated to use the new options.

Added test 1597 to verify the libcurl protocol parser.

Closes #8992
2022-07-04 08:35:09 +02:00
Sean McArthur
be8d2b037d
hyper: use wakers for curl pause/resume
Closes #9070
2022-06-30 10:19:08 +02:00
Daniel Stenberg
1dda49a1d3
curl.h: CURLE_CONV_FAILED is obsoleted
The last use was removed in 7.82.0. Updated some docs too to reflect the
current error code situation.

Closes #9067
2022-06-29 16:03:02 +02:00
Daniel Stenberg
46f8911d39
test444: test many received Set-Cookie:
The amount of sent cookies in the test is limited to 80 because hyper
has its own strict limits in how many headers it allows to be received
which triggers at some point beyond this number.
2022-06-26 11:01:56 +02:00
Daniel Stenberg
ff2b2bcf68
test442/443: test cookie caps
442 - verify that only 150 cookies are sent
443 - verify that the cookie: header remains less than 8K in size
2022-06-26 11:01:01 +02:00
Daniel Stenberg
7230b19a2e
test387: verify rejection of compression chain attack 2022-06-25 22:14:32 +02:00