Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from curl:master #599

Merged
merged 4 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMake/win32-cache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ if(MINGW)
set(HAVE_UTIME_H 1) # wrapper to sys/utime.h
set(HAVE_DIRENT_H 1)
set(HAVE_OPENDIR 1)
if((CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) OR
(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6))
set(HAVE_STDATOMIC_H 1)
set(HAVE_ATOMIC 1)
else()
set(HAVE_STDATOMIC_H 0)
set(HAVE_ATOMIC 0)
endif()
else()
set(HAVE_LIBGEN_H 0)
set(HAVE_FTRUNCATE 0)
Expand Down
2 changes: 1 addition & 1 deletion lib/cf-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ static int do_connect(struct Curl_cfilter *cf, struct Curl_easy *data,

rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, ctx->addr.addrlen);
#elif defined(MSG_FASTOPEN) /* old Linux */
if(cf->conn->given->flags & PROTOPT_SSL)
if(Curl_conn_is_ssl(cf->conn, cf->sockindex))
rc = connect(ctx->sock, &ctx->addr.curl_sa_addr, ctx->addr.addrlen);
else
rc = 0; /* Do nothing */
Expand Down
4 changes: 4 additions & 0 deletions lib/config-win32ce.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,12 @@

/* Define cpu-machine-OS */
#ifndef CURL_OS
#ifdef _M_ARM
#define CURL_OS "arm-pc-win32ce"
#else
#define CURL_OS "i386-pc-win32ce"
#endif
#endif

/* ---------------------------------------------------------------- */
/* Windows CE */
Expand Down
12 changes: 6 additions & 6 deletions lib/curl_sspi.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,27 @@ extern PSecurityFunctionTable Curl_pSecFn;
#endif

#ifndef SEC_I_SIGNATURE_NEEDED
# define SEC_I_SIGNATURE_NEEDED ((HRESULT)0x0009035CL)
#define SEC_I_SIGNATURE_NEEDED ((HRESULT)0x0009035CL)
#endif

#ifndef CRYPT_E_REVOKED
# define CRYPT_E_REVOKED ((HRESULT)0x80092010L)
#define CRYPT_E_REVOKED ((HRESULT)0x80092010L)
#endif

#ifndef CRYPT_E_NO_REVOCATION_DLL
# define CRYPT_E_NO_REVOCATION_DLL ((HRESULT)0x80092011L)
#define CRYPT_E_NO_REVOCATION_DLL ((HRESULT)0x80092011L)
#endif

#ifndef CRYPT_E_NO_REVOCATION_CHECK
# define CRYPT_E_NO_REVOCATION_CHECK ((HRESULT)0x80092012L)
#define CRYPT_E_NO_REVOCATION_CHECK ((HRESULT)0x80092012L)
#endif

#ifndef CRYPT_E_REVOCATION_OFFLINE
# define CRYPT_E_REVOCATION_OFFLINE ((HRESULT)0x80092013L)
#define CRYPT_E_REVOCATION_OFFLINE ((HRESULT)0x80092013L)
#endif

#ifndef CRYPT_E_NOT_IN_REVOCATION_DATABASE
# define CRYPT_E_NOT_IN_REVOCATION_DATABASE ((HRESULT)0x80092014L)
#define CRYPT_E_NOT_IN_REVOCATION_DATABASE ((HRESULT)0x80092014L)
#endif

#ifdef UNICODE
Expand Down
2 changes: 1 addition & 1 deletion lib/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3163,7 +3163,7 @@ static CURLcode ftp_connect(struct Curl_easy *data,

PINGPONG_SETUP(pp, ftp_statemachine, ftp_endofresp);

if(conn->handler->flags & PROTOPT_SSL) {
if(Curl_conn_is_ssl(conn, FIRSTSOCKET)) {
/* BLOCKING */
result = Curl_conn_connect(data, FIRSTSOCKET, TRUE, done);
if(result)
Expand Down
8 changes: 4 additions & 4 deletions lib/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -2526,7 +2526,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
goto fail;
}

if(!(conn->handler->flags&PROTOPT_SSL) &&
if(!Curl_conn_is_ssl(conn, FIRSTSOCKET) &&
conn->httpversion < 20 &&
(data->state.httpwant == CURL_HTTP_VERSION_2)) {
/* append HTTP2 upgrade magic stuff to the HTTP request if it is not done
Expand Down Expand Up @@ -2670,7 +2670,7 @@ static CURLcode http_header(struct Curl_easy *data,
case 'A':
#ifndef CURL_DISABLE_ALTSVC
v = (data->asi &&
((data->conn->handler->flags & PROTOPT_SSL) ||
(Curl_conn_is_ssl(data->conn, FIRSTSOCKET) ||
#ifdef DEBUGBUILD
/* allow debug builds to circumvent the HTTPS restriction */
getenv("CURL_ALTSVC_HTTP")
Expand Down Expand Up @@ -2944,7 +2944,7 @@ static CURLcode http_header(struct Curl_easy *data,
#ifndef CURL_DISABLE_HSTS
/* If enabled, the header is incoming and this is over HTTPS */
v = (data->hsts &&
((conn->handler->flags & PROTOPT_SSL) ||
(Curl_conn_is_ssl(conn, FIRSTSOCKET) ||
#ifdef DEBUGBUILD
/* allow debug builds to circumvent the HTTPS restriction */
getenv("CURL_HSTS_HTTP")
Expand Down Expand Up @@ -4168,7 +4168,7 @@ CURLcode Curl_http_req_to_h2(struct dynhds *h2_headers,
infof(data, "set pseudo header %s to %s", HTTP_PSEUDO_SCHEME, scheme);
}
else {
scheme = (data->conn && data->conn->handler->flags & PROTOPT_SSL) ?
scheme = Curl_conn_is_ssl(data->conn, FIRSTSOCKET) ?
"https" : "http";
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/http_negotiate.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#if !defined(CURL_DISABLE_HTTP) && defined(USE_SPNEGO)

#include "urldata.h"
#include "cfilters.h"
#include "sendf.h"
#include "http_negotiate.h"
#include "vauth/vauth.h"
Expand Down Expand Up @@ -109,7 +110,7 @@ CURLcode Curl_input_negotiate(struct Curl_easy *data, struct connectdata *conn,
#endif
/* Check if the connection is using SSL and get the channel binding data */
#if defined(USE_SSL) && defined(HAVE_GSSAPI)
if(conn->handler->flags & PROTOPT_SSL) {
if(Curl_conn_is_ssl(conn, FIRSTSOCKET)) {
Curl_dyn_init(&neg_ctx->channel_binding_data, SSL_CB_MAX_SIZE + 1);
result = Curl_ssl_get_channel_binding(
data, FIRSTSOCKET, &neg_ctx->channel_binding_data);
Expand Down
2 changes: 1 addition & 1 deletion lib/imap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ static CURLcode imap_multi_statemach(struct Curl_easy *data, bool *done)
struct connectdata *conn = data->conn;
struct imap_conn *imapc = &conn->proto.imapc;

if((conn->handler->flags & PROTOPT_SSL) && !imapc->ssldone) {
if(Curl_conn_is_ssl(conn, FIRSTSOCKET) && !imapc->ssldone) {
bool ssldone = FALSE;
result = Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssldone);
imapc->ssldone = ssldone;
Expand Down
3 changes: 2 additions & 1 deletion lib/ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@

#include "urldata.h"
#include <curl/curl.h>
#include "cfilters.h"
#include "sendf.h"
#include "escape.h"
#include "progress.h"
Expand Down Expand Up @@ -351,7 +352,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
}

/* Get the URL scheme (either ldap or ldaps) */
if(conn->given->flags & PROTOPT_SSL)
if(Curl_conn_is_ssl(conn, FIRSTSOCKET))
ldap_ssl = 1;
infof(data, "LDAP local: trying to establish %s connection",
ldap_ssl ? "encrypted" : "cleartext");
Expand Down
2 changes: 1 addition & 1 deletion lib/openldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ static CURLcode oldap_connect(struct Curl_easy *data, bool *done)
ldap_set_option(li->ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);

#ifdef USE_SSL
if(conn->handler->flags & PROTOPT_SSL)
if(Curl_conn_is_ssl(conn, FIRSTSOCKET))
return oldap_ssl_connect(data, OLDAP_SSL);

if(data->set.use_ssl) {
Expand Down
2 changes: 1 addition & 1 deletion lib/pop3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ static CURLcode pop3_multi_statemach(struct Curl_easy *data, bool *done)
struct connectdata *conn = data->conn;
struct pop3_conn *pop3c = &conn->proto.pop3c;

if((conn->handler->flags & PROTOPT_SSL) && !pop3c->ssldone) {
if(Curl_conn_is_ssl(conn, FIRSTSOCKET) && !pop3c->ssldone) {
bool ssldone = FALSE;
result = Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssldone);
pop3c->ssldone = ssldone;
Expand Down
11 changes: 0 additions & 11 deletions lib/setup-win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,6 @@
# if defined(_UNICODE) && !defined(UNICODE)
# error "_UNICODE is defined but UNICODE is not defined"
# endif
/*
* Do not include unneeded stuff in Windows headers to avoid compiler
* warnings and macro clashes.
* Make sure to define this macro before including any Windows headers.
*/
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# ifndef NOGDI
# define NOGDI
# endif
# include <winsock2.h>
# include <ws2tcpip.h>
# include <windows.h>
Expand Down
2 changes: 1 addition & 1 deletion lib/smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ static CURLcode smb_connection_state(struct Curl_easy *data, bool *done)

if(smbc->state == SMB_CONNECTING) {
#ifdef USE_SSL
if((conn->handler->flags & PROTOPT_SSL)) {
if(Curl_conn_is_ssl(conn, FIRSTSOCKET)) {
bool ssl_done = FALSE;
result = Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssl_done);
if(result && result != CURLE_AGAIN)
Expand Down
2 changes: 1 addition & 1 deletion lib/smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ static CURLcode smtp_multi_statemach(struct Curl_easy *data, bool *done)
struct connectdata *conn = data->conn;
struct smtp_conn *smtpc = &conn->proto.smtpc;

if((conn->handler->flags & PROTOPT_SSL) && !smtpc->ssldone) {
if(Curl_conn_is_ssl(conn, FIRSTSOCKET) && !smtpc->ssldone) {
bool ssldone = FALSE;
result = Curl_conn_connect(data, FIRSTSOCKET, FALSE, &ssldone);
smtpc->ssldone = ssldone;
Expand Down
12 changes: 6 additions & 6 deletions lib/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,12 +956,12 @@ static bool url_match_conn(struct connectdata *conn, void *userdata)
return FALSE;
#endif

if((needle->handler->flags&PROTOPT_SSL) !=
(conn->handler->flags&PROTOPT_SSL))
/* do not do mixed SSL and non-SSL connections */
if(get_protocol_family(conn->handler) !=
needle->handler->protocol || !conn->bits.tls_upgraded)
/* except protocols that have been upgraded via TLS */
if((!(needle->handler->flags&PROTOPT_SSL) !=
!Curl_conn_is_ssl(conn, FIRSTSOCKET)) &&
!(get_protocol_family(conn->handler) == needle->handler->protocol &&
conn->bits.tls_upgraded))
/* Deny `conn` if it is not fit for `needle`'s SSL needs,
* UNLESS `conn` is the same protocol family and was upgraded to SSL. */
return FALSE;

#ifndef CURL_DISABLE_PROXY
Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/schannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
*/

#ifndef CALG_SHA_256
# define CALG_SHA_256 0x0000800c
#define CALG_SHA_256 0x0000800c
#endif

#ifndef PKCS12_NO_PERSIST_KEY
Expand Down
2 changes: 2 additions & 0 deletions tests/http/clients/hx-download.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ static void usage(const char *msg)
fprintf(stderr,
" -A number abort transfer after `number` response bytes\n"
" -F number fail writing response after `number` response bytes\n"
" -M number max concurrent connections to a host\n"
" -P number pause transfer after `number` response bytes\n"
" -r <host>:<port>:<addr> resolve information\n"
" -T number max concurrent connections total\n"
" -V http_version (http/1.1, h2, h3) http version to use\n"
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/http/test_01_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_01_05_h3_get(self, env: Env, httpd, nghttpx):
# simple download, check connect/handshake timings
@pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL")
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
def test_01_06_timings(self, env: Env, httpd, nghttpx, repeat, proto):
def test_01_06_timings(self, env: Env, httpd, nghttpx, proto):
if proto == 'h3' and not env.have_h3():
pytest.skip("h3 not supported")
curl = CurlClient(env=env)
Expand All @@ -103,7 +103,7 @@ def test_01_06_timings(self, env: Env, httpd, nghttpx, repeat, proto):
# simple https: HEAD
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
@pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL")
def test_01_07_head(self, env: Env, httpd, nghttpx, repeat, proto):
def test_01_07_head(self, env: Env, httpd, nghttpx, proto):
if proto == 'h3' and not env.have_h3():
pytest.skip("h3 not supported")
curl = CurlClient(env=env)
Expand Down
Loading
Loading