mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
parent
75955c0851
commit
0afb52a0cd
@ -101,14 +101,27 @@ static void mcode_or_die(const char *where, CURLMcode code)
|
||||
if(CURLM_OK != code) {
|
||||
const char *s;
|
||||
switch(code) {
|
||||
case CURLM_BAD_HANDLE: s = "CURLM_BAD_HANDLE"; break;
|
||||
case CURLM_BAD_EASY_HANDLE: s = "CURLM_BAD_EASY_HANDLE"; break;
|
||||
case CURLM_OUT_OF_MEMORY: s = "CURLM_OUT_OF_MEMORY"; break;
|
||||
case CURLM_INTERNAL_ERROR: s = "CURLM_INTERNAL_ERROR"; break;
|
||||
case CURLM_BAD_SOCKET: s = "CURLM_BAD_SOCKET"; break;
|
||||
case CURLM_UNKNOWN_OPTION: s = "CURLM_UNKNOWN_OPTION"; break;
|
||||
case CURLM_LAST: s = "CURLM_LAST"; break;
|
||||
default: s = "CURLM_unknown";
|
||||
case CURLM_BAD_HANDLE:
|
||||
s = "CURLM_BAD_HANDLE";
|
||||
break;
|
||||
case CURLM_BAD_EASY_HANDLE:
|
||||
s = "CURLM_BAD_EASY_HANDLE";
|
||||
break;
|
||||
case CURLM_OUT_OF_MEMORY:
|
||||
s = "CURLM_OUT_OF_MEMORY";
|
||||
break;
|
||||
case CURLM_INTERNAL_ERROR:
|
||||
s = "CURLM_INTERNAL_ERROR";
|
||||
break;
|
||||
case CURLM_BAD_SOCKET:
|
||||
s = "CURLM_BAD_SOCKET";
|
||||
break;
|
||||
case CURLM_UNKNOWN_OPTION:
|
||||
s = "CURLM_UNKNOWN_OPTION";
|
||||
break;
|
||||
default:
|
||||
s = "CURLM_unknown";
|
||||
break;
|
||||
}
|
||||
MSG_OUT("ERROR: %s returns %s\n", where, s);
|
||||
exit(code);
|
||||
|
||||
@ -716,7 +716,7 @@ static CURLcode http2_send_ping(struct Curl_cfilter *cf,
|
||||
if(rc) {
|
||||
failf(data, "nghttp2_submit_ping() failed: %s(%d)",
|
||||
nghttp2_strerror(rc), rc);
|
||||
return CURLE_HTTP2;
|
||||
return CURLE_HTTP2;
|
||||
}
|
||||
|
||||
rc = nghttp2_session_send(ctx->h2);
|
||||
|
||||
18
lib/if2ip.h
18
lib/if2ip.h
@ -62,15 +62,15 @@ struct ifreq {
|
||||
char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
} ifr_ifrn;
|
||||
|
||||
union {
|
||||
struct sockaddr ifru_addr;
|
||||
struct sockaddr ifru_broadaddr;
|
||||
struct sockaddr ifru_netmask;
|
||||
struct sockaddr ifru_hwaddr;
|
||||
short ifru_flags;
|
||||
int ifru_metric;
|
||||
int ifru_mtu;
|
||||
} ifr_ifru;
|
||||
union {
|
||||
struct sockaddr ifru_addr;
|
||||
struct sockaddr ifru_broadaddr;
|
||||
struct sockaddr ifru_netmask;
|
||||
struct sockaddr ifru_hwaddr;
|
||||
short ifru_flags;
|
||||
int ifru_metric;
|
||||
int ifru_mtu;
|
||||
} ifr_ifru;
|
||||
};
|
||||
|
||||
/* This define exists to avoid an extra #ifdef INTERIX in the C code. */
|
||||
|
||||
@ -30,40 +30,42 @@
|
||||
|
||||
/* Mapping table to go from lowercase to uppercase for plain ASCII.*/
|
||||
static const unsigned char touppermap[256] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
||||
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
|
||||
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 65,
|
||||
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
|
||||
85, 86, 87, 88, 89, 90, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
|
||||
134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
|
||||
150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
|
||||
166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
|
||||
182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
|
||||
198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
|
||||
214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
|
||||
230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245,
|
||||
246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
||||
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
|
||||
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 65,
|
||||
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
|
||||
85, 86, 87, 88, 89, 90, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
|
||||
133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
|
||||
148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
|
||||
163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
|
||||
178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
|
||||
193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
|
||||
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
|
||||
223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
|
||||
238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
|
||||
253, 254, 255
|
||||
};
|
||||
|
||||
/* Mapping table to go from uppercase to lowercase for plain ASCII.*/
|
||||
static const unsigned char tolowermap[256] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
|
||||
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
|
||||
62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
|
||||
111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 91, 92, 93, 94, 95,
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
|
||||
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
|
||||
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
|
||||
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
|
||||
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
|
||||
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
|
||||
60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
|
||||
109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 91, 92,
|
||||
93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
|
||||
110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
|
||||
125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
|
||||
140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
|
||||
155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
|
||||
170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
|
||||
185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
|
||||
200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
|
||||
215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
|
||||
230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
|
||||
245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -346,7 +346,7 @@ gnutls_set_ssl_version_min_max(struct Curl_easy *data,
|
||||
if(ssl_version_max < CURL_SSLVERSION_MAX_TLSv1_3) {
|
||||
failf(data, "QUIC needs at least TLS version 1.3");
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
}
|
||||
*prioritylist = QUIC_PRIORITY;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@ -1350,6 +1350,7 @@ static CURLcode mbed_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
if(nread > 0)
|
||||
*pnread = (size_t)nread;
|
||||
else {
|
||||
char errorbuf[128];
|
||||
CURL_TRC_CF(data, cf, "mbedtls_ssl_read(len=%zu) -> -0x%04X",
|
||||
buffersize, -nread);
|
||||
switch(nread) {
|
||||
@ -1369,14 +1370,12 @@ static CURLcode mbed_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||
case MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY:
|
||||
result = CURLE_OK;
|
||||
break;
|
||||
default: {
|
||||
char errorbuf[128];
|
||||
default:
|
||||
mbedtls_strerror(nread, errorbuf, sizeof(errorbuf));
|
||||
failf(data, "ssl_read returned: (-0x%04X) %s", -nread, errorbuf);
|
||||
result = CURLE_RECV_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -868,9 +868,9 @@ CURLcode Curl_wssl_setup_x509_store(struct Curl_cfilter *cf,
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* We never share the CTX's store, use it. */
|
||||
WOLFSSL_X509_STORE *store = wolfSSL_CTX_get_cert_store(wssl->ssl_ctx);
|
||||
result = wssl_populate_x509_store(cf, data, store, wssl);
|
||||
/* We never share the CTX's store, use it. */
|
||||
WOLFSSL_X509_STORE *store = wolfSSL_CTX_get_cert_store(wssl->ssl_ctx);
|
||||
result = wssl_populate_x509_store(cf, data, store, wssl);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -1389,8 +1389,8 @@ CURLcode Curl_wssl_ctx_init(struct wssl_ctx *wctx,
|
||||
}
|
||||
}
|
||||
else {
|
||||
trying_ech_now = 1;
|
||||
infof(data, "ECH: ECHConfig from command line");
|
||||
trying_ech_now = 1;
|
||||
infof(data, "ECH: ECHConfig from command line");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@ -296,7 +296,7 @@ curl_easy_escape_ccsid(CURL *handle, const char *string, int length,
|
||||
/* !checksrc! disable ERRNOVAR 1 */
|
||||
errno = EINVAL;
|
||||
return (char *) NULL;
|
||||
}
|
||||
}
|
||||
|
||||
s = dynconvert(ASCII_CCSID, string, length ? length : -1, sccsid, NULL);
|
||||
|
||||
@ -327,7 +327,7 @@ curl_easy_unescape_ccsid(CURL *handle, const char *string, int length,
|
||||
/* !checksrc! disable ERRNOVAR 1 */
|
||||
errno = EINVAL;
|
||||
return (char *) NULL;
|
||||
}
|
||||
}
|
||||
|
||||
s = dynconvert(ASCII_CCSID, string, length ? length : -1, sccsid, NULL);
|
||||
|
||||
@ -728,7 +728,7 @@ Curl_formadd_convert(struct curl_forms *forms,
|
||||
if(l < 0) {
|
||||
free(cp);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
cp2 = realloc(cp, l); /* Shorten buffer to the string size. */
|
||||
|
||||
@ -810,10 +810,10 @@ curl_formadd_ccsid(struct curl_httppost **httppost,
|
||||
if(!tforms) {
|
||||
result = CURL_FORMADD_MEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lforms = tforms;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get next option. */
|
||||
|
||||
@ -823,7 +823,7 @@ curl_formadd_ccsid(struct curl_httppost **httppost,
|
||||
option = forms->option;
|
||||
value = forms->value;
|
||||
forms++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Get option from arguments. */
|
||||
|
||||
@ -845,7 +845,7 @@ curl_formadd_ccsid(struct curl_httppost **httppost,
|
||||
if(!forms) {
|
||||
forms = va_arg(arg, struct curl_forms *);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
result = CURL_FORMADD_ILLEGAL_ARRAY;
|
||||
break;
|
||||
@ -862,11 +862,11 @@ curl_formadd_ccsid(struct curl_httppost **httppost,
|
||||
if(!forms) {
|
||||
value = va_arg(arg, char *);
|
||||
nameccsid = (unsigned int) va_arg(arg, long);
|
||||
}
|
||||
}
|
||||
else {
|
||||
nameccsid = (unsigned int) forms->value;
|
||||
forms++;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -879,11 +879,11 @@ curl_formadd_ccsid(struct curl_httppost **httppost,
|
||||
if(!forms) {
|
||||
value = va_arg(arg, char *);
|
||||
contentccsid = (unsigned int) va_arg(arg, long);
|
||||
}
|
||||
}
|
||||
else {
|
||||
contentccsid = (unsigned int) forms->value;
|
||||
forms++;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -942,7 +942,7 @@ curl_formadd_ccsid(struct curl_httppost **httppost,
|
||||
if(Curl_formadd_convert(lforms, contentx, lengthx, contentccsid) < 0) {
|
||||
result = CURL_FORMADD_MEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
contentx = -1;
|
||||
lengthx = -1;
|
||||
@ -954,16 +954,16 @@ curl_formadd_ccsid(struct curl_httppost **httppost,
|
||||
if(!Curl_is_formadd_string(option)) {
|
||||
result = CURL_FORMADD_UNKNOWN_OPTION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!forms) {
|
||||
value = va_arg(arg, char *);
|
||||
ccsid = (unsigned int) va_arg(arg, long);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ccsid = (unsigned int) forms->value;
|
||||
forms++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Do the conversion. */
|
||||
|
||||
@ -972,17 +972,17 @@ curl_formadd_ccsid(struct curl_httppost **httppost,
|
||||
if(Curl_formadd_convert(lforms, nargs, -1, ccsid) < 0) {
|
||||
result = CURL_FORMADD_MEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
value = lforms[nargs].value;
|
||||
}
|
||||
}
|
||||
|
||||
if(result != CURL_FORMADD_OK)
|
||||
break;
|
||||
|
||||
lforms[nargs].value = value;
|
||||
lforms[nargs++].option = option;
|
||||
}
|
||||
}
|
||||
|
||||
va_end(arg);
|
||||
|
||||
@ -1047,7 +1047,7 @@ Curl_formget_callback_ccsid(void *arg, const char *buf, size_t len)
|
||||
if(l < 0) {
|
||||
free(b);
|
||||
return (size_t) -1;
|
||||
}
|
||||
}
|
||||
|
||||
ret = (*p->append)(p->arg, b, l);
|
||||
free(b);
|
||||
|
||||
@ -85,7 +85,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Reset the shift state. */
|
||||
iconv(cd, NULL, &inbytesleft, &outbuf, &outbytesleft);
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate memory for the ASCII arguments and vector. */
|
||||
argv = (char **) malloc((argc + 1) * sizeof(*argv) + bytecount);
|
||||
|
||||
@ -116,7 +116,7 @@ static struct tool_mime *tool_mime_new_filedata(struct tool_mime *parent,
|
||||
m->data = filedup;
|
||||
if(!isremotefile)
|
||||
m->kind = TOOLMIME_FILEDATA;
|
||||
*errcode = CURLE_OK;
|
||||
*errcode = CURLE_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1654,15 +1654,15 @@ static ParameterError parse_upload_flags(struct OperationConfig *config,
|
||||
}
|
||||
}
|
||||
|
||||
if(!map->name) {
|
||||
err = PARAM_OPTION_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
if(!map->name) {
|
||||
err = PARAM_OPTION_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if(next)
|
||||
/* move over the comma */
|
||||
next++;
|
||||
flag = next;
|
||||
if(next)
|
||||
/* move over the comma */
|
||||
next++;
|
||||
flag = next;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
@ -60,15 +60,12 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
|
||||
long sts;
|
||||
short chan;
|
||||
|
||||
/* MSK, 23-JAN-2004, iosbdef.h was not in VAX V7.2 or CC 6.4 */
|
||||
/* distribution so I created this. May revert back later to */
|
||||
/* struct _iosb iosb; */
|
||||
struct _iosb
|
||||
{
|
||||
short int iosb$w_status; /* status */
|
||||
short int iosb$w_bcnt; /* byte count */
|
||||
int unused; /* unused */
|
||||
} iosb;
|
||||
/* iosbdef.h was not in VAX V7.2 or CC 6.4 */
|
||||
struct _isb {
|
||||
short int iosb$w_status; /* status */
|
||||
short int iosb$w_bcnt; /* byte count */
|
||||
int unused; /* unused */
|
||||
} iosb;
|
||||
|
||||
$DESCRIPTOR(ttdesc, "TT");
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ static const size_t slots = 3;
|
||||
static void t1603_mydtor(void *p)
|
||||
{
|
||||
/* Data are statically allocated */
|
||||
(void)p;
|
||||
(void)p;
|
||||
}
|
||||
|
||||
static size_t elem_dtor_calls;
|
||||
|
||||
@ -32,7 +32,8 @@ static CURLcode test_unit1651(const char *arg)
|
||||
#if defined(USE_GNUTLS) || defined(USE_SCHANNEL)
|
||||
|
||||
/* cert captured from gdb when connecting to curl.se on October 26
|
||||
2018 */
|
||||
2018.
|
||||
!checksrc! disable CLOSEBRACE 1 */
|
||||
static unsigned char cert[] = {
|
||||
0x30, 0x82, 0x0F, 0x5B, 0x30, 0x82, 0x0E, 0x43, 0xA0, 0x03, 0x02, 0x01, 0x02,
|
||||
0x02, 0x0C, 0x08, 0x77, 0x99, 0x2C, 0x6B, 0x67, 0xE1, 0x18, 0xD6, 0x66, 0x66,
|
||||
|
||||
@ -61,32 +61,34 @@ static CURLcode test_unit1656(const char *arg)
|
||||
UNITTEST_BEGIN_SIMPLE
|
||||
|
||||
static const struct test_spec test_specs[] = {
|
||||
{ "190321134340", "1903-21-13 43:40:00", CURLE_OK },
|
||||
{ "", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "0WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "19032113434", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "19032113434WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "190321134340.", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "190321134340.1", "1903-21-13 43:40:00.1", CURLE_OK },
|
||||
{ "19032113434017.0", "1903-21-13 43:40:17", CURLE_OK },
|
||||
{ "19032113434017.01", "1903-21-13 43:40:17.01", CURLE_OK },
|
||||
{ "19032113434003.001", "1903-21-13 43:40:03.001", CURLE_OK },
|
||||
{ "19032113434003.090", "1903-21-13 43:40:03.09", CURLE_OK },
|
||||
{ "190321134340Z", "1903-21-13 43:40:00 GMT", CURLE_OK },
|
||||
{ "19032113434017.0Z", "1903-21-13 43:40:17 GMT", CURLE_OK },
|
||||
{ "19032113434017.01Z", "1903-21-13 43:40:17.01 GMT", CURLE_OK },
|
||||
{ "19032113434003.001Z", "1903-21-13 43:40:03.001 GMT", CURLE_OK },
|
||||
{ "19032113434003.090Z", "1903-21-13 43:40:03.09 GMT", CURLE_OK },
|
||||
{ "190321134340CET", "1903-21-13 43:40:00 CET", CURLE_OK },
|
||||
{ "19032113434017.0CET", "1903-21-13 43:40:17 CET", CURLE_OK },
|
||||
{ "19032113434017.01CET", "1903-21-13 43:40:17.01 CET", CURLE_OK },
|
||||
{ "190321134340+02:30", "1903-21-13 43:40:00 UTC+02:30", CURLE_OK },
|
||||
{ "19032113434017.0+02:30", "1903-21-13 43:40:17 UTC+02:30", CURLE_OK },
|
||||
{ "19032113434017.01+02:30", "1903-21-13 43:40:17.01 UTC+02:30", CURLE_OK },
|
||||
{ "190321134340-3", "1903-21-13 43:40:00 UTC-3", CURLE_OK },
|
||||
{ "19032113434017.0-04", "1903-21-13 43:40:17 UTC-04", CURLE_OK },
|
||||
{ "19032113434017.01-01:10", "1903-21-13 43:40:17.01 UTC-01:10", CURLE_OK },
|
||||
{ "190321134340", "1903-21-13 43:40:00", CURLE_OK },
|
||||
{ "", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "0WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "19032113434", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "19032113434WTF", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "190321134340.", NULL, CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "190321134340.1", "1903-21-13 43:40:00.1", CURLE_OK },
|
||||
{ "19032113434017.0", "1903-21-13 43:40:17", CURLE_OK },
|
||||
{ "19032113434017.01", "1903-21-13 43:40:17.01", CURLE_OK },
|
||||
{ "19032113434003.001", "1903-21-13 43:40:03.001", CURLE_OK },
|
||||
{ "19032113434003.090", "1903-21-13 43:40:03.09", CURLE_OK },
|
||||
{ "190321134340Z", "1903-21-13 43:40:00 GMT", CURLE_OK },
|
||||
{ "19032113434017.0Z", "1903-21-13 43:40:17 GMT", CURLE_OK },
|
||||
{ "19032113434017.01Z", "1903-21-13 43:40:17.01 GMT", CURLE_OK },
|
||||
{ "19032113434003.001Z", "1903-21-13 43:40:03.001 GMT", CURLE_OK },
|
||||
{ "19032113434003.090Z", "1903-21-13 43:40:03.09 GMT", CURLE_OK },
|
||||
{ "190321134340CET", "1903-21-13 43:40:00 CET", CURLE_OK },
|
||||
{ "19032113434017.0CET", "1903-21-13 43:40:17 CET", CURLE_OK },
|
||||
{ "19032113434017.01CET", "1903-21-13 43:40:17.01 CET", CURLE_OK },
|
||||
{ "190321134340+02:30", "1903-21-13 43:40:00 UTC+02:30", CURLE_OK },
|
||||
{ "19032113434017.0+02:30", "1903-21-13 43:40:17 UTC+02:30", CURLE_OK },
|
||||
{ "19032113434017.01+02:30", "1903-21-13 43:40:17.01 UTC+02:30",
|
||||
CURLE_OK },
|
||||
{ "190321134340-3", "1903-21-13 43:40:00 UTC-3", CURLE_OK },
|
||||
{ "19032113434017.0-04", "1903-21-13 43:40:17 UTC-04", CURLE_OK },
|
||||
{ "19032113434017.01-01:10", "1903-21-13 43:40:17.01 UTC-01:10",
|
||||
CURLE_OK },
|
||||
};
|
||||
|
||||
size_t i;
|
||||
|
||||
@ -58,56 +58,56 @@ static CURLcode test_unit1660(const char *arg)
|
||||
};
|
||||
|
||||
static const struct testit headers[] = {
|
||||
/* two entries read from disk cache, verify first */
|
||||
{ "-", "readfrom.example", NULL, CURLE_OK},
|
||||
{ "-", "old.example", NULL, CURLE_OK},
|
||||
/* delete the remaining one read from disk */
|
||||
{ "readfrom.example", NULL, "max-age=\"0\"", CURLE_OK},
|
||||
/* two entries read from disk cache, verify first */
|
||||
{ "-", "readfrom.example", NULL, CURLE_OK},
|
||||
{ "-", "old.example", NULL, CURLE_OK},
|
||||
/* delete the remaining one read from disk */
|
||||
{ "readfrom.example", NULL, "max-age=\"0\"", CURLE_OK},
|
||||
|
||||
{ "example.com", NULL, "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"\r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"; \r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"; includeSubDomains\r\n",
|
||||
CURLE_OK },
|
||||
{ "example.org", NULL, "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
{ "this.example", NULL, "max=\"31536\";", CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "this.example", NULL, "max-age=\"31536", CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "this.example", NULL, "max-age=31536\"", CURLE_OK },
|
||||
/* max-age=0 removes the entry */
|
||||
{ "this.example", NULL, "max-age=0", CURLE_OK },
|
||||
{ "another.example", NULL, "includeSubDomains; ",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "example.com", NULL, "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"\r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"; \r\n", CURLE_OK },
|
||||
{ "example.com", NULL, "max-age=\"21536000\"; includeSubDomains\r\n",
|
||||
CURLE_OK },
|
||||
{ "example.org", NULL, "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
{ "this.example", NULL, "max=\"31536\";", CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "this.example", NULL, "max-age=\"31536", CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
{ "this.example", NULL, "max-age=31536\"", CURLE_OK },
|
||||
/* max-age=0 removes the entry */
|
||||
{ "this.example", NULL, "max-age=0", CURLE_OK },
|
||||
{ "another.example", NULL, "includeSubDomains; ",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
|
||||
/* Two max-age is illegal */
|
||||
{ "example.com", NULL,
|
||||
"max-age=\"21536000\"; includeSubDomains; max-age=\"3\";",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
/* Two includeSubDomains is illegal */
|
||||
{ "2.example.com", NULL,
|
||||
"max-age=\"21536000\"; includeSubDomains; includeSubDomains;",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
/* use an unknown directive "include" that should be ignored */
|
||||
{ "3.example.com", NULL, "max-age=\"21536000\"; include; includeSubDomains;",
|
||||
CURLE_OK },
|
||||
/* remove the "3.example.com" one, should still match the example.com */
|
||||
{ "3.example.com", NULL, "max-age=\"0\"; includeSubDomains;",
|
||||
CURLE_OK },
|
||||
{ "-", "foo.example.com", NULL, CURLE_OK},
|
||||
{ "-", "foo.xample.com", NULL, CURLE_OK},
|
||||
/* Two max-age is illegal */
|
||||
{ "example.com", NULL,
|
||||
"max-age=\"21536000\"; includeSubDomains; max-age=\"3\";",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
/* Two includeSubDomains is illegal */
|
||||
{ "2.example.com", NULL,
|
||||
"max-age=\"21536000\"; includeSubDomains; includeSubDomains;",
|
||||
CURLE_BAD_FUNCTION_ARGUMENT },
|
||||
/* use an unknown directive "include" that should be ignored */
|
||||
{ "3.example.com", NULL,
|
||||
"max-age=\"21536000\"; include; includeSubDomains;", CURLE_OK },
|
||||
/* remove the "3.example.com" one, should still match the example.com */
|
||||
{ "3.example.com", NULL, "max-age=\"0\"; includeSubDomains;",
|
||||
CURLE_OK },
|
||||
{ "-", "foo.example.com", NULL, CURLE_OK},
|
||||
{ "-", "foo.xample.com", NULL, CURLE_OK},
|
||||
|
||||
/* should not match */
|
||||
{ "example.net", "forexample.net", "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
/* should not match */
|
||||
{ "example.net", "forexample.net", "max-age=\"31536000\"\r\n", CURLE_OK },
|
||||
|
||||
/* should not match either, since forexample.net is not in the example.net
|
||||
domain */
|
||||
{ "example.net", "forexample.net",
|
||||
"max-age=\"31536000\"; includeSubDomains\r\n", CURLE_OK },
|
||||
/* remove example.net again */
|
||||
{ "example.net", NULL, "max-age=\"0\"; includeSubDomains\r\n", CURLE_OK },
|
||||
/* should not match either, since forexample.net is not in the example.net
|
||||
domain */
|
||||
{ "example.net", "forexample.net",
|
||||
"max-age=\"31536000\"; includeSubDomains\r\n", CURLE_OK },
|
||||
/* remove example.net again */
|
||||
{ "example.net", NULL, "max-age=\"0\"; includeSubDomains\r\n", CURLE_OK },
|
||||
|
||||
/* make this live for 7 seconds */
|
||||
{ "expire.example", NULL, "max-age=\"7\"\r\n", CURLE_OK },
|
||||
{ NULL, NULL, NULL, CURLE_OK }
|
||||
/* make this live for 7 seconds */
|
||||
{ "expire.example", NULL, "max-age=\"7\"\r\n", CURLE_OK },
|
||||
{ NULL, NULL, NULL, CURLE_OK }
|
||||
};
|
||||
|
||||
CURLcode result;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user