]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
2 years agomprintf: use snprintf if available
Daniel Stenberg [Thu, 22 Sep 2022 09:52:08 +0000 (11:52 +0200)] 
mprintf: use snprintf if available

This is the single place in libcurl code where it uses the "native"
s(n)printf() function. Used for writing floats. The use has been
reviewed and vetted and uses a HUGE target buffer, but switching to
snprintf() still makes this safer and removes build-time warnings.

Reported-by: Philip Heiduck
Fixes #9569
Closes #9570

2 years agodocs: tag curl options better in man pages
Daniel Stenberg [Thu, 22 Sep 2022 15:07:09 +0000 (17:07 +0200)] 
docs: tag curl options better in man pages

As it makes them links in the HTML versions.

Verified by the extended test 1176

2 years agosymbols-in-versions: CURLOPT_ENCODING is deprecated since 7.21.6
Daniel Stenberg [Thu, 22 Sep 2022 15:06:49 +0000 (17:06 +0200)] 
symbols-in-versions: CURLOPT_ENCODING is deprecated since 7.21.6

2 years agomanpage-syntax.pl: all libcurl option symbols should be \fI-tagged
Daniel Stenberg [Thu, 22 Sep 2022 15:05:35 +0000 (17:05 +0200)] 
manpage-syntax.pl: all libcurl option symbols should be \fI-tagged

... as that makes them links to their corresponding man page.

This script is used for test 1173.

Closes #9574

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 22 Sep 2022 12:14:28 +0000 (14:14 +0200)] 
RELEASE-NOTES: synced

2 years agotool: remove protocol count limitation
Patrick Monnerat [Wed, 21 Sep 2022 08:41:22 +0000 (10:41 +0200)] 
tool: remove protocol count limitation

Replace bit mask protocol sets by null-terminated arrays of protocol
tokens. These are the addresses of the protocol names returned by
curl_version_info().

Protocol names are sorted case-insensitively before output to satisfy CI
tests matches consistency.

The protocol list returned by curl_version_info() is augmented with all
RTMP protocol variants.

Test 1401 adjusted for new alpha ordered output.

Closes #9546

2 years agotest972: verify the output without using external tool
Daniel Stenberg [Wed, 21 Sep 2022 10:32:16 +0000 (12:32 +0200)] 
test972: verify the output without using external tool

It seems too restrictive to assume and use an external tool to verify
the JSON. This now verifies the outut byte per byte. We could consider
building a local "JSON verifyer" in a future.

Remove 'jsonlint' from the CI job.

Reported-by: Marcel Raad
Fixes #9563
Closes #9564

2 years agohostip: lazily wait to figure out if IPv6 works until needed
Daniel Stenberg [Wed, 21 Sep 2022 06:52:57 +0000 (08:52 +0200)] 
hostip: lazily wait to figure out if IPv6 works until needed

The check may take many milliseconds, so now it is performed once the
value is first needed. Also, this change makes sure that the value is
not used if the resolve is set to be IPv4-only.

Closes #9553

2 years agocurl.h: fix mention of wrong error code in comment
Daniel Stenberg [Tue, 20 Sep 2022 12:53:08 +0000 (14:53 +0200)] 
curl.h: fix mention of wrong error code in comment

The same error and comment were also used and is now corrected in
CURLOPT_SSH_KEYFUNCTION.3

2 years agosymbol-scan.pl: scan and verify .3 man pages
Daniel Stenberg [Tue, 20 Sep 2022 12:50:09 +0000 (14:50 +0200)] 
symbol-scan.pl: scan and verify .3 man pages

This script now also finds all .3 man pages in docs/include and
docs/include/opts, extracts all uses of CURL* symbols and verifies that all
symbols mentioned in docs are defined in public headers.

A "global symbol" is one of those matching a known prefix and the script makes
an attempt to check all/most of them. Just using *all* symbols that match
CURL* proved matching a little too many other references as well and turned
difficult turning into something useful.

Closes #9544

2 years agosymbols-in-versions: add missing LIBCURL* symbols
Daniel Stenberg [Tue, 20 Sep 2022 12:10:13 +0000 (14:10 +0200)] 
symbols-in-versions: add missing LIBCURL* symbols

2 years agosymbol-scan.pl: also check for LIBCURL* symbols
Daniel Stenberg [Tue, 20 Sep 2022 11:52:33 +0000 (13:52 +0200)] 
symbol-scan.pl: also check for LIBCURL* symbols

Closes #9544

2 years agodocs/libcurl/symbols-in-versions: add several missing symbols
Daniel Stenberg [Tue, 20 Sep 2022 11:48:21 +0000 (13:48 +0200)] 
docs/libcurl/symbols-in-versions: add several missing symbols

2 years agotest1119: scan all public headers
Daniel Stenberg [Tue, 20 Sep 2022 11:32:58 +0000 (13:32 +0200)] 
test1119: scan all public headers

Previously this test only scanned a subset of the headers, which made us
accidentally miss symbols that were provided in the others. Now, the script
iterates over all headers present in include/curl.

Closes #9544

2 years agoexamples/chkspeed: improve portability
Patrick Monnerat [Wed, 21 Sep 2022 09:18:27 +0000 (11:18 +0200)] 
examples/chkspeed: improve portability

The example program chkspeed uses strncasecmp() which is not portable
across systems. Replace calls to this function by tests on characters.

Closes #9562

2 years agoeasy: fix the #include order
Daniel Stenberg [Wed, 21 Sep 2022 09:17:32 +0000 (11:17 +0200)] 
easy: fix the #include order

The mentioned "last 3 includes" order should be respected. easy_lock.h should
be included before those three.

Reported-by: Yuriy Chernyshov
Fixes #9560
Closes #9561

2 years agodocs: spellfixes
Daniel Stenberg [Tue, 20 Sep 2022 21:30:19 +0000 (23:30 +0200)] 
docs: spellfixes

Pointed by the new CI job

2 years agoGHA: spellcheck
Daniel Stenberg [Tue, 20 Sep 2022 21:30:02 +0000 (23:30 +0200)] 
GHA: spellcheck

This spellchecker checks markdown files. For this reason this job
converts all man pages in the repository to markdown with pandoc before
the check runs.

The perl script 'cleanspell' filters out details from the man page in
the process, to avoid the spellchecker trying to spellcheck things it
can't. Like curl specific symbols and the SYNOPSIS and EXAMPLE sections
of libcurl man pages.

The spell checker does not check words in sections that are within pre,
strong and em tags.

'spellcheck.words' is a custom word list with additional accepted words.

Closes #9523

2 years agoconnect: fix the wrong error message on connect failures
Daniel Stenberg [Wed, 21 Sep 2022 07:06:49 +0000 (09:06 +0200)] 
connect: fix the wrong error message on connect failures

The "Failed to connect to" message after a connection failure would
include the strerror message based on the presumed previous socket
error, but in times it seems that error number is not set when reaching
this code and therefore it would include the wrong error message.

The strerror message is now removed from here and the curl_easy_strerror
error is used instead.

Reported-by: Edoardo Lolletti
Fixes #9549
Closes #9554

2 years agohttpput-postfields.c: shorten string for C89 compliance
Daniel Stenberg [Wed, 21 Sep 2022 07:32:12 +0000 (09:32 +0200)] 
httpput-postfields.c: shorten string for C89 compliance

httpput-postfields.c:41:3: error: string length ‘522’ is greater than the length ‘509’ ISO C90 compilers are required to support [-Woverlength-strings]
   41 |   "this chapter.";
      |   ^~~~~~~~~~~~~~~

Closes #9555

2 years agows: fix a C89 compliance nit
Daniel Stenberg [Tue, 20 Sep 2022 08:54:22 +0000 (10:54 +0200)] 
ws: fix a C89 compliance nit

Closes #9541

2 years agounit test 1655: make it C89-compliant
Patrick Monnerat [Wed, 21 Sep 2022 01:00:30 +0000 (03:00 +0200)] 
unit test 1655: make it C89-compliant

Initializations performed in unit test 1655 use automatic variables in
aggregates and thus can only be computed at run-time. Using gcc in C89
dialect mode produces warning messages like:

unit1655.c:96:7: warning: initializer element is not computable at load time [-Wpedantic]
   96 |     { toolong, DOH_DNS_NAME_TOO_LONG },  /* expect early failure */
      |       ^~~~~~~

Fix the problem by converting these automatic pointer variables to
static arrays.

Closes #9551

2 years agocurl_strequal.3: fix typo
Tobias Schaefer [Tue, 20 Sep 2022 19:04:23 +0000 (21:04 +0200)] 
curl_strequal.3: fix typo

Closes #9548

2 years agoresolve: make forced IPv4 resolve only use A queries
Dmitry Karpov [Mon, 19 Sep 2022 20:59:35 +0000 (13:59 -0700)] 
resolve: make forced IPv4 resolve only use A queries

This protects IPv4-only transfers from undesired bad IPv6-related side
effects and make IPv4 transfers in dual-stack libcurl behave the same
way as in IPv4 single-stack libcurl.

Closes #9540

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 20 Sep 2022 06:48:18 +0000 (08:48 +0200)] 
RELEASE-NOTES: synced

2 years agowinbuild/MakefileBuild.vc: handle spaces in libssh(2) include paths
Daniel Stenberg [Mon, 19 Sep 2022 10:43:41 +0000 (12:43 +0200)] 
winbuild/MakefileBuild.vc: handle spaces in libssh(2) include paths

Patched-by: Mark Itzcovitz
Bug: https://curl.se/mail/lib-2022-09/0038.html

Closes #9536

2 years agoTODO: Reduce CA certificate bundle reparsing
Daniel Stenberg [Mon, 19 Sep 2022 12:55:30 +0000 (14:55 +0200)] 
TODO: Reduce CA certificate bundle reparsing

By adding some sort of cache.

Reported-by: Michael Drake
Closes #9379
Closes #9538

2 years agoCI/GHA: cancel outdated CI runs on new PR changes
Marc Hoersken [Sat, 17 Sep 2022 21:45:32 +0000 (23:45 +0200)] 
CI/GHA: cancel outdated CI runs on new PR changes

Avoid letting outdated CI runs continue if a PR receives
new changes. Outside a PR we let them continue running
by tying the concurrency to the commit hash instead.

Also only let one CodeQL or Hacktoberfest job run at a time.

Other CI platforms we use have this build in, but GitHub
unfortunately neither by default nor with a simple option.

This saves CI resources and therefore a little energy.

Approved-by: Daniel Stenberg
Approved-by: Max Dymond
Closes #9533

2 years agodocs: fix proselint complaints 9520/head
Daniel Stenberg [Mon, 19 Sep 2022 15:30:30 +0000 (17:30 +0200)] 
docs: fix proselint complaints

2 years agoGHA: run proselint on markdown files
Daniel Stenberg [Mon, 19 Sep 2022 15:30:05 +0000 (17:30 +0200)] 
GHA: run proselint on markdown files

Co-authored-by: Marc Hörsken
Closes #9520

2 years agolib: the number four in a sequence is the "fourth"
Daniel Stenberg [Sun, 18 Sep 2022 21:23:42 +0000 (23:23 +0200)] 
lib: the number four in a sequence is the "fourth"

Spelling is hard

Closes #9535

2 years agomisc: fix spelling in two source files
John Bampton [Sat, 17 Sep 2022 19:48:43 +0000 (05:48 +1000)] 
misc: fix spelling in two source files

Closes #9529

2 years agowindows: add .rc support to autotools builds
Viktor Szakats [Sun, 18 Sep 2022 12:05:35 +0000 (12:05 +0000)] 
windows: add .rc support to autotools builds

After this update autotools builds will compile and link `.rc` resources
to Windows executables. Bringing this feature on par with CMake and
Makefile.m32 builds. And also making it unnecessary to improvise these
steps manually, while monkey patching build files, e.g. [0].

You can customize the resource compiler via the `RC` envvar, and its
options via `RCFLAGS`.

This harmless warning may appear throughout the build, even though the
autotools manual documents [1] `RC` as a valid tag, and it fails when
omitting one:
`libtool:   error: ignoring unknown tag RC`

[0] https://github.com/curl/curl-for-win/blob/535f19060d4b708f72e75dd849409ce50baa1b84/curl-autotools.sh#L376-L382
[1] https://www.gnu.org/software/libtool/manual/html_node/Tags.html

Closes #9521

2 years agoCI/linkcheck: only run if a Markdown file is changed
Marc Hoersken [Sat, 17 Sep 2022 19:58:58 +0000 (21:58 +0200)] 
CI/linkcheck: only run if a Markdown file is changed

This saves CI resources and therefore a little energy.

Reviewed-by: Max Dymond
Closes #9531

2 years agoREADME.md: add GHA status badges for Linux and macOS builds
Marc Hoersken [Sat, 17 Sep 2022 19:53:50 +0000 (21:53 +0200)] 
README.md: add GHA status badges for Linux and macOS builds

This makes sense now that Linux builds are being consolidated.

Approved-by: Daniel Stenberg
Closes #9530

[skip ci]

2 years agomisc: null-terminate
Daniel Stenberg [Sat, 17 Sep 2022 15:32:21 +0000 (17:32 +0200)] 
misc: null-terminate

Make use of this term consistently.

Closes #9527

2 years agoCI/GHA: merge intel CC and more TLS libs into linux workflow
Marc Hoersken [Thu, 15 Sep 2022 19:20:10 +0000 (21:20 +0200)] 
CI/GHA: merge intel CC and more TLS libs into linux workflow

Continue work on merging all Linux workflows into one file.

Reviewed-by: Max Dymond
Follow up to #9501
Closes #9514

2 years agolib1597: make it C89-compliant again
Patrick Monnerat [Sat, 17 Sep 2022 12:09:07 +0000 (14:09 +0200)] 
lib1597: make it C89-compliant again

Automatic variable addresses cannot be used in an initialisation
aggregate.

Follow-up to 9d51329

Reported-by: Daniel Stenberg
Fixes: #9524
Closes #9525

2 years agotool_libinfo: silence "different 'const' qualifiers" in qsort()
Daniel Stenberg [Sat, 17 Sep 2022 09:38:59 +0000 (11:38 +0200)] 
tool_libinfo: silence "different 'const' qualifiers" in qsort()

MSVC 15.0.30729.1 warned about it

Follow-up to dd2a024323dcc

Closes #9522

2 years agodocs: tell about disabled protocols in CURLOPT_*PROTOCOLS_STR.
Patrick Monnerat [Tue, 13 Sep 2022 17:47:18 +0000 (19:47 +0200)] 
docs: tell about disabled protocols in CURLOPT_*PROTOCOLS_STR.

Disabled protocols are now handled as if they were unknown.
Also update the possible protocol list.

2 years agocli tool: do not use disabled protocols
Patrick Monnerat [Thu, 15 Sep 2022 12:31:36 +0000 (14:31 +0200)] 
cli tool: do not use disabled protocols

As they are now rejected by the library, take care of not passing
disabled protocol names to CURLOPT_PROTOCOLS_STR and
CURLOPT_REDIR_PROTOCOLS_STR.

Rather than using the CURLPROTO_* constants, dynamically assign protocol
numbers based on the order they are listed by curl_version_info().

New type proto_set_t implements prototype bit masks: it should therefore
be large enough to accomodate all library-enabled protocols. If not,
protocol numbers beyond the bit count of proto_set_t are recognized but
"inaccessible": when used, a warning is displayed and the value is
ignored. Should proto_set_t overflows, enabled protocols are reordered to
force those having a public CURLPROTO_* representation to be accessible.

Code has been added to subordinate RTMP?* protocols to the presence of
RTMP in the enabled protocol list, being returned by curl_version_info()
or not.

2 years agosetopt: use the handler table for protocol name to number conversions
Patrick Monnerat [Thu, 15 Sep 2022 11:30:09 +0000 (13:30 +0200)] 
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

2 years agoaltsvc: use 'h3' for h3
Daniel Stenberg [Fri, 16 Sep 2022 13:01:57 +0000 (15:01 +0200)] 
altsvc: use 'h3' for h3

Since the official and real version has been out for a while now and servers
are deployed out there using it, there is no point in sticking to h3-29.

Reported-by: ウさん
Fixes #9515
Closes #9516

2 years agowinbuild: Use NMake batch-rules for compilation
chemodax [Thu, 15 Sep 2022 16:41:17 +0000 (19:41 +0300)] 
winbuild: Use NMake batch-rules for compilation

- Invoke cl compiler once for each group of .c files.

This is significantly improves compilation time. For example in my
environment: 40 s --> 20 s.

Prior to this change cl was invoked per .c file.

Closes https://github.com/curl/curl/pull/9512

2 years agows: the infof() flags should be %zu
Daniel Stenberg [Fri, 16 Sep 2022 15:18:16 +0000 (17:18 +0200)] 
ws: the infof() flags should be %zu

Follow-up to e5e9e0c5e49ae0

Closes #9518

2 years agocurl: warn for --ssl use, considered insecure
Daniel Stenberg [Fri, 16 Sep 2022 17:03:49 +0000 (19:03 +0200)] 
curl: warn for --ssl use, considered insecure

Closes #9519

2 years agocurl_escape.3: fix typo
Sergey Bronnikov [Fri, 16 Sep 2022 13:32:57 +0000 (16:32 +0300)] 
curl_escape.3: fix typo

lengthf -> length

Closes #9517

2 years agomailmap: merge Philip Heiduck's two addresses into one
Daniel Stenberg [Fri, 16 Sep 2022 14:46:32 +0000 (16:46 +0200)] 
mailmap: merge Philip Heiduck's two addresses into one

2 years agotest1948: verify PUT + POST reusing the same handle
Daniel Stenberg [Thu, 15 Sep 2022 07:23:33 +0000 (09:23 +0200)] 
test1948: verify PUT + POST reusing the same handle

Reproduced #9507, verifies the fix

2 years agosetopt: when POST is set, reset the 'upload' field
Daniel Stenberg [Thu, 15 Sep 2022 07:22:45 +0000 (09:22 +0200)] 
setopt: when POST is set, reset the 'upload' field

Reported-by: RobBotic1 on github
Fixes #9507
Closes #9511

2 years agogithub: initial CODEOWNERS setup for CI configuration
Marc Hoersken [Wed, 14 Sep 2022 18:09:54 +0000 (20:09 +0200)] 
github: initial CODEOWNERS setup for CI configuration

Reviewed-by: Daniel Stenberg
Reviewed-by: Marcel Raad
Reviewed-by: Max Dymond
Closes #9505

[skip ci]

2 years agoCI: optimize some more dependencies install
Philip Heiduck [Tue, 13 Sep 2022 14:15:12 +0000 (16:15 +0200)] 
CI: optimize some more dependencies install

Signed-off-by: Philip Heiduck <pheiduck@Philips-MBP.lan>
Closes #9500

2 years agoCI/GHA: merge event-based and NSS into new linux workflow
Marc Hoersken [Wed, 14 Sep 2022 20:24:39 +0000 (22:24 +0200)] 
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

2 years agoinclude/curl/websockets.h: add extern "C" for C++
Daniel Stenberg [Thu, 15 Sep 2022 06:40:59 +0000 (08:40 +0200)] 
include/curl/websockets.h: add extern "C" for C++

Reported-by: n0name321 on github
Fixes #9509
Closes #9510

2 years agolib1560: extended to verify detect/reject of unknown schemes
Daniel Stenberg [Wed, 14 Sep 2022 07:21:49 +0000 (09:21 +0200)] 
lib1560: extended to verify detect/reject of unknown schemes

... when no guessing is allowed.

2 years agourlapi: detect scheme better when not guessing
Daniel Stenberg [Wed, 14 Sep 2022 07:18:30 +0000 (09:18 +0200)] 
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

2 years agostrerror: improve two URL API error messages
Daniel Stenberg [Wed, 14 Sep 2022 07:17:28 +0000 (09:17 +0200)] 
strerror: improve two URL API error messages

2 years agoCI/GHA: merge bearssl and hyper into initial linux workflow
Marc Hoersken [Tue, 13 Sep 2022 19:13:17 +0000 (21:13 +0200)] 
CI/GHA: merge bearssl and hyper into initial linux workflow

Begin work on merging all Linux workflows into one file.

Closes #9501

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 14 Sep 2022 07:58:50 +0000 (09:58 +0200)] 
RELEASE-NOTES: synced

2 years agocmake: define BUILDING_LIBCURL in lib/CMakeLists, not config.h
Daniel Stenberg [Tue, 13 Sep 2022 12:43:40 +0000 (14:43 +0200)] 
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

2 years agotool_hugehelp: make hugehelp a blank macro when disabled
Daniel Stenberg [Tue, 13 Sep 2022 08:25:26 +0000 (10:25 +0200)] 
tool_hugehelp: make hugehelp a blank macro when disabled

Closes #9485

2 years agogetparameter: return PARAM_MANUAL_REQUESTED for -M even when disabled
Daniel Stenberg [Mon, 12 Sep 2022 14:28:32 +0000 (16:28 +0200)] 
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

2 years agosetopt: fix compiler warning
Daniel Stenberg [Tue, 13 Sep 2022 20:56:31 +0000 (22:56 +0200)] 
setopt: fix compiler warning

Follow-up to cd5ca80f00d2

closes #9502

2 years agoCI: skip make, do make install at once for dependencies
Philip Heiduck [Sun, 11 Sep 2022 22:04:32 +0000 (00:04 +0200)] 
CI: skip make, do make install at once for dependencies

Signed-off-by: Philip Heiduck <pheiduck@Philips-MBP.lan>
Closes #9477

2 years agoformdata: typecast the va_arg return value
Daniel Stenberg [Tue, 13 Sep 2022 12:52:33 +0000 (14:52 +0200)] 
formdata: typecast the va_arg return value

To avoid "enumerated type mixed with another type" warnings

Follow-up from 0f52dd5fd5aa3592691a

Closes #9499

2 years agoRELEASE-PROCEDURE.md: mention patch releases
Daniel Stenberg [Tue, 13 Sep 2022 06:37:01 +0000 (08:37 +0200)] 
RELEASE-PROCEDURE.md: mention patch releases

- When to make them and how to argue for them
- Refreshed the release date list

Closes #9495

2 years agourldata: use a curl_prot_t type for storing protocol bits
Daniel Stenberg [Mon, 12 Sep 2022 07:57:01 +0000 (09:57 +0200)] 
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

2 years agoformdata: fix warning: 'CURLformoption' is promoted to 'int'
zhanghu [Thu, 22 Apr 2021 09:10:00 +0000 (17:10 +0800)] 
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

2 years agoCURLOPT_CONNECT_ONLY.3: for ws(s) as well
Daniel Stenberg [Mon, 12 Sep 2022 14:34:31 +0000 (16:34 +0200)] 
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

2 years agotool_operate: avoid a few #ifdefs for disabled-libcurl builds
Daniel Stenberg [Mon, 12 Sep 2022 14:30:54 +0000 (16:30 +0200)] 
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

2 years agoscripts: use `grep -E` instead of `egrep`
a1346054 [Mon, 12 Sep 2022 20:21:03 +0000 (20:21 +0000)] 
scripts: use `grep -E` instead of `egrep`

egrep is deprecated

Closes #9491

2 years agowolfSSL: fix session management bug.
Hayden Roche [Tue, 13 Sep 2022 01:14:14 +0000 (18:14 -0700)] 
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

2 years agodocs: use "WebSocket" in singular
Daniel Stenberg [Tue, 13 Sep 2022 07:17:53 +0000 (09:17 +0200)] 
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

2 years agows: fix build without `USE_WEBSOCKETS`
Marcel Raad [Mon, 12 Sep 2022 08:22:42 +0000 (10:22 +0200)] 
ws: fix build without `USE_WEBSOCKETS`

The curl.h include is required unconditionally.

2 years agows: add missing curl.h include
Marcel Raad [Mon, 12 Sep 2022 08:11:56 +0000 (10:11 +0200)] 
ws: add missing curl.h include

A conflict between commits 664249d0952 and e5839f4ee70 broke the build.

2 years agows: fix an infof() call to use %uz for size_t output
Daniel Stenberg [Mon, 12 Sep 2022 07:29:16 +0000 (09:29 +0200)] 
ws: fix an infof() call to use %uz for size_t output

Detected by Coverity, CID 1514665.

Closes #9480

2 years agocurl_setup: include only system.h instead of curl.h
Marcel Raad [Wed, 7 Sep 2022 10:30:15 +0000 (12:30 +0200)] 
curl_setup: include only system.h instead of curl.h

As done before commit 9506d01ee50.

Ref: https://github.com/curl/curl/pull/9375#discussion_r957010158
Closes https://github.com/curl/curl/pull/9453

2 years agolib: add missing limits.h includes
Marcel Raad [Wed, 7 Sep 2022 14:11:42 +0000 (16:11 +0200)] 
lib: add missing limits.h includes

Closes https://github.com/curl/curl/pull/9453

2 years agolib and tests: add missing curl.h includes
Marcel Raad [Wed, 7 Sep 2022 10:19:29 +0000 (12:19 +0200)] 
lib and tests: add missing curl.h includes

Closes https://github.com/curl/curl/pull/9453

2 years agocurl_setup: include curl.h after platform setup headers
Marcel Raad [Wed, 7 Sep 2022 08:54:16 +0000 (10:54 +0200)] 
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

2 years agodocs: correct missing uppercase in Markdown files
Benjamin Loison [Sun, 11 Sep 2022 21:39:14 +0000 (23:39 +0200)] 
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

2 years agotool_setopt: use better English in --libcurl source comments
Daniel Stenberg [Sun, 11 Sep 2022 21:59:38 +0000 (23:59 +0200)] 
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

2 years agosetopt: make protocol2num use a curl_off_t for the protocol bit
Daniel Stenberg [Sun, 11 Sep 2022 22:02:07 +0000 (00:02 +0200)] 
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

2 years agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 11 Sep 2022 21:46:44 +0000 (23:46 +0200)] 
RELEASE-NOTES: synced

2 years agoconfigure: polish the grep -E message a bit further
Daniel Stenberg [Sun, 11 Sep 2022 13:08:08 +0000 (15:08 +0200)] 
configure: polish the grep -E message a bit further

Suggested-by: Emanuele Torre
Closes #9473

2 years agoGHA: add a gcc-11 -O3 build using OpenSSL
Daniel Stenberg [Thu, 8 Sep 2022 09:32:34 +0000 (11:32 +0200)] 
GHA: add a gcc-11 -O3 build using OpenSSL

Since -O3 might trigger other warnings

Closes #9454

2 years agocontent_encoding: use writer struct subclasses for different encodings
Patrick Monnerat [Fri, 9 Sep 2022 11:25:02 +0000 (13:25 +0200)] 
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

2 years agoconfigure: correct the wording when checking grep -E
Daniel Stenberg [Sat, 10 Sep 2022 22:10:26 +0000 (00:10 +0200)] 
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

2 years agowebsockets: sync prototypes in docs with implementation [ci skip]
Viktor Szakats [Sat, 10 Sep 2022 21:36:49 +0000 (21:36 +0000)] 
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

2 years agosetopt: make protocols2num() work with websockets
Daniel Stenberg [Sat, 10 Sep 2022 15:13:44 +0000 (17:13 +0200)] 
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

2 years agocurl/websockets.h: remove leftover bad typedef
Daniel Stenberg [Sat, 10 Sep 2022 15:10:10 +0000 (17:10 +0200)] 
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

2 years agofix Cygwin/MSYS compilation
Orgad Shaneh [Fri, 5 Aug 2022 10:45:25 +0000 (13:45 +0300)] 
fix Cygwin/MSYS compilation

_getpid is Windows API. On Cygwin variants it should remain getpid.

Fixes #8220
Closes #9255

2 years agoGHA: prepare workflow merge by aligning structure again
Marc Hoersken [Thu, 1 Sep 2022 20:44:43 +0000 (22:44 +0200)] 
GHA: prepare workflow merge by aligning structure again

Closes #9413

2 years agodocs: the websockets symbols are added in 7.86.0
Daniel Stenberg [Fri, 9 Sep 2022 13:36:06 +0000 (15:36 +0200)] 
docs: the websockets symbols are added in 7.86.0

Nothing else

Closes #9459

2 years agotests/libtest/Makefile.inc: fixup merge conflict mistake
Daniel Stenberg [Fri, 9 Sep 2022 13:13:07 +0000 (15:13 +0200)] 
tests/libtest/Makefile.inc: fixup merge conflict mistake

2 years agoEXPERIMENTAL.md: add WebSockets
Daniel Stenberg [Fri, 9 Sep 2022 13:11:15 +0000 (15:11 +0200)] 
EXPERIMENTAL.md: add WebSockets

2 years agoappveyor: enable websockets
Daniel Stenberg [Fri, 9 Sep 2022 13:11:15 +0000 (15:11 +0200)] 
appveyor: enable websockets

2 years agocirrus: enable websockets in the windows builds
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
cirrus: enable websockets in the windows builds

2 years agoGHA: add websockets to macos, openssl3 and hyper builds
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
GHA: add websockets to macos, openssl3 and hyper builds

2 years agotests: add websockets tests
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
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