Commit Graph

29077 Commits

Author SHA1 Message Date
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
9ac40bfcf0
setopt: make protocol2num use a curl_off_t for the protocol bit
... since WSS does not fit within 32 bit.

Bug: https://github.com/curl/curl/pull/9467#issuecomment-1243014887
Closes #9476
2022-09-12 08:35:51 +02:00
Daniel Stenberg
f06e5c3544
RELEASE-NOTES: synced 2022-09-11 23:46:44 +02:00
Daniel Stenberg
3b0d678f78
configure: polish the grep -E message a bit further
Suggested-by: Emanuele Torre
Closes #9473
2022-09-11 23:42:07 +02:00
Daniel Stenberg
9cc9a6472c
GHA: add a gcc-11 -O3 build using OpenSSL
Since -O3 might trigger other warnings

Closes #9454
2022-09-11 14:47:39 +02:00
Patrick Monnerat
4399b0303a
content_encoding: use writer struct subclasses for different encodings
The variable-sized encoding-specific storage of a struct contenc_writer
currently relies on void * alignment that may be insufficient with
regards to the specific storage fields, although having not caused any
problems yet.

In addition, gcc 11.3 issues a warning on access to fields of partially
allocated structures that can occur when the specific storage size is 0:

  content_encoding.c: In function ‘Curl_build_unencoding_stack’:
  content_encoding.c:980:21: warning: array subscript ‘struct contenc_writer[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Warray-bounds]
    980 |     writer->handler = handler;
        |     ~~~~~~~~~~~~~~~~^~~~~~~~~
  In file included from content_encoding.c:49:
  memdebug.h:115:29: note: referencing an object of size 16 allocated by ‘curl_dbg_calloc’
    115 | #define calloc(nbelem,size) curl_dbg_calloc(nbelem, size, __LINE__, __FILE__)
        |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  content_encoding.c:977:60: note: in expansion of macro ‘calloc’
    977 |   struct contenc_writer *writer = (struct contenc_writer *)calloc(1, sz);

To solve both these problems, the current commit replaces the
contenc_writer/params structure pairs by "subclasses" of struct
contenc_writer. These are structures that contain a contenc_writer at
offset 0. Proper field alignment is therefore handled by the compiler and
full structure allocation is performed, silencing the warnings.

Closes #9455
2022-09-11 14:46:52 +02:00
Daniel Stenberg
ae4d1437f1
configure: correct the wording when checking grep -E
The check first checks that grep -E works, and only as a fallback tries
to find and use egrep. egrep is deprecated.

This change only corrects the output wording, not the checks themselves.

Closes #9471
2022-09-11 11:18:38 +02:00
Viktor Szakats
b62d236f7d
websockets: sync prototypes in docs with implementation [ci skip]
Docs for the new send/recv functions synced with the committed versions
of these.

Closes #9470
2022-09-10 21:37:53 +00:00
Daniel Stenberg
ce753e3c31
setopt: make protocols2num() work with websockets
So that CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR can
specify those as well.

Reported-by: Patrick Monnerat
Bug: https://curl.se/mail/lib-2022-09/0016.html
Closes #9467
2022-09-10 23:11:47 +02:00
Daniel Stenberg
70c8ce5ad0
curl/websockets.h: remove leftover bad typedef
Just a leftover trace of a development thing that did not stay like
that.

Reported-by: Marc Hörsken
Fixes #9465
Cloes #9466
2022-09-10 23:09:38 +02:00
Orgad Shaneh
1c52e8a379
fix Cygwin/MSYS compilation
_getpid is Windows API. On Cygwin variants it should remain getpid.

Fixes #8220
Closes #9255
2022-09-10 16:34:13 +02:00
Marc Hoersken
0af3edfef8
GHA: prepare workflow merge by aligning structure again
Closes #9413
2022-09-10 14:51:20 +02:00
Daniel Stenberg
485c9ba50a
docs: the websockets symbols are added in 7.86.0
Nothing else

Closes #9459
2022-09-09 17:11:58 +02:00
Daniel Stenberg
22e34da091
tests/libtest/Makefile.inc: fixup merge conflict mistake 2022-09-09 15:13:15 +02:00
Daniel Stenberg
c616259bd1
EXPERIMENTAL.md: add WebSockets 2022-09-09 15:11:15 +02:00
Daniel Stenberg
30035dfde7
appveyor: enable websockets 2022-09-09 15:11:15 +02:00
Daniel Stenberg
136b07d73f
cirrus: enable websockets in the windows builds 2022-09-09 15:11:14 +02:00
Daniel Stenberg
b2d0a22ef9
GHA: add websockets to macos, openssl3 and hyper builds 2022-09-09 15:11:14 +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
eebfa3279d
curl_ws_meta: initial implementation 2022-09-09 15:11:14 +02:00
Daniel Stenberg
07cb887ed3
curl_ws_meta.3: added docs 2022-09-09 15:11:14 +02:00
Daniel Stenberg
664249d095
ws: initial websockets support
Closes #8995
2022-09-09 15:11:14 +02:00
Daniel Stenberg
60a3b25dbf
version: add ws + wss 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
6a9b1d1c94
configure: add --enable-websockets 2022-09-09 15:11:13 +02:00
Daniel Stenberg
6698e6ca24
docs/WebSockets.md: docs 2022-09-09 15:11:13 +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
279f638b74
strtoofft: after space, there cannot be a control code
With the change from ISSPACE() to ISBLANK() this function no longer
deals with (ignores) control codes the same way, which could lead to
this function returning unexpected values like in the case of
"Content-Length: \r-12354".

Follow-up to 6f9fb7ec2d

Detected by OSS-fuzz
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51140
Assisted-by: Max Dymond
Closes #9458
2022-09-09 15:02:15 +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
Jay Satiro
9c822a9994 header: define public API functions as extern c
Prior to this change linker errors would occur if curl_easy_header or
curl_easy_nextheader was called from a C++ unit.

Bug: https://github.com/curl/curl/issues/9424#issuecomment-1238818007
Reported-by: Andrew Lambert

Closes https://github.com/curl/curl/pull/9446
2022-09-08 11:54:32 -04:00
Daniel Stenberg
eafc2b14ac
http2: make nghttp2 less picky about field whitespace
In nghttp2 1.49.0 it returns error on leading and trailing whitespace in
header fields according to language in the recently shipped RFC 9113.

nghttp2 1.50.0 introduces an option to switch off this strict check and
this change enables this option by default which should make curl behave
more similar to how it did with nghttp2 1.48.0 and earlier.

We might want to consider making this an option in the future.

Closes #9448
2022-09-08 14:52:45 +02:00
Daniel Stenberg
5390c9d77a
RELEASE-NOTES: synced
And bump to 7.86.0 for the pending next release
2022-09-07 14:18:28 +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
Jay Satiro
2ae81e680b setup-win32: no longer define UNICODE/_UNICODE implicitly
- If UNICODE or _UNICODE is defined but the other isn't then error
  instead of implicitly defining it.

As Marcel pointed out it is too late at this point to make such a define
because Windows headers may already be included, so likely it never
worked. We never noticed because build systems that can make Windows
Unicode builds always define both. If one is defined but not the other
then something went wrong during the build configuration.

Bug: https://github.com/curl/curl/pull/9375#discussion_r956545272
Reported-by: Marcel Raad

Closes https://github.com/curl/curl/pull/9384
2022-09-07 02:55:10 -04:00
Dan Fandrich
2a0a62a5d1 tests: fix tag syntax errors in test files 2022-09-06 11:31:07 -07:00
Marc Hoersken
0c68e2545c
lib: add required Win32 setup definitions in setup-win32.h
Assisted-by: Jay Satiro
Reviewed-by: Marcel Raad

Follow up to #9312
Closes #9375
2022-09-06 19:29:44 +02:00
Daniel Stenberg
5e259d7b23
pingpong: extend the response reading error with errno
To help diagnosing the cause of the problem.

See #9380
Closes #9443
2022-09-06 18:48:57 +02:00
Daniel Stenberg
51083a197c
curl-compilers.m4: use -O2 as default optimize for clang
Not -Os

Closes #9444
2022-09-06 18:47:48 +02:00
Daniel Stenberg
b0dae2a433
tool_operate: fix msnprintfing the error message
Follow-up to 7be53774c4

Coverity CID 1513717 pointed out that we cannot use sizeof() on the
error buffer anymore.

Closes #9440
2022-09-06 14:32:51 +02:00
Emanuele Torre
f1b76e53ae
curl_ctype: add space around <= operator in ISSPACE macro
Follow-up to f65f750

Closes #9441
2022-09-06 14:31:19 +02:00
Daniel Stenberg
fa26f15b19
CURLOPT_PROXY_SSLCERT_BLOB.3: this is for HTTPS proxies
The 'protocols' listed were previously wrong.

Reported-by: ProceduralMan on github
Fixes #9434
Closes #9435
2022-09-06 09:55:23 +02: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
6f9fb7ec2d
misc: ISSPACE() => ISBLANK()
Instances of ISSPACE() use that should rather use ISBLANK(). I think
somewhat carelessly used because it sounds as if it checks for space or
whitespace, but also includes %0a to %0d.

For parsing purposes, we should only accept what we must and not be
overly liberal. It leads to surprises and surprises lead to bad things.

Closes #9432
2022-09-06 08:34:30 +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
Marc Hoersken
7b66050eae
cmake: skip superfluous hex2dec conversion using math expr
CMake seems to be able to compare two hex values just fine.
Also make sure CURL_TARGET_WINDOWS_VERSION is respected.

Assisted-by: Marcel Raad
Reviewed-by: Viktor Szakats
Reported-by: Keitagit-kun on github

Follow up to #9312
Fixes #9406
Closes #9411
2022-09-05 20:22:32 +02:00
Daniel Stenberg
5162ba0562
curl_easy_pause.3: unpausing is as fast as possible
Reported-by: ssdbest on github
Fixes #9410
Closes #9430
2022-09-05 17:34:49 +02:00
Daniel Stenberg
ad9383bd7d
CURLOPT_DNS_INTERFACE.3: mention it works for almost all protocols
Except file.

Reported-by: ProceduralMan on github
Fixes #9427
Closes #9428
2022-09-05 08:36:06 +02:00
Daniel Stenberg
472f1cbe7e
NPN: remove support for and use of
Next Protocol Negotiation is a TLS extension that was created and used
for agreeing to use the SPDY protocol (the precursor to HTTP/2) for
HTTPS. In the early days of HTTP/2, before the spec was finalized and
shipped, the protocol could be enabled using this extension with some
servers.

curl supports the NPN extension with some TLS backends since then, with
a command line option `--npn` and in libcurl with
`CURLOPT_SSL_ENABLE_NPN`.

HTTP/2 proper is made to use the ALPN (Application-Layer Protocol
Negotiation) extension and the NPN extension has no purposes
anymore. The HTTP/2 spec was published in May 2015.

Today, use of NPN in the wild should be extremely rare and most likely
totally extinct. Chrome removed NPN support in Chrome 51, shipped in
June 2016. Removed in Firefox 53, April 2017.

Closes #9307
2022-09-05 07:39:02 +02:00
Daniel Stenberg
e08c82f046
RELEASE-NOTES: synced
and bump the tentative next release version to 7.85.1
2022-09-04 23:13:34 +02:00