Commit Graph

12784 Commits

Author SHA1 Message Date
Nick Banks
ae98b85020
msh3: add support for request payload
Closes #10136
2022-12-28 13:52:58 +01:00
Stefan Eissing
f39472ea9f
openssl: remove attached easy handles from SSL instances
- keeping the "current" easy handle registered at SSL* is no longer
   necessary, since the "calling" data object is already stored in the
   cfilter's context (and used by other SSL backends from there).
 - The "detach" of an easy handle that goes out of scope is then avoided.
 - using SSL_set0_wbio for clear reference counting where available.

Closes #10151
2022-12-28 13:30:05 +01:00
Daniel Stenberg
7fa449ca0c
socketpair: allow localhost MITM sniffers
Windows allow programs to MITM connections to localhost. The previous
check here would detect that and error out. This new method writes data
to verify the pipe thus allowing MITM.

Reported-by: SerusDev on github
Fixes #10144
Closes #10169
2022-12-28 09:27:02 +01:00
Stefan Eissing
db5f833cc7
haxproxy: send before TLS handhshake
- reverse order of haproxy and final ssl cfilter

- make haproxy avaiable on PROXY builds, independent of HTTP support as
  it can be used with any protocol.

Reported-by: Sergio-IME on github
Fixes #10165
Closes #10167
2022-12-27 16:06:43 +01:00
Daniel Stenberg
ca02a77f05
hsts: handle adding the same host name again
It will then use the largest expire time of the two entries.
2022-12-27 15:22:32 +01:00
Daniel Stenberg
076a2f6291
share: add sharing of HSTS cache among handles
Closes #10138
2022-12-27 15:22:01 +01:00
Viktor Szakats
692c73707a
Makefile.mk: fix wolfssl and mbedtls default paths
Fix the defaults for `WOLFSSL_PATH` and `MBEDTLS_PATH` to have
meaningful values instead of the copy-pasted wrong ones.

Ref: 66e68ca47f (r94275172)

Reported-by: Ryan Schmidt
Closes #10164
2022-12-27 11:36:03 +00:00
Daniel Stenberg
728400f875
cfilters:Curl_conn_get_select_socks: use the first non-connected filter
When there are filters addded for both socket and SSL, the code
previously checked the SSL sockets during connect when it *should* first
check the socket layer until that has connected.

Fixes #10157
Fixes #10146
Closes #10160

Reviewed-by: Stefan Eissing
2022-12-27 10:48:29 +01:00
Daniel Stenberg
901392cbb7
urlapi: add CURLU_PUNYCODE
Allows curl_url_get() get the punycode version of host names for the
host name and URL parts.

Extend test 1560 to verify.

Closes #10109
2022-12-26 23:29:23 +01:00
Daniel Stenberg
ccf1ca9430
libssh2: try sha2 algos for hostkey methods
As is supported by recent libssh2, but should just be ignored by older
versions.

Reported-by: norbertmm on github
Assisted-by: norbertmm on github
Fixes #10143
Closes #10145
2022-12-26 10:15:48 +01:00
Radu Hociung
73477d5a4d
http: remove the trace message "Mark bundle... multiuse"
The message "Mark bundle as not supporting multiuse" was added at commit
29364d93 when an http/2-related bug was fixed, and it appears to be a
leftover trace message.

This message should be removed because:
 * it conveys no information to the user
 * it is enabled in the default build (--enable-verbose)
 * it reads like a warning/unexpected condition
 * it is equivalent to "Detected http proto < 2", which is
   not a useful message.
 * it is a time-wasting red-herring for anyone who encounters
   it for the first time while investigating some other, real
   problem.

This commit removes the trace message "Mark bundle as not
supporting multiuse"

Closes #10159
2022-12-26 09:29:36 +01:00
Hannah Schierling
a5cf4a87cf
url: fix build with --disable-cookies
Struct `UserDefined` has no member `cookielist` if
`CURL_DISABLE_COOKIES` is defined.

Follow-up to af5999a

Closes #10158
2022-12-26 09:27:39 +01:00
Daniel Stenberg
db07301fbb
urldata: remove unused struct fields, made more conditional
- source_quote, source_prequote and source_postquote have not been used since
  5e0d9aea3; September 2006

- make several fields conditional on proxy support

- make three quote struct fields conditional on FTP || SSH

- make 'mime_options' depend on MIME

- make trailer_* fields depend on HTTP

- change 'gssapi_delegation' from long to unsigned char

- make 'localportrange' unsigned short instead of int

- conn->trailer now depends on HTTP

Closes #10147
2022-12-23 08:45:05 +01:00
Daniel Stenberg
f4883ba966
urldata: make set.http200aliases conditional on HTTP being present
And make a few SSH-only fields depend on SSH

Closes #10140
2022-12-22 23:07:46 +01:00
Daniel Stenberg
aef4dc892d
md4: fix build with GnuTLS + OpenSSL v1
Reported-by: Esdras de Morais da Silva

Fixes #10110
Closes #10142
2022-12-22 23:06:46 +01:00
Daniel Stenberg
31b9a32260
urldata: make 'ftp_create_missing_dirs' depend on FTP || SFTP
Closes #10139
2022-12-22 23:04:47 +01:00
John Bampton
80efd3bc61
misc: fix grammar and spelling
Closes #10137
2022-12-22 18:07:07 +01:00
Daniel Stenberg
af5999a674
urldata: move the cookefilelist to the 'set' struct
The cookiefile entries are set into the handle and should remain set for
the lifetime of the handle so that duplicating it also duplicates the
list. Therefore, the struct field is moved from 'state' to 'set'.

Fixes #10133
Closes #10134
2022-12-22 16:06:37 +01:00
Daniel Stenberg
e4505a1915
strdup: name it Curl_strdup
It does not belong in the curlx_ name space as it is never used
externally.

Closes #10132
2022-12-22 14:31:37 +01:00
Nick Banks
72b819f147
msh3: update to v0.5 Release
Closes #10125
2022-12-22 14:29:40 +01:00
Daniel Stenberg
565d0ca2b1
http: fix the ::1 comparison for IPv6 localhost for cookies
When checking if there is a "secure context", which it is if the
connection is to localhost even if the protocol is HTTP, the comparison
for ::1 was done incorrectly and included brackets.

Reported-by: BratSinot on github

Fixes #10120
Closes #10121
2022-12-20 13:50:15 +01:00
Daniel Stenberg
4f20188ac6
smb/telnet: do not free the protocol struct in *_done()
It is managed by the generic layer.

Reported-by: Trail of Bits

Closes #10112
2022-12-19 12:33:19 +01:00
Daniel Stenberg
9e71901634
http: use the IDN decoded name in HSTS checks
Otherwise it stores the info HSTS into the persistent cache for the IDN
name which will not match when the HSTS status is later checked for
using the decoded name.

Reported-by: Hiroki Kurosawa

Closes #10111
2022-12-19 11:04:15 +01:00
Xì Gà
6cc18802f8
socks: fix username max size is 255 (0xFF)
Closes #10105

Reviewed-by: Daniel Gustafsson
2022-12-16 15:01:05 +01:00
Daniel Stenberg
cc0aaf6e82
idn: rename the files to idn.[ch] and hold all IDN functions
Closes #10094
2022-12-15 22:56:58 +01:00
Daniel Stenberg
301812bec2
idn: remove Curl_win32_ascii_to_idn
It was not used. Introduce a new IDN header for the prototype(s).

Closes #10094
2022-12-15 22:56:52 +01:00
Daniel Stenberg
50e781d3ec
socks: fix infof() flag for outputing a char
It used to be a 'long', %lu is no longer correct.

Follow-up to 57d2d9b6be
Detected by Coverity CID 1517663

Closes #10100
2022-12-15 15:52:17 +01:00
Daniel Stenberg
5de6848f10
cmake: set the soname on the shared library
Set SONAME and VERSION for platforms we think this works on. Remove
issue from KNOWN_BUGS.

Assisted-by: Jakub Zakrzewski

Closes #10023
2022-12-15 12:36:25 +01:00
Daniel Stenberg
c20b35ddae
urlapi: reject more bad letters from the host name: &+()
Follow-up from eb0167ff7d

Extend test 1560 to verify

Closes #10096
2022-12-15 08:23:48 +01:00
Daniel Stenberg
b740f152a8
altsvc: fix rejection of negative port numbers
Follow-up to ac612dfeee

strtoul() accepts a leading minus so better make sure there is none

Extended test 356 somewhat to use a huge negative 64 bit number that
otherwise becomes a low positive number.

Closes #10095
2022-12-15 08:21:20 +01:00
Daniel Stenberg
57d2d9b6be
lib: use size_t or int etc instead of longs
Since long is not using a consistent data size in curl builds, making it
often "waste" 32 bits.

Closes #10088
2022-12-14 12:31:01 +01:00
Daniel Gustafsson
6b19247e79 x509asn1: avoid freeing unallocated pointers
When utf8asn1str fails there is no allocation returned, so freeing
the return pointer in **to is at best a no-op and at worst a double-
free bug waiting to happen. The current coding isn't hiding any such
bugs but to future proof, avoid freeing the return value pointer iff
the function failed.

Closes: #10087
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
2022-12-14 10:14:27 +01:00
Daniel Stenberg
734c1f8909
ws: if no connection is around, return error
- curl_ws_send returns CURLE_SEND_ERROR if data->conn is gone

- curl_ws_recv returns CURLE_GOT_NOTHING on connection close

- curl_ws_recv.3: mention new return code for connection close + example
  embryo

Closes #10084
2022-12-13 15:13:03 +01:00
Prithvi MK
b80dae232e
c-hyper: fix multi-request mechanism
It makes test 565 run fine.

Fixes #8896
Closes #10080
Assisted-by: Daniel Stenberg
2022-12-11 14:15:53 +01:00
Ryan Schmidt
ac4554870d
system.h: fix socklen_t, curl_off_t, long long for Classic Mac OS
Change "__MWERKS__" to "macintosh". When this block was originally added
in 3ac6929 it was probably intended to handle classic Mac OS since the
previous classic Mac OS build procedure for curl (which was removed in
bf327a9) used Metrowerks CodeWarrior.

But there are other classic Mac OS compilers, such as the MPW compilers,
that were not handled by this case. For classic Mac OS,
CURL_TYPEOF_CURL_SOCKLEN_T needs to match what's provided by the
third-party GUSI library, which does not vary by compiler.

Meanwhile CodeWarrior works on platforms other than classic Mac OS, and
they may need different definitions. Separate blocks could be added
later for any of those platforms that curl doesn't already support.

Closes #10049
2022-12-09 08:21:15 +01:00
Daniel Gustafsson
60453483b5 noproxy: guard against empty hostnames in noproxy check
When checking for a noproxy setting we need to ensure that we get
a hostname passed in. If there is no hostname then there cannot be
a matching noproxy rule for it by definition.

Closes: #10057
Reported-by: Geeknik Labs
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
2022-12-08 23:37:32 +01:00
Daniel Stenberg
c8d24d4e77
c-hyper: CONNECT respones are not server responses
Together with d31915a8db it makes test 265 run fine.

Fixes #8853
Assisted-by: Prithvi MK
Assisted-by: Sean McArthur
Closes #10060
2022-12-08 23:36:23 +01:00
Stefan Eissing
b42156b825
cfilter: improve SSL connection checks
- fixes `Curl_ssl_cf_get_ssl()` to detect also the first filter instance
  as ssl (refs #10053)

- replaces `Curl_ssl_use()` with the correct `Curl_conn_is_ssl()`

Closes #10054
Fixes #10053

Reported-by: Patrick Monnerat
2022-12-08 14:27:06 +01:00
Ryan Schmidt
33f1f4f795 config-mac: define HAVE_SYS_IOCTL_H
This is needed to compile nonblock.c on classic Mac OS with Grand
Unified Socket Interface (GUSI) because nonblock.c uses FIONBIO which is
defined in <sys/filio.h> which is included by <sys/ioctl.h>.

Ref: https://sourceforge.net/projects/gusi/

Closes https://github.com/curl/curl/pull/10042
2022-12-07 15:56:43 -05:00
Jay Satiro
fe3463eba7 build: assume errno.h is always available
- Remove errno.h detection from all build configurations.

errno.h is a standard header according to C89.

Closes https://github.com/curl/curl/pull/9986
2022-12-07 14:41:09 -05:00
Jay Satiro
57d3477e77 build: assume assert.h is always available
- Remove assert.h detection from all build configurations.

assert.h is a standard header according to C89.

I had proposed this several years ago as part of a larger change that
was abandoned.

Ref: https://github.com/curl/curl/issues/1237#issuecomment-277500720

Closes https://github.com/curl/curl/pull/9985
2022-12-07 14:30:32 -05:00
andy5995
68ffb4063d misc: Fix incorrect spelling
Fix various uses of connnect by replacing them with connect.

Closes: #10045
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
2022-12-06 23:18:23 +01:00
Stefan Eissing
2d3e20a2fc
wolfssl: remove special BIO return code handling
- rely solely on the retry flag in BIO, similar to OpenSSL vtls
  implementation.

Ref: https://github.com/curl/curl/pull/10021#issuecomment-1336147053

Closes #10033
2022-12-06 11:08:12 +01:00
Daniel Stenberg
5ec759247a
openssl: return -1 on error in the BIO callbacks
BIO_read and BIO_write return negative numbers on error, including
retryable ones. A regression from 55807e6. Both branches should be
returning -1.

The APIs are patterned after POSIX read and write which, similarly,
return -1 on errors, not zero, with EAGAIN treated as an error.

Bug: https://github.com/curl/curl/issues/10013#issuecomment-1335308146
Reported-by: David Benjamin
Closes #10021
2022-12-06 09:50:29 +01:00
Ryan Schmidt
0ed8ff2d37
config-mac: remove HAVE_SYS_SELECT_H
When compiling for classic Mac OS with GUSI, there is no sys/select.h.
GUSI provides the "select" function prototype in sys/time.h.

Closes #10039
2022-12-06 09:43:03 +01:00
Ryan Schmidt
82b3481309
setup: do not require __MRC__ defined for Mac OS 9 builds
Partially reverts "somewhat protect Mac OS X users from using Mac OS 9
config file", commit 62519bfe05.

Do things that are specific to classic Mac OS (i.e. include config-mac.h
in curl_setup.h and rename "main" to "curl_main" in tool_setup.h) when
only "macintosh" is defined. Remove the additional condition that
"__MRC__" should be defined since that would only be true with the MPW
MrC compiler which prevents the use of other reasonable compilers like
the MPW SC compiler and especially the Metrowerks CodeWarrior compilers.
"macintosh" is only defined by classic Mac OS compilers so this change
should not affect users of Mac OS X / OS X / macOS / any other OS.

Closes #10037
2022-12-06 09:35:47 +01:00
Daniel Stenberg
c6f602c93f
base64: faster base64 decoding
- by using a lookup table instead of strchr()
- by doing full quantums first, then padding

Closes #10032
2022-12-06 08:57:04 +01:00
mickae1
8fe33a9661
libssh2: return error when ssh_hostkeyfunc returns error
return CURLE_PEER_FAILED_VERIFICATION if verification with the callback
return a result different than CURLKHMATCH_OK

Closes #10034
2022-12-06 00:15:18 +01:00
Viktor Szakats
2b584fffce
Makefile.mk: improve a GNU Make hack [ci skip]
Replace the hack of using `$() ` to represent a single space. The new
method silences the `--warn-undefined-variables` debug warning and it's
also a better-known form of solving this problem.

Reviewed-by: Jay Satiro
Closes #10031
2022-12-05 14:31:32 +00:00
Daniel Stenberg
fc02a78081
base64: encode without using snprintf
For speed. In some tests, this approch is 29 times faster!

Closes #10026
2022-12-05 11:33:34 +01:00