lib: prepare the incoming of additional protocols

Move the curl_prot_t to its own conditional block. Introduce symbol
PROTO_TYPE_SMALL to control it.

Fix a cast in a curl_prot_t assignment.
Remove an outdated comment.

Follow-up to cd5ca80.

Closes #9534
This commit is contained in:
Patrick Monnerat 2022-09-22 15:27:04 +02:00 committed by Daniel Stenberg
parent d4b1ad59a3
commit 91e06e687a
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 10 additions and 9 deletions

View File

@ -577,11 +577,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
set->new_file_perms = 0644; /* Default permissions */ set->new_file_perms = 0644; /* Default permissions */
set->new_directory_perms = 0755; /* Default permissions */ set->new_directory_perms = 0755; /* Default permissions */
set->allowed_protocols = (curl_prot_t) CURLPROTO_ALL;
/* for the *protocols fields we don't use the CURLPROTO_ALL convenience
define since we internally only use the lower 16 bits for the passed
in bitmask to not conflict with the private bits */
set->allowed_protocols = (unsigned int)CURLPROTO_ALL;
set->redir_protocols = CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FTP | set->redir_protocols = CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FTP |
CURLPROTO_FTPS; CURLPROTO_FTPS;

View File

@ -60,13 +60,18 @@
* protocol fields in the protocol handler. * protocol fields in the protocol handler.
*/ */
#define CURLPROTO_WS (1<<30) #define CURLPROTO_WS (1<<30)
#define CURLPROTO_WSS (1LL<<31) #define CURLPROTO_WSS ((curl_prot_t)1<<31)
/* This type should be bumped to a curl_off_t once we need bit 32 or higher */
typedef unsigned int curl_prot_t;
#else #else
#define CURLPROTO_WS 0 #define CURLPROTO_WS 0
#define CURLPROTO_WSS 0 #define CURLPROTO_WSS 0
#endif
/* This should be undefined once we need bit 32 or higher */
#define PROTO_TYPE_SMALL
#ifndef PROTO_TYPE_SMALL
typedef curl_off_t curl_prot_t;
#else
typedef unsigned int curl_prot_t; typedef unsigned int curl_prot_t;
#endif #endif