mirror of
https://github.com/curl/curl.git
synced 2026-07-26 03:57:16 +03:00
parent
381c3d56e3
commit
3a0c600a1e
90 changed files with 463 additions and 593 deletions
|
|
@ -117,8 +117,7 @@ int main(void)
|
|||
/* HTTP-header style cookie. If you use the Set-Cookie format and do not
|
||||
specify a domain then the cookie is sent for any domain and is not
|
||||
modified, likely not what you intended. For more information refer to
|
||||
the CURLOPT_COOKIELIST documentation.
|
||||
*/
|
||||
the CURLOPT_COOKIELIST documentation. */
|
||||
snprintf(nline, sizeof(nline),
|
||||
"Set-Cookie: OLD_PREF=3d141414bf4209321; "
|
||||
"expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.example.com");
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@
|
|||
/* <DESC>
|
||||
* Get a webpage, extract the title with libxml.
|
||||
* </DESC>
|
||||
|
||||
Written by Lars Nilsson
|
||||
|
||||
GNU C++ compile command line suggestion (edit paths accordingly):
|
||||
|
||||
g++ -Wall -I/opt/curl/include -I/opt/libxml/include/libxml2 htmltitle.cpp \
|
||||
-o htmltitle -L/opt/curl/lib -L/opt/libxml/lib -lcurl -lxml2
|
||||
*/
|
||||
*
|
||||
* Written by Lars Nilsson
|
||||
*
|
||||
* GNU C++ compile command line suggestion (edit paths accordingly):
|
||||
*
|
||||
* g++ -Wall -I/opt/curl/include -I/opt/libxml/include/libxml2 htmltitle.cpp \
|
||||
* -o htmltitle -L/opt/curl/lib -L/opt/libxml/lib -lcurl -lxml2
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
|||
|
|
@ -102,13 +102,11 @@ int main(void)
|
|||
/* get verbose debug output please */
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
/*
|
||||
If you use POST to an HTTP 1.1 server, you can send data without knowing
|
||||
the size before starting the POST if you use chunked encoding. You
|
||||
enable this by adding a header like "Transfer-Encoding: chunked" with
|
||||
CURLOPT_HTTPHEADER. With HTTP 1.0 or without chunked transfer, you must
|
||||
specify the size in the request.
|
||||
*/
|
||||
/* If you use POST to an HTTP 1.1 server, you can send data without knowing
|
||||
the size before starting the POST if you use chunked encoding. You
|
||||
enable this by adding a header like "Transfer-Encoding: chunked" with
|
||||
CURLOPT_HTTPHEADER. With HTTP 1.0 or without chunked transfer, you must
|
||||
specify the size in the request. */
|
||||
#ifdef USE_CHUNKED
|
||||
{
|
||||
struct curl_slist *chunk = NULL;
|
||||
|
|
|
|||
|
|
@ -89,8 +89,7 @@ int main(void)
|
|||
supports "natively", you are doing it wrong and you should stop.
|
||||
|
||||
This example uses HTTP only to show how to use this API, it does not
|
||||
suggest that writing an application doing this is sensible.
|
||||
*/
|
||||
suggest that writing an application doing this is sensible. */
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
4. if you do not use a crypto engine:
|
||||
4.1. set pKeyName to the filename of your client key
|
||||
4.2. if the format of the key file is DER, set pKeyType to "DER"
|
||||
*/
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -73,11 +73,9 @@ static void *pull_one_url(void *p)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
int pthread_create(pthread_t *new_thread_ID,
|
||||
/* int pthread_create(pthread_t *new_thread_ID,
|
||||
const pthread_attr_t *attr,
|
||||
void * (*start_func)(void *), void *arg);
|
||||
*/
|
||||
void * (*start_func)(void *), void *arg); */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -100,17 +100,15 @@ int main(void)
|
|||
before a transfer is performed. Cookies in the list that have the same
|
||||
hostname, path and name as in my_cookie are skipped. That is because
|
||||
libcurl has already imported my_cookie and it is considered a "live"
|
||||
cookie. A live cookie is not replaced by one read from a file.
|
||||
*/
|
||||
cookie. A live cookie is not replaced by one read from a file. */
|
||||
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookies.txt"); /* import */
|
||||
|
||||
/* Cookies are exported after curl_easy_cleanup is called. The server
|
||||
may have added, deleted or modified cookies by then. The cookies that
|
||||
were skipped on import are not exported.
|
||||
*/
|
||||
were skipped on import are not exported. */
|
||||
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "cookies.txt"); /* export */
|
||||
|
||||
result = curl_easy_perform(curl); /* cookies imported from cookies.txt */
|
||||
result = curl_easy_perform(curl); /* cookies imported from cookies.txt */
|
||||
|
||||
curl_easy_cleanup(curl); /* cookies exported to cookies.txt */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,9 +82,8 @@ int main(void)
|
|||
result = curl_easy_perform(curl);
|
||||
|
||||
/* if the request did not complete correctly, show the error
|
||||
information. if no detailed error information was written to errbuf
|
||||
show the more generic information from curl_easy_strerror instead.
|
||||
*/
|
||||
information. if no detailed error information was written to errbuf
|
||||
show the more generic information from curl_easy_strerror instead. */
|
||||
if(result != CURLE_OK) {
|
||||
size_t len = strlen(errbuf);
|
||||
fprintf(stderr, "\nlibcurl: (%d) ", result);
|
||||
|
|
|
|||
|
|
@ -632,7 +632,7 @@ typedef enum {
|
|||
match */
|
||||
CURLE_SSL_INVALIDCERTSTATUS, /* 91 - invalid certificate status */
|
||||
CURLE_HTTP2_STREAM, /* 92 - stream error in HTTP/2 framing layer
|
||||
*/
|
||||
*/
|
||||
CURLE_RECURSIVE_API_CALL, /* 93 - an api function was called from
|
||||
inside a callback */
|
||||
CURLE_AUTH_ERROR, /* 94 - an authentication function returned an
|
||||
|
|
@ -1537,8 +1537,7 @@ typedef enum {
|
|||
|
||||
/* FTP Option that causes missing dirs to be created on the remote server.
|
||||
In 7.19.4 we introduced the convenience enums for this option using the
|
||||
CURLFTP_CREATE_DIR prefix.
|
||||
*/
|
||||
CURLFTP_CREATE_DIR prefix. */
|
||||
CURLOPT(CURLOPT_FTP_CREATE_MISSING_DIRS, CURLOPTTYPE_LONG, 110),
|
||||
|
||||
/* Set this to a bitmask value to enable the particular authentications
|
||||
|
|
@ -1589,7 +1588,7 @@ typedef enum {
|
|||
CURLUSESSL_TRY - try using SSL, proceed anyway otherwise
|
||||
CURLUSESSL_CONTROL - SSL for the control connection or fail
|
||||
CURLUSESSL_ALL - SSL for all communication or fail
|
||||
*/
|
||||
*/
|
||||
CURLOPT(CURLOPT_USE_SSL, CURLOPTTYPE_VALUES, 119),
|
||||
|
||||
/* The _LARGE version of the standard POSTFIELDSIZE option */
|
||||
|
|
@ -1615,7 +1614,7 @@ typedef enum {
|
|||
CURLFTPAUTH_DEFAULT - let libcurl decide
|
||||
CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
|
||||
CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
|
||||
*/
|
||||
*/
|
||||
CURLOPT(CURLOPT_FTPSSLAUTH, CURLOPTTYPE_VALUES, 129),
|
||||
|
||||
CURLOPTDEPRECATED(CURLOPT_IOCTLFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 130,
|
||||
|
|
@ -1650,8 +1649,7 @@ typedef enum {
|
|||
CURLOPT(CURLOPT_LOCALPORT, CURLOPTTYPE_LONG, 139),
|
||||
|
||||
/* Number of ports to try, including the first one set with LOCALPORT.
|
||||
Thus, setting it to 1 makes no additional attempts but the first.
|
||||
*/
|
||||
Thus, setting it to 1 makes no additional attempts but the first. */
|
||||
CURLOPT(CURLOPT_LOCALPORTRANGE, CURLOPTTYPE_LONG, 140),
|
||||
|
||||
/* no transfer, set up connection and let application use the socket by
|
||||
|
|
|
|||
|
|
@ -56,8 +56,7 @@
|
|||
|
||||
Note: This define is the full hex number and _does not_ use the
|
||||
CURL_VERSION_BITS() macro since curl's own configure script greps for it
|
||||
and needs it to contain the full number.
|
||||
*/
|
||||
and needs it to contain the full number. */
|
||||
#define LIBCURL_VERSION_NUM 0x081600
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -24,20 +24,20 @@
|
|||
*
|
||||
***************************************************************************/
|
||||
/*
|
||||
This is an "external" header file. Do not give away any internals here!
|
||||
|
||||
GOALS
|
||||
|
||||
o Enable a "pull" interface. The application that uses libcurl decides where
|
||||
and when to ask libcurl to get/send data.
|
||||
|
||||
o Enable multiple simultaneous transfers in the same thread without making it
|
||||
complicated for the application.
|
||||
|
||||
o Enable the application to select() on its own file descriptors and curl's
|
||||
file descriptors simultaneous easily.
|
||||
|
||||
*/
|
||||
* This is an "external" header file. Do not give away any internals here!
|
||||
*
|
||||
* GOALS
|
||||
*
|
||||
* o Enable a "pull" interface. The application that uses libcurl decides where
|
||||
* and when to ask libcurl to get/send data.
|
||||
*
|
||||
* o Enable multiple simultaneous transfers in the same thread without making
|
||||
* it complicated for the application.
|
||||
*
|
||||
* o Enable the application to select() on its own file descriptors and curl's
|
||||
* file descriptors simultaneous easily.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header file should not really need to include "curl.h" since curl.h
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
19
lib/cookie.c
19
lib/cookie.c
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 **/
|
||||
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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 "\\"
|
||||
|
|
|
|||
|
|
@ -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-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
47
lib/ftp.c
47
lib/ftp.c
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
14
lib/multi.c
14
lib/multi.c
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
10
lib/sha256.c
10
lib/sha256.c
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 &&
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
63
lib/ws.c
63
lib/ws.c
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -168,9 +168,7 @@ static int sys_crelnm(const char *logname, const char *value)
|
|||
|
||||
/* Start of DECC RTL Feature handling */
|
||||
|
||||
/*
|
||||
** Sets default value for a feature
|
||||
*/
|
||||
/* Sets default value for a feature */
|
||||
#ifdef __VAX
|
||||
static void set_feature_default(const char *name, const char *value)
|
||||
{
|
||||
|
|
@ -309,9 +307,9 @@ void (* const iniarray[])(void) = { set_features };
|
|||
#endif
|
||||
|
||||
/*
|
||||
** Force a reference to LIB$INITIALIZE to ensure it
|
||||
** exists in the image.
|
||||
*/
|
||||
* Force a reference to LIB$INITIALIZE to ensure it
|
||||
* exists in the image.
|
||||
*/
|
||||
int LIB$INITIALIZE(void);
|
||||
#ifdef __DECC
|
||||
#pragma extern_model strict_refdef
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ static void dump(const char *timebuf, const char *idsbuf, const char *text,
|
|||
#define TRC_IDS_FORMAT_IDS_2 "[%" CURL_FORMAT_CURL_OFF_T "-%" \
|
||||
CURL_FORMAT_CURL_OFF_T "] "
|
||||
/*
|
||||
** callback for CURLOPT_DEBUGFUNCTION
|
||||
*/
|
||||
* callback for CURLOPT_DEBUGFUNCTION
|
||||
*/
|
||||
int tool_debug_cb(CURL *handle, curl_infotype type,
|
||||
char *data, size_t size,
|
||||
void *userdata)
|
||||
|
|
|
|||
|
|
@ -26,9 +26,8 @@
|
|||
#include "tool_setup.h"
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_DEBUGFUNCTION
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_DEBUGFUNCTION
|
||||
*/
|
||||
int tool_debug_cb(CURL *handle, curl_infotype type,
|
||||
char *data, size_t size,
|
||||
void *userdata);
|
||||
|
|
|
|||
|
|
@ -411,10 +411,10 @@ static size_t content_disposition(const char *str, const char *end,
|
|||
}
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_HEADERFUNCTION
|
||||
*
|
||||
* 'size' is always 1
|
||||
*/
|
||||
* callback for CURLOPT_HEADERFUNCTION
|
||||
*
|
||||
* 'size' is always 1
|
||||
*/
|
||||
size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
|
||||
{
|
||||
struct per_transfer *per = userdata;
|
||||
|
|
|
|||
|
|
@ -52,9 +52,8 @@ struct HdrCbData {
|
|||
int tool_write_headers(struct HdrCbData *hdrcbdata, FILE *stream);
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_HEADERFUNCTION
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_HEADERFUNCTION
|
||||
*/
|
||||
size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata);
|
||||
|
||||
#endif /* HEADER_CURL_TOOL_CB_HDR_H */
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@
|
|||
my $pi = 3.1415;
|
||||
foreach my $i (1 .. 200) {
|
||||
printf "%d, ", sin($i / 200 * 2 * $pi) * 500000 + 500000;
|
||||
}
|
||||
*/
|
||||
} */
|
||||
static const int sinus[] = {
|
||||
515704, 531394, 547052, 562664, 578214, 593687, 609068, 624341, 639491,
|
||||
654504, 669364, 684057, 698568, 712883, 726989, 740870, 754513, 767906,
|
||||
|
|
@ -104,9 +103,8 @@ static void fly(struct ProgressData *bar, bool moved)
|
|||
}
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_XFERINFOFUNCTION
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_XFERINFOFUNCTION
|
||||
*/
|
||||
static void update_width(struct ProgressData *bar)
|
||||
{
|
||||
int cols = get_terminal_columns();
|
||||
|
|
|
|||
|
|
@ -45,9 +45,8 @@ struct OperationConfig;
|
|||
void progressbarinit(struct ProgressData *bar, struct OperationConfig *config);
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_PROGRESSFUNCTION
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_PROGRESSFUNCTION
|
||||
*/
|
||||
int tool_progress_cb(void *clientp,
|
||||
curl_off_t dltotal, curl_off_t dlnow,
|
||||
curl_off_t ultotal, curl_off_t ulnow);
|
||||
|
|
|
|||
|
|
@ -68,9 +68,8 @@ static void waitfd(int waitms, int fd)
|
|||
#endif
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_READFUNCTION
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_READFUNCTION
|
||||
*/
|
||||
size_t tool_read_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
|
||||
{
|
||||
ssize_t rc = 0;
|
||||
|
|
@ -153,9 +152,8 @@ size_t tool_read_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
|
|||
}
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_XFERINFOFUNCTION used to unpause busy reads
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_XFERINFOFUNCTION used to unpause busy reads
|
||||
*/
|
||||
int tool_readbusy_cb(void *clientp,
|
||||
curl_off_t dltotal, curl_off_t dlnow,
|
||||
curl_off_t ultotal, curl_off_t ulnow)
|
||||
|
|
|
|||
|
|
@ -26,15 +26,13 @@
|
|||
#include "tool_setup.h"
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_READFUNCTION
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_READFUNCTION
|
||||
*/
|
||||
size_t tool_read_cb(char *buffer, size_t sz, size_t nmemb, void *userdata);
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_XFERINFOFUNCTION used to unpause busy reads
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_XFERINFOFUNCTION used to unpause busy reads
|
||||
*/
|
||||
int tool_readbusy_cb(void *clientp,
|
||||
curl_off_t dltotal, curl_off_t dlnow,
|
||||
curl_off_t ultotal, curl_off_t ulnow);
|
||||
|
|
|
|||
|
|
@ -28,12 +28,11 @@
|
|||
#include "tool_cb_see.h"
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_SEEKFUNCTION
|
||||
**
|
||||
** Notice that this is not supposed to return the resulting offset. This
|
||||
** shall only return CURL_SEEKFUNC_* return codes.
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_SEEKFUNCTION
|
||||
*
|
||||
* Notice that this is not supposed to return the resulting offset. This
|
||||
* shall only return CURL_SEEKFUNC_* return codes.
|
||||
*/
|
||||
int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
|
||||
{
|
||||
struct per_transfer *per = userdata;
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@
|
|||
#include "tool_setup.h"
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_SEEKFUNCTION
|
||||
*/
|
||||
* callback for CURLOPT_SEEKFUNCTION
|
||||
*/
|
||||
int tool_seek_cb(void *userdata, curl_off_t offset, int whence);
|
||||
|
||||
#endif /* HEADER_CURL_TOOL_CB_SEE_H */
|
||||
|
|
|
|||
|
|
@ -30,11 +30,10 @@
|
|||
#include "tool_cb_soc.h"
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_OPENSOCKETFUNCTION
|
||||
**
|
||||
** Notice that only Linux is supported for the moment.
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_OPENSOCKETFUNCTION
|
||||
*
|
||||
* Notice that only Linux is supported for the moment.
|
||||
*/
|
||||
curl_socket_t tool_socket_open_mptcp_cb(void *clientp,
|
||||
curlsocktype purpose,
|
||||
struct curl_sockaddr *addr)
|
||||
|
|
|
|||
|
|
@ -26,9 +26,8 @@
|
|||
#include "tool_setup.h"
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_OPENSOCKETFUNCTION
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_OPENSOCKETFUNCTION
|
||||
*/
|
||||
curl_socket_t tool_socket_open_mptcp_cb(void *clientp,
|
||||
curlsocktype purpose,
|
||||
struct curl_sockaddr *addr);
|
||||
|
|
|
|||
|
|
@ -237,9 +237,8 @@ static size_t win_console(intptr_t fhnd, struct OutStruct *outs,
|
|||
#endif /* _WIN32 */
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_WRITEFUNCTION
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_WRITEFUNCTION
|
||||
*/
|
||||
size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
|
||||
{
|
||||
size_t rc;
|
||||
|
|
|
|||
|
|
@ -26,9 +26,8 @@
|
|||
#include "tool_setup.h"
|
||||
|
||||
/*
|
||||
** callback for CURLOPT_WRITEFUNCTION
|
||||
*/
|
||||
|
||||
* callback for CURLOPT_WRITEFUNCTION
|
||||
*/
|
||||
size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata);
|
||||
|
||||
/* create a local file for writing, return TRUE on success */
|
||||
|
|
|
|||
|
|
@ -69,9 +69,8 @@ static struct tool_mime *tool_mime_new_data(struct tool_mime *parent,
|
|||
}
|
||||
|
||||
/*
|
||||
** unsigned size_t to signed curl_off_t
|
||||
*/
|
||||
|
||||
* unsigned size_t to signed curl_off_t
|
||||
*/
|
||||
#define CURL_MASK_UCOFFT ((unsigned CURL_TYPEOF_CURL_OFF_T)~0)
|
||||
#define CURL_MASK_SCOFFT (CURL_MASK_UCOFFT >> 1)
|
||||
|
||||
|
|
|
|||
|
|
@ -1719,8 +1719,7 @@ static ParameterError parse_upload_flags(struct OperationConfig *config,
|
|||
}
|
||||
|
||||
/* if 'toggle' is TRUE, set the 'bits' in 'modify'.
|
||||
if 'toggle' is FALSE, clear the 'bits' in 'modify'
|
||||
*/
|
||||
if 'toggle' is FALSE, clear the 'bits' in 'modify' */
|
||||
static void togglebit(bool toggle, unsigned long *modify, unsigned long bits)
|
||||
{
|
||||
if(toggle)
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@
|
|||
#include "tool_helpers.h"
|
||||
|
||||
/*
|
||||
** Helper functions that are used from more than one source file.
|
||||
*/
|
||||
* Helper functions that are used from more than one source file.
|
||||
*/
|
||||
|
||||
const char *param2text(ParameterError error)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ static void memory_tracking_init(void)
|
|||
#endif
|
||||
|
||||
/*
|
||||
** curl tool main function.
|
||||
*/
|
||||
* curl tool main function.
|
||||
*/
|
||||
#ifdef _UNICODE
|
||||
#ifdef CURL_HAVE_DIAG
|
||||
/* GCC does not know about wmain() */
|
||||
|
|
|
|||
|
|
@ -64,8 +64,7 @@ struct getout *new_getout(struct OperationConfig *config)
|
|||
|
||||
countcrlf TRUE - return number of bytes from the start that are ONLY CR or
|
||||
LF or NULL.
|
||||
|
||||
*/
|
||||
*/
|
||||
static size_t memcrlf(char *orig,
|
||||
bool countcrlf, /* TRUE if we count CRLF, FALSE
|
||||
if we count non-CRLF */
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
but never longer than 5 columns (+ one zero byte).
|
||||
Add suffix k, M, G when suitable...
|
||||
|
||||
Unit test @1622
|
||||
*/
|
||||
Unit test 1622
|
||||
*/
|
||||
UNITTEST char *max5data(curl_off_t bytes, char *max5, size_t mlen)
|
||||
{
|
||||
/* a signed 64-bit value is 8192 petabytes maximum */
|
||||
|
|
@ -90,7 +90,7 @@ int xferinfo_cb(void *clientp,
|
|||
|
||||
/* Provide a time string that is 8 letters long (plus the zero byte)
|
||||
|
||||
Unit test @1622
|
||||
Unit test 1622
|
||||
*/
|
||||
UNITTEST void timebuf(char *r, size_t rlen, curl_off_t seconds)
|
||||
{
|
||||
|
|
@ -152,9 +152,9 @@ static void add_offt(curl_off_t *val, curl_off_t add)
|
|||
}
|
||||
|
||||
/*
|
||||
|DL% UL% Dled Uled Xfers Live Total Current Left Speed
|
||||
| 6 -- 9.9G 0 2 2 0:00:40 0:00:02 0:00:37 4087M
|
||||
*/
|
||||
|DL% UL% Dled Uled Xfers Live Total Current Left Speed
|
||||
| 6 -- 9.9G 0 2 2 0:00:40 0:00:02 0:00:37 4087M
|
||||
*/
|
||||
bool progress_meter(CURLM *multi, struct curltime *start, bool final)
|
||||
{
|
||||
static struct curltime stamp;
|
||||
|
|
|
|||
|
|
@ -425,8 +425,7 @@ static CURLcode add_glob(struct URLGlob *glob, size_t pos)
|
|||
}
|
||||
|
||||
/* returns the named glob pattern (case sensitively) if it exists, otherwise
|
||||
NULL
|
||||
*/
|
||||
NULL */
|
||||
static struct URLPattern *glob_find_name(struct URLGlob *glob,
|
||||
struct Curl_str *name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -569,7 +569,7 @@ static const char *outtime(const char *ptr, /* %time{ ... */
|
|||
- +0000 for %z because it is otherwise not portable
|
||||
- UTC for %Z because it is otherwise not portable
|
||||
- Keep '%%' as-is so that strftime() makes a single % out of them
|
||||
*/
|
||||
*/
|
||||
for(i = 0; !result && i < vlen; i++) {
|
||||
if((i < vlen - 1) && ptr[i] == '%') {
|
||||
switch(ptr[i + 1]) {
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@
|
|||
/* provide the given string in dynbuf as a quoted json string, but without the
|
||||
outer quotes. The buffer is not inited by this function.
|
||||
|
||||
Return 0 on success, non-zero on error.
|
||||
*/
|
||||
Return 0 on success, non-zero on error. */
|
||||
int jsonquoted(const char *in, size_t len, struct dynbuf *out, bool lowercase)
|
||||
{
|
||||
const unsigned char *i = (const unsigned char *)in;
|
||||
|
|
|
|||
|
|
@ -23,16 +23,14 @@
|
|||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
/*
|
||||
Check range/resume returned error codes and data presence.
|
||||
/* Check range/resume returned error codes and data presence.
|
||||
|
||||
The input parameters are:
|
||||
- CURLOPT_RANGE/CURLOPT_RESUME_FROM
|
||||
- CURLOPT_FAILONERROR
|
||||
- Returned http code (2xx/416)
|
||||
- Content-Range header present in reply.
|
||||
|
||||
*/
|
||||
The input parameters are:
|
||||
- CURLOPT_RANGE/CURLOPT_RESUME_FROM
|
||||
- CURLOPT_FAILONERROR
|
||||
- Returned http code (2xx/416)
|
||||
- Content-Range header present in reply.
|
||||
*/
|
||||
|
||||
#define F_RESUME (1 << 0) /* resume/range. */
|
||||
#define F_HTTP416 (1 << 1) /* Server returns http code 416. */
|
||||
|
|
|
|||
|
|
@ -300,12 +300,11 @@ static const struct testcase get_parts_list[] = {
|
|||
"| [16] | [17]",
|
||||
0, CURLU_URLDECODE, CURLUE_OK },
|
||||
#ifdef USE_IDN
|
||||
/*
|
||||
https://sv.wikipedia.org/wiki/R%c3%a4ksm%c3%b6rg%c3%a5s
|
||||
https://codepoints.net/U+00E4 Latin Small Letter A with Diaeresis
|
||||
https://codepoints.net/U+00F6 Latin Small Letter O with Diaeresis
|
||||
https://codepoints.net/U+00E5 Latin Small Letter A with Ring Above
|
||||
*/
|
||||
/* https://sv.wikipedia.org/wiki/R%c3%a4ksm%c3%b6rg%c3%a5s
|
||||
https://codepoints.net/U+00E4 Latin Small Letter A with Diaeresis
|
||||
https://codepoints.net/U+00F6 Latin Small Letter O with Diaeresis
|
||||
https://codepoints.net/U+00E5 Latin Small Letter A with Ring Above
|
||||
*/
|
||||
{ "https://r\xc3\xa4ksm\xc3\xb6rg\xc3\xa5s.se",
|
||||
"https | [11] | [12] | [13] | xn--rksmrgs-5wao1o.se | "
|
||||
"[15] | / | [16] | [17]", 0, CURLU_PUNYCODE, CURLUE_OK },
|
||||
|
|
@ -323,15 +322,14 @@ static const struct testcase get_parts_list[] = {
|
|||
"https | [11] | [12] | [13] | [30] | [15] | / | [16] | [17]",
|
||||
0, CURLU_PUNYCODE, CURLUE_OK },
|
||||
#endif
|
||||
/*
|
||||
https://codepoints.net/U+2102 Double-Struck Capital C
|
||||
https://codepoints.net/U+1d64 Latin Subscript Small Letter U
|
||||
https://codepoints.net/U+24c7 Circled Latin Capital Letter R
|
||||
https://codepoints.net/U+2112 Script Capital L
|
||||
https://codepoints.net/U+3002 Ideographic Full Stop
|
||||
https://codepoints.net/U+1d412 Mathematical Bold Capital S
|
||||
https://codepoints.net/U+1f134 Squared Latin Capital Letter E
|
||||
*/
|
||||
/* https://codepoints.net/U+2102 Double-Struck Capital C
|
||||
https://codepoints.net/U+1d64 Latin Subscript Small Letter U
|
||||
https://codepoints.net/U+24c7 Circled Latin Capital Letter R
|
||||
https://codepoints.net/U+2112 Script Capital L
|
||||
https://codepoints.net/U+3002 Ideographic Full Stop
|
||||
https://codepoints.net/U+1d412 Mathematical Bold Capital S
|
||||
https://codepoints.net/U+1f134 Squared Latin Capital Letter E
|
||||
*/
|
||||
{"https://"
|
||||
"%e2%84%82%e1%b5%a4%e2%93%87%e2%84%92%e3%80%82%f0%9d%90%92%f0%9f%84%b4",
|
||||
"https | [11] | [12] | [13] | "
|
||||
|
|
@ -1132,7 +1130,7 @@ static int checkurl(const char *org, const char *url, const char *out)
|
|||
/* 1. Set the URL
|
||||
2. Set components
|
||||
3. Extract all components (not URL)
|
||||
*/
|
||||
*/
|
||||
static const struct setgetcase setget_parts_list[] = {
|
||||
{"https://example.com/",
|
||||
"query=\"\",",
|
||||
|
|
@ -1748,7 +1746,7 @@ static int set_url(void)
|
|||
/* 1. Set a URL
|
||||
2. Set one or more parts
|
||||
3. Extract and compare all parts - not the URL
|
||||
*/
|
||||
*/
|
||||
static int setget_parts(bool has_utf8)
|
||||
{
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ static CURLcode test_lib1978(const char *URL)
|
|||
same value
|
||||
7. merging works for headers all with no values
|
||||
8. merging works for headers some with no values
|
||||
*/
|
||||
*/
|
||||
|
||||
list = curl_slist_append(list, "x-amz-meta-test: test2");
|
||||
if(!list)
|
||||
|
|
|
|||
|
|
@ -45,12 +45,10 @@ static CURLcode test_lib514(const char *URL)
|
|||
|
||||
/* Based on a bug report by Niels van Tongeren on June 29, 2004:
|
||||
|
||||
A weird situation occurs when request 1 is a POST request and the request
|
||||
2 is a HEAD request. For the POST request we set the CURLOPT_POSTFIELDS,
|
||||
CURLOPT_POSTFIELDSIZE and CURLOPT_POST options. For the HEAD request we
|
||||
set the CURLOPT_NOBODY option to '1'.
|
||||
|
||||
*/
|
||||
A weird situation occurs when request 1 is a POST request and the request
|
||||
2 is a HEAD request. For the POST request we set the CURLOPT_POSTFIELDS,
|
||||
CURLOPT_POSTFIELDSIZE and CURLOPT_POST options. For the HEAD request we
|
||||
set the CURLOPT_NOBODY option to '1'. */
|
||||
|
||||
easy_setopt(curl, CURLOPT_POSTFIELDS, "moo");
|
||||
easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 3L);
|
||||
|
|
|
|||
|
|
@ -23,19 +23,18 @@
|
|||
***************************************************************************/
|
||||
#include "first.h"
|
||||
|
||||
/*
|
||||
Based on a bug report recipe by Rene Bernhardt in
|
||||
https://curl.se/mail/lib-2011-10/0323.html
|
||||
/* Based on a bug report recipe by Rene Bernhardt in
|
||||
https://curl.se/mail/lib-2011-10/0323.html
|
||||
|
||||
It is reproducible by the following steps:
|
||||
It is reproducible by the following steps:
|
||||
|
||||
- Use a proxy that offers NTLM and Negotiate
|
||||
(CURLOPT_PROXY and CURLOPT_PROXYPORT)
|
||||
- Tell libcurl NOT to use Negotiate
|
||||
curl_easy_setopt(CURLOPT_PROXYAUTH,
|
||||
CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM)
|
||||
- Start the request
|
||||
*/
|
||||
- Use a proxy that offers NTLM and Negotiate
|
||||
(CURLOPT_PROXY and CURLOPT_PROXYPORT)
|
||||
- Tell libcurl NOT to use Negotiate
|
||||
curl_easy_setopt(CURLOPT_PROXYAUTH,
|
||||
CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM)
|
||||
- Start the request
|
||||
*/
|
||||
|
||||
static CURLcode test_lib590(const char *URL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -424,22 +424,22 @@ create_resp(int qid, const struct sockaddr *addr, curl_socklen_t addrlen,
|
|||
uint8_t header[12] = {
|
||||
0x80, 0xea, /* ID, overwrite */
|
||||
0x81, 0x80,
|
||||
/*
|
||||
Flags: 0x8180 Standard query response, No error
|
||||
1... .... .... .... = Response: Message is a response
|
||||
.000 0... .... .... = Opcode: Standard query (0)
|
||||
.... .0.. .... .... = Authoritative: Server is not an authority for
|
||||
domain
|
||||
.... ..0. .... .... = Truncated: Message is not truncated
|
||||
.... ...1 .... .... = Recursion desired: Do query recursively
|
||||
.... .... 1... .... = Recursion available: Server can do recursive
|
||||
queries
|
||||
.... .... .0.. .... = Z: reserved (0)
|
||||
.... .... ..0. .... = Answer authenticated: Answer/authority portion
|
||||
was not authenticated by the server
|
||||
.... .... ...0 .... = Non-authenticated data: Unacceptable
|
||||
.... .... .... 0000 = Reply code: No error (0)
|
||||
*/
|
||||
/* Flags: 0x8180 Standard query response, No error
|
||||
|
||||
1... .... .... .... = Response: Message is a response
|
||||
.000 0... .... .... = Opcode: Standard query (0)
|
||||
.... .0.. .... .... = Authoritative: Server is not an authority for
|
||||
domain
|
||||
.... ..0. .... .... = Truncated: Message is not truncated
|
||||
.... ...1 .... .... = Recursion desired: Do query recursively
|
||||
.... .... 1... .... = Recursion available: Server can do recursive
|
||||
queries
|
||||
.... .... .0.. .... = Z: reserved (0)
|
||||
.... .... ..0. .... = Answer authenticated: Answer/authority portion
|
||||
was not authenticated by the server
|
||||
.... .... ...0 .... = Non-authenticated data: Unacceptable
|
||||
.... .... .... 0000 = Reply code: No error (0)
|
||||
*/
|
||||
0x0, 0x1, /* QDCOUNT a single question */
|
||||
0x0, 0x0, /* ANCOUNT number of answers */
|
||||
0x0, 0x0, /* NSCOUNT */
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ static int disconnect(FILE *dump, curl_socket_t fd)
|
|||
}
|
||||
|
||||
/*
|
||||
do
|
||||
do
|
||||
encodedByte = X MOD 128
|
||||
|
||||
X = X DIV 128
|
||||
|
|
@ -294,16 +294,13 @@ static int disconnect(FILE *dump, curl_socket_t fd)
|
|||
// if there are more data to encode, set the top bit of this byte
|
||||
|
||||
if ( X > 0 )
|
||||
|
||||
encodedByte = encodedByte OR 128
|
||||
endif
|
||||
|
||||
endif
|
||||
'output' encodedByte
|
||||
|
||||
'output' encodedByte
|
||||
|
||||
while ( X > 0 )
|
||||
|
||||
*/
|
||||
while ( X > 0 )
|
||||
*/
|
||||
|
||||
/* return number of bytes used */
|
||||
static size_t encode_length(size_t packetlen,
|
||||
|
|
@ -684,12 +681,10 @@ end:
|
|||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
/*
|
||||
sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
/* sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept()
|
||||
*/
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept() */
|
||||
static bool mqttd_incoming(curl_socket_t listenfd)
|
||||
{
|
||||
fd_set fds_read;
|
||||
|
|
|
|||
|
|
@ -911,12 +911,10 @@ static bool disc_handshake(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
/* sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept()
|
||||
*/
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept() */
|
||||
static bool juggle(curl_socket_t *sockfdp,
|
||||
curl_socket_t listenfd,
|
||||
enum sockmode *mode)
|
||||
|
|
@ -1041,7 +1039,7 @@ static bool juggle(curl_socket_t *sockfdp,
|
|||
Commands:
|
||||
|
||||
DATA - plain pass-through data
|
||||
*/
|
||||
*/
|
||||
|
||||
if(!read_stdin(buffer, 5))
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ static void socksd_getconfig(void)
|
|||
o 0x00 NO AUTHENTICATION REQUIRED
|
||||
o 0x01 GSSAPI
|
||||
o 0x02 USERNAME/PASSWORD
|
||||
*/
|
||||
*/
|
||||
else if(!strcmp(key, "method")) {
|
||||
pval = value;
|
||||
if(!curlx_str_number(&pval, &num, 0xff)) {
|
||||
|
|
@ -366,7 +366,7 @@ static curl_socket_t sockit(curl_socket_t fd)
|
|||
+----+------+----------+------+----------+
|
||||
| 1 | 1 | 1 to 255 | 1 | 1 to 255 |
|
||||
+----+------+----------+------+----------+
|
||||
*/
|
||||
*/
|
||||
unsigned char ulen;
|
||||
unsigned char plen;
|
||||
bool login = TRUE;
|
||||
|
|
@ -438,10 +438,10 @@ static curl_socket_t sockit(curl_socket_t fd)
|
|||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
/* ATYP:
|
||||
o IPv4 address: 0x01
|
||||
o domain name: 0x03
|
||||
o IPv6 address: 0x04
|
||||
*/
|
||||
o IPv4 address: 0x01
|
||||
o domain name: 0x03
|
||||
o IPv6 address: 0x04
|
||||
*/
|
||||
type = buffer[SOCKS5_ATYP];
|
||||
address = &buffer[SOCKS5_DSTADDR];
|
||||
switch(type) {
|
||||
|
|
@ -518,19 +518,18 @@ static curl_socket_t sockit(curl_socket_t fd)
|
|||
|
||||
response[SOCKS5_VERSION] = s_config.responseversion;
|
||||
|
||||
/*
|
||||
o REP Reply field:
|
||||
o 0x00 succeeded
|
||||
o 0x01 general SOCKS server failure
|
||||
o 0x02 connection not allowed by ruleset
|
||||
o 0x03 Network unreachable
|
||||
o 0x04 Host unreachable
|
||||
o 0x05 Connection refused
|
||||
o 0x06 TTL expired
|
||||
o 0x07 Command not supported
|
||||
o 0x08 Address type not supported
|
||||
o 0x09 to 0xFF unassigned
|
||||
*/
|
||||
/* o REP Reply field:
|
||||
o 0x00 succeeded
|
||||
o 0x01 general SOCKS server failure
|
||||
o 0x02 connection not allowed by ruleset
|
||||
o 0x03 Network unreachable
|
||||
o 0x04 Host unreachable
|
||||
o 0x05 Connection refused
|
||||
o 0x06 TTL expired
|
||||
o 0x07 Command not supported
|
||||
o 0x08 Address type not supported
|
||||
o 0x09 to 0xFF unassigned
|
||||
*/
|
||||
response[SOCKS5_REP] = rep;
|
||||
response[SOCKS5_RESERVED] = 0; /* must be zero */
|
||||
response[SOCKS5_ATYP] = type; /* address type */
|
||||
|
|
@ -602,12 +601,10 @@ static int tunnel(struct perclient *cp, fd_set *fds)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
/* sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept()
|
||||
*/
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept() */
|
||||
static bool socksd_incoming(curl_socket_t listenfd)
|
||||
{
|
||||
fd_set fds_read;
|
||||
|
|
|
|||
|
|
@ -35,36 +35,36 @@ static CURLcode t1609_setup(void)
|
|||
|
||||
/* CURLOPT_RESOLVE address parsing test - to test the following defect fix:
|
||||
|
||||
1. if there is already existing host:port pair in the DNS cache and
|
||||
we call CURLOPT_RESOLVE, it should also replace addresses.
|
||||
for example, if there is "test.com:80" with address "1.1.1.1"
|
||||
and we called CURLOPT_RESOLVE with address "2.2.2.2", then DNS entry
|
||||
needs to reflect that.
|
||||
1. if there is already existing host:port pair in the DNS cache and
|
||||
we call CURLOPT_RESOLVE, it should also replace addresses.
|
||||
for example, if there is "test.com:80" with address "1.1.1.1"
|
||||
and we called CURLOPT_RESOLVE with address "2.2.2.2", then DNS entry
|
||||
needs to reflect that.
|
||||
|
||||
2. when cached address is already there and close to expire, then by the
|
||||
time request is made, it can get expired. This happens because, when
|
||||
we set address using CURLOPT_RESOLVE,
|
||||
it usually marks as permanent (by setting timestamp to zero). However,
|
||||
if address already exists in the cache, then it does not mark it, but
|
||||
leaves it as it is.
|
||||
We are fixing this by setting timestamp to zero if address already
|
||||
exists too.
|
||||
2. when cached address is already there and close to expire, then by the
|
||||
time request is made, it can get expired. This happens because, when
|
||||
we set address using CURLOPT_RESOLVE,
|
||||
it usually marks as permanent (by setting timestamp to zero). However,
|
||||
if address already exists in the cache, then it does not mark it, but
|
||||
leaves it as it is.
|
||||
We are fixing this by setting timestamp to zero if address already
|
||||
exists too.
|
||||
|
||||
Test:
|
||||
Test:
|
||||
|
||||
- insert new entry
|
||||
- verify that timestamp is not zero
|
||||
- call set options with CURLOPT_RESOLVE
|
||||
- then, call Curl_loadhostpairs
|
||||
- insert new entry
|
||||
- verify that timestamp is not zero
|
||||
- call set options with CURLOPT_RESOLVE
|
||||
- then, call Curl_loadhostpairs
|
||||
|
||||
expected result: cached address has zero timestamp.
|
||||
expected result: cached address has zero timestamp.
|
||||
|
||||
- call set options with CURLOPT_RESOLVE with same host:port pair,
|
||||
different address.
|
||||
- then, call Curl_loadhostpairs
|
||||
- call set options with CURLOPT_RESOLVE with same host:port pair,
|
||||
different address.
|
||||
- then, call Curl_loadhostpairs
|
||||
|
||||
expected result: cached address has zero timestamp and new address
|
||||
*/
|
||||
expected result: cached address has zero timestamp and new address
|
||||
*/
|
||||
|
||||
static CURLcode test_unit1609(const char *arg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -103,18 +103,17 @@ static CURLcode test_unit1667(const char *arg)
|
|||
{ 31, "abcde", 5, "", CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ 99, "abcde", 5, "", CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
|
||||
/*
|
||||
(many different) strings:
|
||||
/* (many different) strings:
|
||||
|
||||
CURL_ASN1_UTF8_STRING
|
||||
CURL_ASN1_NUMERIC_STRING
|
||||
CURL_ASN1_PRINTABLE_STRING
|
||||
CURL_ASN1_TELETEX_STRING
|
||||
CURL_ASN1_IA5_STRING
|
||||
CURL_ASN1_VISIBLE_STRING
|
||||
CURL_ASN1_UNIVERSAL_STRING
|
||||
CURL_ASN1_BMP_STRING
|
||||
*/
|
||||
CURL_ASN1_UTF8_STRING
|
||||
CURL_ASN1_NUMERIC_STRING
|
||||
CURL_ASN1_PRINTABLE_STRING
|
||||
CURL_ASN1_TELETEX_STRING
|
||||
CURL_ASN1_IA5_STRING
|
||||
CURL_ASN1_VISIBLE_STRING
|
||||
CURL_ASN1_UNIVERSAL_STRING
|
||||
CURL_ASN1_BMP_STRING
|
||||
*/
|
||||
{ CURL_ASN1_UTF8_STRING, "abcde", 5, "abcde", CURLE_OK },
|
||||
/* a with ring, a with umlaut, o with umlaut in UTF-8 encoding */
|
||||
{ CURL_ASN1_UTF8_STRING, "\xc3\xa5\xc3\xa4\xc3\xb6", 6,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue