Commit Graph

29106 Commits

Author SHA1 Message Date
Marc Hoersken
94445e7977
CI/GHA: merge event-based and NSS into new linux workflow
Continue work on merging all Linux workflows into one file.

Follow up to #9501
Closes #9506
2022-09-15 20:38:23 +02:00
Daniel Stenberg
f71b79feb5
include/curl/websockets.h: add extern "C" for C++
Reported-by: n0name321 on github
Fixes #9509
Closes #9510
2022-09-15 11:18:37 +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
846678541b
urlapi: detect scheme better when not guessing
When the parser is not allowed to guess scheme, it should consider the
word ending at the first colon to be the scheme, independently of number
of slashes.

The parser now checks that the scheme is known before it counts slashes,
to improve the error messge for URLs with unknown schemes and maybe no
slashes.

When following redirects, no scheme guessing is allowed and therefore
this change effectively prevents redirects to unknown schemes such as
"data".

Fixes #9503
2022-09-15 09:31:40 +02:00
Daniel Stenberg
7f5fe74323
strerror: improve two URL API error messages 2022-09-15 09:31:29 +02:00
Marc Hoersken
5142553c5a
CI/GHA: merge bearssl and hyper into initial linux workflow
Begin work on merging all Linux workflows into one file.

Closes #9501
2022-09-14 20:01:59 +02:00
Daniel Stenberg
2b59f9f9ea
RELEASE-NOTES: synced 2022-09-14 09:58:50 +02:00
Daniel Stenberg
889c132c38
cmake: define BUILDING_LIBCURL in lib/CMakeLists, not config.h
Since the config file might also get included by the tool code at times.
This syncs with how other builds do it.

Closes #9498
2022-09-14 08:06:41 +02:00
Daniel Stenberg
b54920f7e4
tool_hugehelp: make hugehelp a blank macro when disabled
Closes #9485
2022-09-14 08:04:49 +02:00
Daniel Stenberg
a850b9edb9
getparameter: return PARAM_MANUAL_REQUESTED for -M even when disabled
... to improve the output in this situation. Now it doesn't say "option
unknown" anymore.

Closes #9485
2022-09-14 08:04:39 +02:00
Daniel Stenberg
ddda4fdf3d
setopt: fix compiler warning
Follow-up to cd5ca80f00

closes #9502
2022-09-14 08:02:27 +02:00
Philip Heiduck
2ca0530a4d
CI: skip make, do make install at once for dependencies
Signed-off-by: Philip Heiduck <pheiduck@Philips-MBP.lan>

Closes #9477
2022-09-13 15:42:10 +02:00
Daniel Stenberg
fd840cdead
formdata: typecast the va_arg return value
To avoid "enumerated type mixed with another type" warnings

Follow-up from 0f52dd5fd5

Closes #9499
2022-09-13 15:38:48 +02:00
Daniel Stenberg
3bbe75095f
RELEASE-PROCEDURE.md: mention patch releases
- When to make them and how to argue for them
- Refreshed the release date list

Closes #9495
2022-09-13 11:38:51 +02:00
Daniel Stenberg
cd5ca80f00
urldata: use a curl_prot_t type for storing protocol bits
This internal-use-only storage type can be bumped to a curl_off_t once
we need to use bit 32 as the previous 'unsigned int' can no longer hold
them all then.

The websocket protocols take bit 30 and 31 so they are the last ones
that fit within 32 bits - but cannot properly be exported through APIs
since those use *signed* 32 bit types (long) in places.

Closes #9481
2022-09-13 11:26:49 +02:00
zhanghu
0f52dd5fd5
formdata: fix warning: 'CURLformoption' is promoted to 'int'
curl/lib/formdata.c: In function 'FormAdd':
curl/lib/formdata.c:249:31: warning: 'CURLformoption' is promoted to 'int' when passed through '...'
  249 |       option = va_arg(params, CURLformoption);
      |                               ^
curl/lib/formdata.c:249:31: note: (so you should pass 'int' not 'CURLformoption' to 'va_arg')
curl/lib/formdata.c:249:31: note: if this code is reached, the program will abort

Closes #9484
2022-09-13 11:24:40 +02:00
Daniel Stenberg
dbaa1e17a6
CURLOPT_CONNECT_ONLY.3: for ws(s) as well
and correct the version number for when that support comes. Even if it
is still experimental for WebSocket.

Closes #9487
2022-09-13 10:31:48 +02:00
Daniel Stenberg
ee56e6ff12
tool_operate: avoid a few #ifdefs for disabled-libcurl builds
By providing empty macros in the header file instead, the code gets
easier to read and yet is disabled on demand.

Closes #9486
2022-09-13 10:28:50 +02:00
a1346054
c3a6165307
scripts: use grep -E instead of egrep
egrep is deprecated

Closes #9491
2022-09-13 10:18:50 +02:00
Hayden Roche
d797339202
wolfSSL: fix session management bug.
Prior to this commit, non-persistent pointers were being used to store
sessions.  When a WOLFSSL object was then freed, that freed the session
it owned, and thus invalidated the pointer held in curl's cache. This
commit makes it so we get a persistent (deep copied) session pointer
that we then add to the cache.  Accordingly, wolfssl_session_free, which
was previously a no-op, now needs to actually call SSL_SESSION_free.

This bug was discovered by a wolfSSL customer.

Closes #9492
2022-09-13 10:15:40 +02:00
Daniel Stenberg
6a1bfbd11b
docs: use "WebSocket" in singular
This is how the RFC calls the protocol. Also rename the file in docs/ to
WEBSOCKET.md in uppercase to match how we have done it for many other
protocol docs in similar fashion.

Add the WebSocket docs to the tarball.

Closes #9496
2022-09-13 10:04:46 +02:00
Marcel Raad
7740530ced
ws: fix build without USE_WEBSOCKETS
The curl.h include is required unconditionally.
2022-09-12 10:22:42 +02:00
Marcel Raad
a0ff4dba8b
ws: add missing curl.h include
A conflict between commits 664249d095 and e5839f4ee7 broke the build.
2022-09-12 10:12:32 +02:00
Daniel Stenberg
e5e9e0c5e4
ws: fix an infof() call to use %uz for size_t output
Detected by Coverity, CID 1514665.

Closes #9480
2022-09-12 10:02:38 +02:00
Marcel Raad
e5839f4ee7
curl_setup: include only system.h instead of curl.h
As done before commit 9506d01ee5.

Ref: https://github.com/curl/curl/pull/9375#discussion_r957010158
Closes https://github.com/curl/curl/pull/9453
2022-09-12 09:41:55 +02:00
Marcel Raad
b921a1676f
lib: add missing limits.h includes
Closes https://github.com/curl/curl/pull/9453
2022-09-12 09:41:50 +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
Marcel Raad
4a7c10c6cc
curl_setup: include curl.h after platform setup headers
The platform setup headers might set definitions required for the
includes in curl.h.

Ref: https://github.com/curl/curl/pull/9375#discussion_r956998269
Closes https://github.com/curl/curl/pull/9453
2022-09-12 09:41:42 +02:00
Benjamin Loison
ff021cb216
docs: correct missing uppercase in Markdown files
To detect these typos I used:

```
clear && grep -rn '\. [a-z]' . | uniq | grep -v '\. lib' | grep -v '[0-9]\. [a-z]' | grep -v '\.\. [a-z]' | grep -v '\. curl' | grep -v 'e.g. [a-z]' | grep -v 'eg. [a-z]' | grep -v '\etc. [a-z]' | grep -v 'i.e\. [a-z]' | grep --color=always '\. [a-z]' | grep '\.md'
```

Closes #9474
2022-09-12 09:10:43 +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
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