tidy-up: fix comment indentation

Closes #22373
This commit is contained in:
Viktor Szakats 2026-06-28 22:38:51 +02:00
parent 381c3d56e3
commit 3a0c600a1e
No known key found for this signature in database
90 changed files with 463 additions and 593 deletions

View file

@ -148,7 +148,7 @@ static CURLcode async_ares_init(struct Curl_easy *data,
if c-ares >= 1.24.0, user can set the timeout via /etc/resolv.conf to
overwrite c-ares' timeout.
*/
*/
DEBUGASSERT(ares_ver);
if(ares_ver < 0x011400) {
options.timeout = CARES_TIMEOUT_PER_ATTEMPT;

View file

@ -48,8 +48,7 @@
future. (from RFC6265bis draft-19)
For the sake of easier testing, align the capped time to an even 60 second
boundary.
*/
boundary. */
static void cap_expires(time_t now, struct Cookie *co)
{
if(co->expires && (TIME_T_MAX - COOKIES_MAXAGE - 30) > now) {
@ -335,15 +334,14 @@ static bool bad_domain(const char *domain, size_t len)
}
#endif
/*
RFC 6265 section 4.1.1 says a server should accept this range:
/* RFC 6265 section 4.1.1 says a server should accept this range:
cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
Yet, Firefox and Chrome as of June 2022 accept space, comma and double-quotes
fine. The prime reason for filtering out control bytes is that some HTTP
servers return 400 for requests that contain such.
*/
Yet, Firefox and Chrome as of June 2022 accept space, comma and
double-quotes fine. The prime reason for filtering out control bytes is that
some HTTP servers return 400 for requests that contain such.
*/
static bool invalid_octets(const char *ptr, size_t len)
{
const unsigned char *p = (const unsigned char *)ptr;
@ -359,8 +357,7 @@ static bool invalid_octets(const char *ptr, size_t len)
/* The maximum length we accept a date string for the 'expire' keyword. The
standard date formats are within the 30 bytes range. This adds an extra
margin to make sure it realistically works with what is used out there.
*/
margin to make sure it realistically works with what is used out there. */
#define MAX_DATE_LENGTH 80
#define COOKIE_NAME 0

View file

@ -72,7 +72,7 @@ struct CookieInfo {
In the 6265bis draft document section 5.4 it is phrased even stronger: "If
the sum of the lengths of the name string and the value string is more than
4096 octets, abort these steps and ignore the set-cookie-string entirely."
*/
*/
/** Limits for INCOMING cookies **/

View file

@ -349,7 +349,7 @@
#cmakedefine HAVE_IOCTLSOCKET_CAMEL 1
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
*/
*/
#cmakedefine HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */
@ -607,14 +607,12 @@
/* cpu-machine-OS */
#cmakedefine CURL_OS ${CURL_OS}
/*
Note: SIZEOF_* variables are fetched with CMake through check_type_size().
As per CMake documentation on CheckTypeSize, C preprocessor code is
generated by CMake into SIZEOF_*_CODE. This is what we use in the
following statements.
Reference: https://cmake.org/cmake/help/latest/module/CheckTypeSize.html
*/
/* Note: SIZEOF_* variables are fetched with CMake through check_type_size().
As per CMake documentation on CheckTypeSize, C preprocessor code is
generated by CMake into SIZEOF_*_CODE. This is what we use in the
following statements.
Ref: https://cmake.org/cmake/help/latest/module/CheckTypeSize.html
*/
/* The size of `int', as computed by sizeof. */
${SIZEOF_INT_CODE}

View file

@ -30,16 +30,15 @@
#include "rand.h"
#include "curl_fopen.h"
/*
The dirslash() function breaks a null-terminated pathname string into
directory and filename components then returns the directory component up
to, *AND INCLUDING*, a final '/'. If there is no directory in the path,
this instead returns a "" string.
/* The dirslash() function breaks a null-terminated pathname string into
directory and filename components then returns the directory component up
to, *AND INCLUDING*, a final '/'. If there is no directory in the path,
this instead returns a "" string.
This function returns a pointer to malloc'ed memory.
This function returns a pointer to malloc'ed memory.
The input path to this function is expected to have a filename part.
*/
The input path to this function is expected to have a filename part.
*/
#ifdef _WIN32
#define PATHSEP "\\"

View file

@ -551,7 +551,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(const unsigned char *ntlmv2hash,
unsigned char **ntresp,
unsigned int *ntresp_len)
{
/* NTLMv2 response structure :
/* NTLMv2 response structure:
-----------------------------------------------------------------------------
0 HMAC MD5 16 bytes
------BLOB-------------------------------------------------------------------

View file

@ -1250,19 +1250,17 @@ typedef unsigned int curl_bit;
#endif
/* In Windows the default file mode is text but an application can override it.
Therefore we specify it explicitly. https://github.com/curl/curl/pull/258
*/
Therefore we specify it explicitly. https://github.com/curl/curl/pull/258 */
#if defined(_WIN32) || defined(MSDOS)
#define FOPEN_READTEXT "rt"
#define FOPEN_WRITETEXT "wt"
#define FOPEN_APPENDTEXT "at"
#elif defined(__CYGWIN__)
/* Cygwin has specific behavior we need to address when _WIN32 is not defined.
https://cygwin.com/cygwin-ug-net/using-textbinary.html
For write we want our output to have line endings of LF and be compatible with
other Cygwin utilities. For read we want to handle input that may have line
endings either CRLF or LF so 't' is appropriate.
*/
https://cygwin.com/cygwin-ug-net/using-textbinary.html
For write we want our output to have line endings of LF and be compatible
with other Cygwin utilities. For read we want to handle input that may have
line endings either CRLF or LF so 't' is appropriate. */
#define FOPEN_READTEXT "rt"
#define FOPEN_WRITETEXT "w"
#define FOPEN_APPENDTEXT "a"

View file

@ -27,30 +27,28 @@
#include "curlx/basename.h"
/*
(Quote from The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004
Edition)
/* (Quote from The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004
Edition)
The basename() function shall take the pathname pointed to by path and
return a pointer to the final component of the pathname, deleting any
trailing '/' characters.
The basename() function shall take the pathname pointed to by path and
return a pointer to the final component of the pathname, deleting any
trailing '/' characters.
If the string pointed to by path consists entirely of the '/' character,
basename() shall return a pointer to the string "/". If the string pointed
to by path is exactly "//", it is implementation-defined whether '/' or "//"
is returned.
If the string pointed to by path consists entirely of the '/' character,
basename() shall return a pointer to the string "/". If the string pointed
to by path is exactly "//", it is implementation-defined whether '/' or "//"
is returned.
If path is a null pointer or points to an empty string, basename() shall
return a pointer to the string ".".
If path is a null pointer or points to an empty string, basename() shall
return a pointer to the string ".".
The basename() function may modify the string pointed to by path, and may
return a pointer to static storage that may then be overwritten by a
subsequent call to basename().
The basename() function may modify the string pointed to by path, and may
return a pointer to static storage that may then be overwritten by a
subsequent call to basename().
The basename() function need not be reentrant. A function that is not
required to be reentrant is not required to be thread-safe.
*/
The basename() function need not be reentrant. A function that is not
required to be reentrant is not required to be thread-safe.
*/
char *curlx_basename(char *path)
{
/* Ignore all the details above for now and make a quick and simple

View file

@ -106,8 +106,7 @@ void curlx_str_passblanks(const char **linep);
/* given a hexadecimal letter, return the binary value. '0' returns 0, 'a'
returns 10. THIS ONLY WORKS ON VALID HEXADECIMAL LETTER INPUT. Verify
before calling this!
*/
before calling this. */
extern const unsigned char curlx_hexasciitable[];
#define curlx_hexval(x) (unsigned char)(curlx_hexasciitable[(x) - '0'] & 0x0f)

View file

@ -129,14 +129,10 @@ static struct addrinfo *mk_getaddrinfo(const struct ares_addrinfo *aihead)
return cafirst;
}
/*
RETURN VALUE
getaddrinfo() returns 0 if it succeeds, or one of the following nonzero
error codes:
...
*/
/* RETURN VALUE
getaddrinfo() returns 0 if it succeeds, or one of the following nonzero
error codes:
... */
int r_getaddrinfo(const char *node,
const char *service,
const struct addrinfo *hints,

View file

@ -177,8 +177,7 @@ static CURLcode file_connect(struct Curl_easy *data, bool *done)
On other platforms, we need the slash to indicate an
absolute pathname. On Windows, absolute paths start
with a drive letter.
*/
with a drive letter. */
actual_path = real_path;
if((actual_path[0] == '/') &&
actual_path[1] &&
@ -388,8 +387,7 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
/* This implementation ignores the hostname in conformance with
RFC 1738. Only local files (reachable via the standard file system)
are supported. This means that files on remotely mounted directories
(via NFS, Samba, NT sharing) can be accessed through a file:// URL
*/
(via NFS, Samba, NT sharing) can be accessed through a file:// URL */
struct FILEPROTO *file = Curl_meta_get(data, CURL_META_FILE_EASY);
CURLcode result = CURLE_OK;
curlx_struct_stat statbuf;

View file

@ -232,12 +232,10 @@ static CURLcode ftp_parse_url_path(struct Curl_easy *data,
if((pathLen > 0) && (rawPath[pathLen - 1] != '/'))
fileName = rawPath; /* this is a full file path */
/*
else: ftpc->file is not used anywhere other than for operations on
a file. In other words, never for directory operations,
so we can safely leave filename as NULL here and use it as a
argument in dir/file decisions.
*/
/* else: ftpc->file is not used anywhere other than for operations on
a file. In other words, never for directory operations,
so we can safely leave filename as NULL here and use it as a
argument in dir/file decisions. */
break;
case FTPFILE_SINGLECWD:
@ -820,8 +818,7 @@ static const char *pathpiece(struct ftp_conn *ftpc, int num)
ftp_state_cwd() sends the range of CWD commands to the server to change to
the correct directory. It may also need to send MKD commands to create
missing ones, if that option is enabled.
*/
missing ones, if that option is enabled. */
static CURLcode ftp_state_cwd(struct Curl_easy *data,
struct ftp_conn *ftpc,
struct FTP *ftp)
@ -1415,19 +1412,17 @@ static CURLcode ftp_state_use_pasv(struct Curl_easy *data,
struct connectdata *conn)
{
CURLcode result = CURLE_OK;
/*
Here's the executive summary on what to do:
/* Here's the executive summary on what to do:
PASV is RFC959, expect:
227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)
PASV is RFC959, expect:
227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)
LPSV is RFC1639, expect:
228 Entering Long Passive Mode (4,4,a1,a2,a3,a4,2,p1,p2)
LPSV is RFC1639, expect:
228 Entering Long Passive Mode (4,4,a1,a2,a3,a4,2,p1,p2)
EPSV is RFC2428, expect:
229 Entering Extended Passive Mode (|||port|)
*/
EPSV is RFC2428, expect:
229 Entering Extended Passive Mode (|||port|)
*/
static const char mode[][5] = { "EPSV", "PASV" };
int modeoff;
@ -1550,14 +1545,12 @@ static CURLcode ftp_state_list(struct Curl_easy *data,
way. It has turned out that the NLST list output is not the same on all
servers either... */
/*
if FTPFILE_NOCWD was specified, we should add the path
/* if FTPFILE_NOCWD was specified, we should add the path
as argument for the LIST / NLST / or custom command.
Whether the server will support this, is uncertain.
The other ftp_filemethods will CWD into dir/dir/ first and
then do LIST (in that case: nothing to do here)
*/
then do LIST (in that case: nothing to do here) */
const char *lstArg = NULL;
int lstArglen = 0;
char *cmd;
@ -1948,8 +1941,7 @@ static CURLcode ftp_state_quote(struct Curl_easy *data,
In addition: asking for the size for 'TYPE A' transfers is not
constructive since servers do not report the converted size.
Thus, skip it.
*/
Thus, skip it. */
result = Curl_pp_sendf(data, &ftpc->pp, "RETR %s", ftpc->file);
if(!result)
ftp_state(data, ftpc, FTP_RETR);
@ -3045,7 +3037,7 @@ static CURLcode ftp_pwd_resp(struct Curl_easy *data,
The directory name can contain any character; embedded
double-quotes should be escaped by double-quotes (the
"quote-doubling" convention).
*/
*/
/* scan for the first double-quote for non-standard responses */
while(*ptr != '\n' && *ptr != '\0' && *ptr != '"')
@ -3321,7 +3313,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
/* Reply format is like
215<space><OS-name><space><commentary>
*/
*/
while(*ptr == ' ')
ptr++;
for(start = ptr; *ptr && *ptr != ' '; ptr++)
@ -4340,8 +4332,7 @@ static CURLcode ftp_disconnect(struct Curl_easy *data,
disconnect wait in vain and cause more problems than we need to.
ftp_quit() will check the state of ftp->ctl_valid. If it is ok it
will try to send the QUIT command, otherwise it will return.
*/
will try to send the QUIT command, otherwise it will return. */
ftpc->shutdown = TRUE;
if(dead_connection || Curl_pp_needs_flush(data, &ftpc->pp))
ftpc->ctl_valid = FALSE;

View file

@ -33,7 +33,7 @@
1. For systems that run configure or cmake, the alternatives are provided
here.
2. For systems with config-*.h files, define them there.
*/
*/
#ifdef USE_WINSOCK
/* int recv(SOCKET, char *, int, int) */

View file

@ -147,8 +147,7 @@ static CURLcode gopher_do(struct Curl_easy *data, bool *done)
BLOCKING behavior which is a NO-NO. This function should rather be
split up in a do and a doing piece where the pieces that are not
possible to send now will be sent in the doing function repeatedly
until the entire request is sent.
*/
until the entire request is sent. */
what = SOCKET_WRITABLE(sockfd, timeout_ms);
if(what < 0) {
result = CURLE_SEND_ERROR;

View file

@ -31,8 +31,8 @@ typedef size_t (*hash_function)(void *key,
size_t slots_num);
/*
Comparator function prototype. Compares two keys.
*/
* Comparator function prototype. Compares two keys.
*/
typedef size_t (*comp_function)(void *key1,
size_t key1_len,
void *key2,

View file

@ -167,8 +167,7 @@ char *Curl_checkProxyheaders(struct Curl_easy *data,
#endif
/* If the header has a value, this function returns TRUE and the value is in
'outp' with blanks trimmed off.
*/
'outp' with blanks trimmed off. */
static bool header_has_value(const char **headerp, struct Curl_str *outp)
{
bool value = !curlx_str_cspn(headerp, outp, ";:") &&
@ -3359,7 +3358,7 @@ static CURLcode http_header_c(struct Curl_easy *data,
JavaWebServer/1.1.1 obviously sends the header this way!
The third added since some servers use that!
The fourth means the requested range was unsatisfied.
*/
*/
const char *ptr = v;
@ -4344,8 +4343,7 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
if(!fine_statusline) {
/* If user has set option HTTP200ALIASES,
compare header line against list of aliases
*/
compare header line against list of aliases */
statusline check = checkhttpprefix(data, hd, hdlen);
if(check == STATUS_DONE) {
fine_statusline = TRUE;

View file

@ -137,8 +137,7 @@ CURLcode Curl_http_follow(struct Curl_easy *data, const char *newurl,
will always be unconditionally sent and thus it may not be larger than can
always be afforded to send twice.
It must not be greater than 64K to work on VMS.
*/
It must not be greater than 64K to work on VMS. */
#ifndef MAX_INITIAL_POST_SIZE
#define MAX_INITIAL_POST_SIZE (64 * 1024)
#endif

View file

@ -223,8 +223,7 @@ static CURLcode uri_encode_path(struct Curl_str *original_path,
}
/* Normalize the query part. Make sure %2B is left percent encoded, and not
decoded to plus, then encoded to space.
*/
decoded to plus, then encoded to space. */
static CURLcode normalize_query(const char *string, size_t len,
struct dynbuf *db)
{
@ -827,8 +826,7 @@ static CURLcode parse_sigv4_params(struct Curl_easy *data,
/* provider0[:provider1[:region[:service]]]
No string can be longer than N bytes of non-whitespace
*/
No string can be longer than N bytes of non-whitespace */
if(curlx_str_until(&line, provider0, MAX_SIGV4_LEN, ':')) {
failf(data, "first aws-sigv4 provider cannot be empty");
return CURLE_BAD_FUNCTION_ARGUMENT;

View file

@ -194,8 +194,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
case CHUNK_DATA:
/* We expect 'datasize' of data. We have 'blen' right now, it can be
more or less than 'datasize'. Get the smallest piece.
*/
more or less than 'datasize'. Get the smallest piece. */
piece = blen;
if(ch->datasize < (curl_off_t)blen)
piece = curlx_sotouz(ch->datasize);

View file

@ -33,11 +33,9 @@
/* Test example headers:
WWW-Authenticate: Digest realm="testrealm", nonce="1053604598"
Proxy-Authenticate: Digest realm="testrealm", nonce="1053604598"
*/
WWW-Authenticate: Digest realm="testrealm", nonce="1053604598"
Proxy-Authenticate: Digest realm="testrealm", nonce="1053604598"
*/
CURLcode Curl_input_digest(struct Curl_easy *data,
bool proxy,
const char *header) /* rest of the *-authenticate:

View file

@ -211,8 +211,7 @@ struct Curl_llist_node *Curl_llist_head(const struct Curl_llist *list)
/* llist_tail() returns the last 'struct Curl_llist_node *', which might be
NULL
@unittest 1300
*/
@unittest 1300 */
UNITTEST struct Curl_llist_node *llist_tail(const struct Curl_llist *list);
UNITTEST struct Curl_llist_node *llist_tail(const struct Curl_llist *list)
{
@ -251,8 +250,7 @@ struct Curl_llist_node *Curl_node_next(const struct Curl_llist_node *n)
/* llist_node_prev() returns the previous element in a list from a given
Curl_llist_node
@unittest 1300
*/
@unittest 1300 */
UNITTEST struct Curl_llist_node *llist_node_prev(
const struct Curl_llist_node *n);
UNITTEST struct Curl_llist_node *llist_node_prev(

View file

@ -51,11 +51,9 @@
/* initial multi->xfers table size for a full multi */
#define CURL_XFER_TABLE_SIZE 512
/*
CURL_SOCKET_HASH_TABLE_SIZE should be a prime number. Increasing it from 97
to 911 takes on a 32-bit machine 4 x 804 = 3211 more bytes. Still, every
curl handle takes 6K memory, therefore this 3K are not significant.
*/
/* CURL_SOCKET_HASH_TABLE_SIZE should be a prime number. Increasing it from 97
to 911 takes on a 32-bit machine 4 x 804 = 3211 more bytes. Still, every
curl handle takes 6K memory, therefore this 3K are not significant. */
#ifndef CURL_SOCKET_HASH_TABLE_SIZE
#define CURL_SOCKET_HASH_TABLE_SIZE 911
#endif
@ -861,8 +859,7 @@ CURLMcode Curl_multi_remove_handle(struct Curl_multi *multi,
forbidden from reuse. This easy handle cannot find the connection
anymore once removed from the multi handle
Better close the connection here, at once.
*/
Better close the connection here, at once. */
struct connectdata *c;
curl_socket_t s;
s = Curl_getconnectinfo(data, &c);
@ -3898,8 +3895,7 @@ static void move_pending_to_connect(struct Curl_multi *multi,
it can potentially allow hundreds of new transfers.
We could consider an improvement where we store the queue reason and allow
more pipewait rechecks than others.
*/
more pipewait rechecks than others. */
static void process_pending_handles(struct Curl_multi *multi)
{
uint32_t mid = multi->last_pending_mid;

View file

@ -27,59 +27,57 @@
#include "curlx/strparse.h"
#include "curlx/strcopy.h"
/*
A brief summary of the date string formats this parser groks:
/* A brief summary of the date string formats this parser groks:
RFC 2616 3.3.1
RFC 2616 3.3.1
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
we support dates without week day name:
we support dates without week day name:
06 Nov 1994 08:49:37 GMT
06-Nov-94 08:49:37 GMT
Nov 6 08:49:37 1994
06 Nov 1994 08:49:37 GMT
06-Nov-94 08:49:37 GMT
Nov 6 08:49:37 1994
without the time zone:
without the time zone:
06 Nov 1994 08:49:37
06-Nov-94 08:49:37
06 Nov 1994 08:49:37
06-Nov-94 08:49:37
weird order:
weird order:
1994 Nov 6 08:49:37 (GNU date fails)
GMT 08:49:37 06-Nov-94 Sunday
94 6 Nov 08:49:37 (GNU date fails)
1994 Nov 6 08:49:37 (GNU date fails)
GMT 08:49:37 06-Nov-94 Sunday
94 6 Nov 08:49:37 (GNU date fails)
time left out:
time left out:
1994 Nov 6
06-Nov-94
Sun Nov 6 94
1994 Nov 6
06-Nov-94
Sun Nov 6 94
unusual separators:
unusual separators:
1994.Nov.6
Sun/Nov/6/94/GMT
1994.Nov.6
Sun/Nov/6/94/GMT
commonly used time zone names:
commonly used time zone names:
Sun, 06 Nov 1994 08:49:37 CET
06 Nov 1994 08:49:37 EST
Sun, 06 Nov 1994 08:49:37 CET
06 Nov 1994 08:49:37 EST
time zones specified using RFC822 style:
time zones specified using RFC822 style:
Sun, 12 Sep 2004 15:05:58 -0700
Sat, 11 Sep 2004 21:32:11 +0200
Sun, 12 Sep 2004 15:05:58 -0700
Sat, 11 Sep 2004 21:32:11 +0200
compact numerical date strings:
compact numerical date strings:
20040912 15:05:58 -0700
20040911 +0200
*/
20040912 15:05:58 -0700
20040911 +0200
*/
#if !defined(CURL_DISABLE_PARSEDATE) || !defined(CURL_DISABLE_FTP) || \
!defined(CURL_DISABLE_FILE) || defined(USE_GNUTLS)
@ -193,8 +191,7 @@ static const struct tzinfo tz[] = {
/* returns:
-1 no day
0 monday - 6 sunday
*/
*/
static int checkday(const char *check, size_t len)
{
int i;

View file

@ -33,8 +33,7 @@
#ifndef CURL_DISABLE_PROGRESS_METER
/* Provide a string that is 7 letters long (plus the zero byte).
@unittest 1636
*/
@unittest 1636 */
UNITTEST void time2str(char *r, size_t rsize, curl_off_t seconds);
UNITTEST void time2str(char *r, size_t rsize, curl_off_t seconds)
{
@ -83,8 +82,7 @@ UNITTEST void time2str(char *r, size_t rsize, curl_off_t seconds)
but never longer than 6 columns (+ one zero byte).
Add suffix k, M, G when suitable...
@unittest 1636
*/
@unittest 1636 */
UNITTEST char *max6out(curl_off_t bytes, char *max6, size_t mlen);
UNITTEST char *max6out(curl_off_t bytes, char *max6, size_t mlen)
{
@ -176,8 +174,7 @@ const struct curltime *Curl_pgrs_now(struct Curl_easy *data)
return &data->progress.now;
}
/*
New proposed interface, 9th of February 2000:
/* New proposed interface, 9th of February 2000:
pgrsStartNow() - sets start time
pgrsSetDownloadSize(x) - known expected download size
@ -186,7 +183,7 @@ const struct curltime *Curl_pgrs_now(struct Curl_easy *data)
pgrsSetUploadCounter() - amount of data currently uploaded
pgrsUpdate() - show progress
pgrsDone() - transfer complete
*/
*/
int Curl_pgrsDone(struct Curl_easy *data)
{

View file

@ -209,8 +209,7 @@ struct Curl_protocol {
#define PROTOPT_CLOSEACTION (1 << 2) /* need action before socket close */
/* some protocols will have to call the underlying functions without regard to
what exact state the socket signals. IE even if the socket says "readable",
the send function might need to be called while uploading, or vice versa.
*/
the send function might need to be called while uploading, or vice versa. */
#define PROTOPT_DIRLOCK (1 << 3)
#define PROTOPT_NONETWORK (1 << 4) /* protocol does not use the network! */
#define PROTOPT_NEEDSPWD (1 << 5) /* needs a password, and if none is set it

View file

@ -146,7 +146,7 @@ static bool match_host(const char *token, size_t tokenlen,
/* A: example.com matches 'example.com'
B: www.example.com matches 'example.com'
C: nonexample.com DOES NOT match 'example.com'
*/
*/
if(tokenlen == namelen)
/* case A, exact match */
match = curl_strnequal(token, name, namelen);

View file

@ -287,12 +287,10 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
}
}
/*
Note also that Winsock ignores the first argument, so we do not worry
/* Note also that Winsock ignores the first argument, so we do not worry
about the fact that maxfd is computed incorrectly with Winsock (since
curl_socket_t is unsigned in such cases and thus -1 is the largest
value).
*/
value). */
r = our_select(maxfd, &fds_read, &fds_write, &fds_err, timeout_ms);
if(r <= 0) {
if((r == -1) && (SOCKERRNO == SOCKEINTR))

View file

@ -80,10 +80,8 @@ int Curl_socket_check(curl_socket_t readfd0,
int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms);
/*
With Winsock the valid range is [0..INVALID_SOCKET-1] according to
https://learn.microsoft.com/windows/win32/winsock/socket-data-type-2
*/
/* With Winsock the valid range is [0..INVALID_SOCKET-1] according to
https://learn.microsoft.com/windows/win32/winsock/socket-data-type-2 */
#ifdef USE_WINSOCK
#define VALID_SOCK(s) ((s) < INVALID_SOCKET)
#define FDSET_SOCK(x) 1

View file

@ -1823,8 +1823,7 @@ static CURLcode setopt_copypostfields(const char *ptr, struct UserDefined *s)
else {
/* Allocate even when size == 0. This satisfies the need of possible
later address compare to detect the COPYPOSTFIELDS mode, and to mark
that postfields is used rather than read function or form data.
*/
that postfields is used rather than read function or form data. */
char *p = curlx_memdup0(ptr, pflen);
if(!p)
return CURLE_OUT_OF_MEMORY;

View file

@ -382,12 +382,11 @@ static CURLcode my_sha256_init(void *in)
return CURLE_OK;
}
/*
Process a block of memory though the hash
/* Process a block of memory though the hash
@param md The hash state
@param in The data to hash
@param inlen The length of the data (octets)
*/
*/
static void my_sha256_update(void *ctx,
const unsigned char *in,
unsigned int len)
@ -422,12 +421,11 @@ static void my_sha256_update(void *ctx,
}
}
/*
Terminate the hash to get the digest
/* Terminate the hash to get the digest
@param md The hash state
@param out [out] The destination of the hash (32 bytes)
@return 0 if successful
*/
*/
static void my_sha256_final(unsigned char *out, void *ctx)
{
struct sha256_state *md = ctx;

View file

@ -932,7 +932,7 @@ static CURLproxycode socks5_recv_resp1(struct socks_ctx *sx,
o IPv4 address: 0x01, BND.ADDR = 4-byte
o domain name: 0x03, BND.ADDR = [ 1-byte length, string ]
o IPv6 address: 0x04, BND.ADDR = 16-byte
*/
*/
if(resp[0] != 5) { /* version */
failf(data, "SOCKS5 reply has wrong version, version should be 5.");
return CURLPX_BAD_VERSION;
@ -1159,9 +1159,7 @@ static void socks_proxy_ctx_free(struct socks_ctx *ctx)
the next magic steps. If 'done' is not set TRUE, it is not done yet and
must be called again.
Note: this function's sub-functions call failf()
*/
Note: this function's sub-functions call failf() */
static CURLcode socks_proxy_cf_connect(struct Curl_cfilter *cf,
struct Curl_easy *data,
bool *done)

View file

@ -730,8 +730,7 @@ static bool url_match_connect_config(struct connectdata *conn,
it would take a lot of processing to make it really accurate. Instead,
this matching will assume that reuses of bound connections will most
likely also reuse the exact same binding parameters and missing out a
few edge cases should not hurt anyone much.
*/
few edge cases should not hurt anyone much. */
if((conn->localport != m->needle->localport) ||
(conn->localportrange != m->needle->localportrange) ||
(m->needle->localdev &&

View file

@ -209,7 +209,7 @@ size_t Curl_is_absolute_url(const char *url, char *buf, size_t buflen,
if(s && (ISALNUM(s) || (s == '+') || (s == '-') || (s == '.'))) {
/* RFC 3986 3.1 explains:
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
*/
*/
}
else {
break;
@ -388,8 +388,7 @@ UNITTEST CURLUcode parse_port(struct Curl_URL *u, struct dynbuf *host,
default port. Firefox, Chrome and Safari all do that.
Do not do it if the URL has no scheme, to make something that looks like
a scheme not work!
*/
a scheme not work! */
curlx_dyn_setlen(host, keep);
portptr++;
if(!*portptr)

View file

@ -1062,7 +1062,7 @@ struct UserDefined {
/* Despite the name, ftp_create_missing_dirs is for FTP(S) and SFTP
1 - create directories that do not exist
2 - the same but also allow MKD to fail once
*/
*/
uint8_t ftp_create_missing_dirs;
#endif
uint8_t use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or IMAP or

View file

@ -751,16 +751,15 @@ static CURLcode auth_create_digest_http_message(
convert_to_ascii(hashbuf, (unsigned char *)userh);
}
/*
If the algorithm is "MD5" or unspecified (which then defaults to MD5):
/* If the algorithm is "MD5" or unspecified (which then defaults to MD5):
A1 = unq(username-value) ":" unq(realm-value) ":" passwd
A1 = unq(username-value) ":" unq(realm-value) ":" passwd
If the algorithm is "MD5-sess" then:
If the algorithm is "MD5-sess" then:
A1 = H(unq(username-value) ":" unq(realm-value) ":" passwd) ":"
unq(nonce-value) ":" unq(cnonce-value)
*/
A1 = H(unq(username-value) ":" unq(realm-value) ":" passwd) ":"
unq(nonce-value) ":" unq(cnonce-value)
*/
hashthis = curl_maprintf("%s:%s:%s", userp, digest->realm ?
digest->realm : "", passwdp);
@ -790,18 +789,17 @@ static CURLcode auth_create_digest_http_message(
convert_to_ascii(hashbuf, ha1);
}
/*
If the "qop" directive's value is "auth" or is unspecified, then A2 is:
/* If the "qop" directive's value is "auth" or is unspecified, then A2 is:
A2 = Method ":" digest-uri-value
A2 = Method ":" digest-uri-value
If the "qop" value is "auth-int", then A2 is:
If the "qop" value is "auth-int", then A2 is:
A2 = Method ":" digest-uri-value ":" H(entity-body)
A2 = Method ":" digest-uri-value ":" H(entity-body)
(The "Method" value is the HTTP request method as specified in section
5.1.1 of RFC 2616)
*/
(The "Method" value is the HTTP request method as specified in section
5.1.1 of RFC 2616)
*/
uri_quoted = auth_digest_string_quoted((const char *)uripath);
if(!uri_quoted) {
@ -872,7 +870,7 @@ static CURLcode auth_create_digest_http_message(
web-safe characters. uri is already percent encoded. nc is 8 hex
characters. algorithm and qop with standard values only contain web-safe
characters.
*/
*/
userp_quoted = auth_digest_string_quoted(digest->userhash ? userh : userp);
if(!userp_quoted) {
result = CURLE_OUT_OF_MEMORY;

View file

@ -301,7 +301,7 @@ static CURLcode ntlm_decode_type2_target(struct Curl_easy *data,
2. A 'short' containing the allocated space for the buffer in bytes.
3. A 'long' containing the offset to the start of the buffer in bytes,
from the beginning of the NTLM message.
*/
*/
/*
* Curl_auth_is_ntlm_supported()

View file

@ -3403,18 +3403,16 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
#ifndef CURL_DISABLE_PROXY
if(conn->http_proxy.proxytype == CURLPROXY_HTTPS) {
/*
Setup libssh2 callbacks to make it read/write TLS from the socket.
/* Setup libssh2 callbacks to make it read/write TLS from the socket.
ssize_t
recvcb(libssh2_socket_t sock, void *buffer, size_t length,
int flags, void **abstract);
ssize_t
recvcb(libssh2_socket_t sock, void *buffer, size_t length,
int flags, void **abstract);
ssize_t
sendcb(libssh2_socket_t sock, const void *buffer, size_t length,
int flags, void **abstract);
*/
ssize_t
sendcb(libssh2_socket_t sock, const void *buffer, size_t length,
int flags, void **abstract);
*/
#if LIBSSH2_VERSION_NUM >= 0x010b01
infof(data, "SSH: using HTTPS proxy");
#if defined(__clang__) && __clang_major__ >= 16

View file

@ -36,7 +36,7 @@
"SSL/TLS Strong Encryption: An Introduction"
https://httpd.apache.org/docs/2.0/ssl/ssl_intro.html
*/
*/
#include "curl_setup.h"

View file

@ -2024,7 +2024,7 @@ static void ossl_close_all(struct Curl_easy *data)
in the certificate and must exactly match the IP in the URI.
This function is now used from ngtcp2 (QUIC) as well.
*/
*/
static CURLcode ossl_verifyhost(struct Curl_easy *data,
struct connectdata *conn,
struct ssl_peer *peer,
@ -2110,8 +2110,7 @@ static CURLcode ossl_verifyhost(struct Curl_easy *data,
type itself: for example for an IA5String the data is ASCII"
It has been however verified that in 0.9.6 and 0.9.7, IA5String
is always null-terminated.
*/
is always null-terminated. */
if((altlen == strlen(altptr)) &&
/* if this is not true, there was an embedded zero in the name
string and we cannot match it. */
@ -3149,7 +3148,7 @@ static CURLcode ossl_populate_x509_store(struct Curl_cfilter *cf,
OpenSSL do alternate chain checking by default but we do not know how to
determine that in a reliable manner.
https://web.archive.org/web/20190422050538/rt.openssl.org/Ticket/Display.html?id=3621
*/
*/
x509flags |= X509_V_FLAG_TRUSTED_FIRST;
if(!ssl_config->no_partialchain && !ssl_crlfile) {
@ -3159,8 +3158,7 @@ static CURLcode ossl_populate_x509_store(struct Curl_cfilter *cf,
instead of needing the whole chain.
Due to OpenSSL bug https://github.com/openssl/openssl/issues/5081 we
cannot do partial chains with a CRL check.
*/
cannot do partial chains with a CRL check. */
x509flags |= X509_V_FLAG_PARTIAL_CHAIN;
}
(void)X509_STORE_set_flags(store, x509flags);
@ -3803,8 +3801,7 @@ CURLcode Curl_ossl_ctx_init(struct ossl_ctx *octx,
In 0.9.6e they added a bit to SSL_OP_ALL that _disables_ that workaround
despite the fact that SSL_OP_ALL is documented to do "rather harmless"
workarounds. In order to keep the secure workaround, the
SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS bit must not be set.
*/
SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS bit must not be set. */
ctx_options = SSL_OP_ALL | SSL_OP_NO_TICKET | SSL_OP_NO_COMPRESSION;

View file

@ -122,8 +122,7 @@
/* ALPN requires version 8.1 of the Windows SDK, which was
shipped with Visual Studio 2013, aka _MSC_VER 1800:
https://learn.microsoft.com/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/hh831771
Or mingw-w64 9.0 or upper.
*/
Or mingw-w64 9.0 or upper. */
#if (defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR >= 9) || \
(defined(_MSC_VER) && (_MSC_VER >= 1800) && !defined(_USING_V110_SDK71_))
#define HAS_ALPN_SCHANNEL
@ -161,8 +160,7 @@ static CURLcode schannel_set_ssl_version_min_max(DWORD *enabled_protocols,
/* Windows Server 2022 and newer (including Windows 11) support TLS 1.3
built-in. Previous builds of Windows 10 had broken TLS 1.3
implementations that could be enabled via registry.
*/
implementations that could be enabled via registry. */
if(curlx_verify_windows_version(10, 0, 20348, PLATFORM_WINNT,
VERSION_GREATER_THAN_EQUAL)) {
ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_3;
@ -432,7 +430,7 @@ static CURLcode get_client_cert(struct Curl_cfilter *cf,
if(fInCert || blob) {
/* Reading a .p12 or .pfx file, like the example at bottom of
https://learn.microsoft.com/archive/msdn-technet-forums/3e7bc95f-b21a-4bcd-bd2c-7f996718cae5
*/
*/
CRYPT_DATA_BLOB datablob;
WCHAR *pszPassword;
size_t pwd_len = 0;
@ -990,7 +988,7 @@ static CURLcode schannel_connect_step1(struct Curl_cfilter *cf,
At the moment we do not pass inbuf unless we are using ALPN since we only
use it for that, and WINE (for which we currently disable ALPN) is giving
us problems with inbuf regardless. https://github.com/curl/curl/issues/983
*/
*/
sspi_status = Curl_pSecFn->InitializeSecurityContext(
&backend->cred->cred_handle, NULL, backend->cred->sni_hostname,
backend->req_flags, 0, 0,
@ -1419,16 +1417,15 @@ static CURLcode schannel_connect_step2(struct Curl_cfilter *cf,
if(inbuf[1].BufferType == SECBUFFER_EXTRA && inbuf[1].cbBuffer > 0) {
SCH_DEV(infof(data, "schannel: encrypted data length: %lu",
inbuf[1].cbBuffer));
/*
There are two cases where we could be getting extra data here:
1. If we are renegotiating a connection and the handshake is already
complete (from the server perspective), it can encrypted app data
(not handshake data) in an extra buffer at this point.
2. (sspi_status == SEC_I_CONTINUE_NEEDED) We are negotiating a
connection and this extra data is part of the handshake.
We should process the data immediately; waiting for the socket to
be ready may fail since the server is done sending handshake data.
*/
/* There are two cases where we could be getting extra data here:
1. If we are renegotiating a connection and the handshake is already
complete (from the server perspective), it can encrypted app data
(not handshake data) in an extra buffer at this point.
2. (sspi_status == SEC_I_CONTINUE_NEEDED) We are negotiating a
connection and this extra data is part of the handshake.
We should process the data immediately; waiting for the socket to
be ready may fail since the server is done sending handshake data.
*/
/* check if the remaining data is less than the total amount
and therefore begins after the already processed data */
if(backend->encdata.offset > inbuf[1].cbBuffer) {
@ -2030,21 +2027,19 @@ static CURLcode schannel_send(struct Curl_cfilter *cf, struct Curl_easy *data,
/* send the encrypted message including header, data and trailer */
len = outbuf[0].cbBuffer + outbuf[1].cbBuffer + outbuf[2].cbBuffer;
/*
it is important to send the full message which includes the header,
encrypted payload, and trailer. Until the client receives all the
data a coherent message has not been delivered and the client
cannot read any of it.
/* it is important to send the full message which includes the header,
encrypted payload, and trailer. Until the client receives all the
data a coherent message has not been delivered and the client
cannot read any of it.
If we wanted to buffer the unwritten encrypted bytes, we would
tell the client that all data it has requested to be sent has been
sent. The unwritten encrypted bytes would be the first bytes to
send on the next invocation.
Here's the catch with this - if we tell the client that all the
bytes have been sent, does the client call this method again to
send the buffered data? Looking at who calls this function, it
seems the answer is NO.
*/
If we wanted to buffer the unwritten encrypted bytes, we would
tell the client that all data it has requested to be sent has been
sent. The unwritten encrypted bytes would be the first bytes to
send on the next invocation.
Here's the catch with this - if we tell the client that all the
bytes have been sent, does the client call this method again to
send the buffered data? Looking at who calls this function, it
seems the answer is NO. */
/* send entire message or fail */
while(len > *pnwritten) {
@ -2162,8 +2157,7 @@ static CURLcode schannel_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
}
/* it is debatable what to return when !len. Regardless we cannot return
immediately because there may be data to decrypt (in the case we want to
decrypt all encrypted cached data) so handle !len later in cleanup.
*/
decrypt all encrypted cached data) so handle !len later in cleanup. */
else if(len && !backend->recv_connection_closed) {
/* the encrypted buffer must be large enough to hold all the bytes
requested and some TLS record overhead. 'len' is a buffer size, so this
@ -2347,8 +2341,7 @@ cleanup:
The behavior here is a matter of debate. We do not want to be vulnerable
to a truncation attack however there is some browser precedent for
ignoring the close_notify for compatibility reasons.
*/
ignoring the close_notify for compatibility reasons. */
if(len && !backend->decdata.offset && backend->recv_connection_closed &&
!backend->recv_sspi_close_notify) {
result = CURLE_RECV_ERROR;
@ -2378,8 +2371,7 @@ cleanup:
/* it is debatable what to return when !len. We could return whatever error
we got from decryption but instead we override here so the return is
consistent.
*/
consistent. */
if(!len)
return CURLE_OK;

View file

@ -147,9 +147,7 @@ struct schannel_cert_share {
struct curltime time; /* when the cached store was created */
};
/*
* size of the structure: 20 bytes.
*/
/* size of the structure: 20 bytes */
struct num_ip_data {
DWORD size; /* 04 bytes */
union {

View file

@ -36,7 +36,7 @@
"SSL/TLS Strong Encryption: An Introduction"
https://httpd.apache.org/docs/2.0/ssl/ssl_intro.html
*/
*/
#include "curl_setup.h"

View file

@ -36,7 +36,7 @@
"SSL/TLS Strong Encryption: An Introduction"
https://httpd.apache.org/docs/2.0/ssl/ssl_intro.html
*/
*/
#include "curl_setup.h"

View file

@ -43,16 +43,15 @@
#include "curlx/strparse.h"
#include "curlx/strcopy.h"
/***
RFC 6455 Section 5.2
/* RFC 6455 Section 5.2
0 1 2 3 4 5 6 7
+-+-+-+-+-------+
|F|R|R|R| opcode|
|I|S|S|S| (4) |
|N|V|V|V| |
| |1|2|3| |
*/
0 1 2 3 4 5 6 7
+-+-+-+-+-------+
|F|R|R|R| opcode|
|I|S|S|S| (4) |
|N|V|V|V| |
| |1|2|3| |
*/
#define WSBIT_FIN 0x80
#define WSBIT_RSV1 0x40
#define WSBIT_RSV2 0x20
@ -854,28 +853,27 @@ static void ws_enc_init(struct ws_encoder *enc)
ws_enc_reset(enc);
}
/***
RFC 6455 Section 5.2
/* RFC 6455 Section 5.2
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued ... :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued ... |
+---------------------------------------------------------------+
*/
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued ... :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued ... |
+---------------------------------------------------------------+
*/
static CURLcode ws_enc_add_frame(struct Curl_easy *data,
struct ws_encoder *enc,
@ -1415,14 +1413,13 @@ CURLcode Curl_ws_accept(struct Curl_easy *data,
The sent value is the base64 encoded version of a SHA-1 hash done on the
|Sec-WebSocket-Key| header field concatenated with
the string "258EAFA5-E914-47DA-95CA-C5AB0DC85B11".
*/
the string "258EAFA5-E914-47DA-95CA-C5AB0DC85B11". */
/* If the response includes a |Sec-WebSocket-Extensions| header field and
this header field indicates the use of an extension that was not present
in the client's handshake (the server has indicated an extension not
requested by the client), the client MUST Fail the WebSocket Connection.
*/
*/
/* If the response includes a |Sec-WebSocket-Protocol| header field
and this header field indicates the use of a subprotocol that was