mirror of
https://github.com/curl/curl.git
synced 2026-07-26 02:07:16 +03:00
test1521: test *all* curl_easy_setopt options
mk-lib1521.pl generates a test program (lib1521.c) that calls curl_easy_setopt() for every known option with a few typical values to make sure they work (ignoring the return codes). Some small changes were necessary to avoid asserts and NULL accesses when doing this. The perl script needs to be manually rerun when we add new options. Closes #1543
This commit is contained in:
parent
b95a07ea59
commit
cccac4fb2b
7 changed files with 998 additions and 29 deletions
44
lib/http2.c
44
lib/http2.c
|
|
@ -2137,35 +2137,37 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
|
|||
void Curl_http2_add_child(struct Curl_easy *parent, struct Curl_easy *child,
|
||||
bool exclusive)
|
||||
{
|
||||
struct Curl_http2_dep **tail;
|
||||
struct Curl_http2_dep *dep = calloc(1, sizeof(struct Curl_http2_dep));
|
||||
dep->data = child;
|
||||
if(parent) {
|
||||
struct Curl_http2_dep **tail;
|
||||
struct Curl_http2_dep *dep = calloc(1, sizeof(struct Curl_http2_dep));
|
||||
dep->data = child;
|
||||
|
||||
if(parent->set.stream_dependents && exclusive) {
|
||||
struct Curl_http2_dep *node = parent->set.stream_dependents;
|
||||
while(node) {
|
||||
node->data->set.stream_depends_on = child;
|
||||
node = node->next;
|
||||
if(parent->set.stream_dependents && exclusive) {
|
||||
struct Curl_http2_dep *node = parent->set.stream_dependents;
|
||||
while(node) {
|
||||
node->data->set.stream_depends_on = child;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
tail = &child->set.stream_dependents;
|
||||
while(*tail)
|
||||
tail = &(*tail)->next;
|
||||
|
||||
DEBUGASSERT(!*tail);
|
||||
*tail = parent->set.stream_dependents;
|
||||
parent->set.stream_dependents = 0;
|
||||
}
|
||||
|
||||
tail = &child->set.stream_dependents;
|
||||
while(*tail)
|
||||
tail = &parent->set.stream_dependents;
|
||||
while(*tail) {
|
||||
(*tail)->data->set.stream_depends_e = FALSE;
|
||||
tail = &(*tail)->next;
|
||||
}
|
||||
|
||||
DEBUGASSERT(!*tail);
|
||||
*tail = parent->set.stream_dependents;
|
||||
parent->set.stream_dependents = 0;
|
||||
*tail = dep;
|
||||
}
|
||||
|
||||
tail = &parent->set.stream_dependents;
|
||||
while(*tail) {
|
||||
(*tail)->data->set.stream_depends_e = FALSE;
|
||||
tail = &(*tail)->next;
|
||||
}
|
||||
|
||||
DEBUGASSERT(!*tail);
|
||||
*tail = dep;
|
||||
|
||||
child->set.stream_depends_on = parent;
|
||||
child->set.stream_depends_e = exclusive;
|
||||
}
|
||||
|
|
|
|||
22
lib/url.c
22
lib/url.c
|
|
@ -1023,8 +1023,8 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
|
|||
* CURL_REDIR_POST_ALL - POST is kept as POST after 301, 302 and 303
|
||||
* other - POST is kept as POST after 301 and 302
|
||||
*/
|
||||
int postRedir = curlx_sltosi(va_arg(param, long));
|
||||
data->set.keep_post = postRedir & CURL_REDIR_POST_ALL;
|
||||
arg = va_arg(param, long);
|
||||
data->set.keep_post = arg & CURL_REDIR_POST_ALL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -2075,13 +2075,19 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
|
|||
/*
|
||||
* Set what local port to bind the socket to when performing an operation.
|
||||
*/
|
||||
data->set.localport = curlx_sltous(va_arg(param, long));
|
||||
arg = va_arg(param, long);
|
||||
if((arg < 0) || (arg > 65535))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
data->set.localport = curlx_sltous(arg);
|
||||
break;
|
||||
case CURLOPT_LOCALPORTRANGE:
|
||||
/*
|
||||
* Set number of local ports to try, starting with CURLOPT_LOCALPORT.
|
||||
*/
|
||||
data->set.localportrange = curlx_sltosi(va_arg(param, long));
|
||||
arg = va_arg(param, long);
|
||||
if((arg < 0) || (arg > 65535))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
data->set.localportrange = curlx_sltosi(arg);
|
||||
break;
|
||||
case CURLOPT_KRBLEVEL:
|
||||
/*
|
||||
|
|
@ -2812,13 +2818,17 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
|
|||
data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
|
||||
break;
|
||||
case CURLOPT_TLSAUTH_TYPE:
|
||||
if(strncasecompare((char *)va_arg(param, char *), "SRP", strlen("SRP")))
|
||||
argptr = va_arg(param, char *);
|
||||
if(!argptr ||
|
||||
strncasecompare(argptr, "SRP", strlen("SRP")))
|
||||
data->set.ssl.authtype = CURL_TLSAUTH_SRP;
|
||||
else
|
||||
data->set.ssl.authtype = CURL_TLSAUTH_NONE;
|
||||
break;
|
||||
case CURLOPT_PROXY_TLSAUTH_TYPE:
|
||||
if(strncasecompare((char *)va_arg(param, char *), "SRP", strlen("SRP")))
|
||||
argptr = va_arg(param, char *);
|
||||
if(!argptr ||
|
||||
strncasecompare(argptr, "SRP", strlen("SRP")))
|
||||
data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP;
|
||||
else
|
||||
data->set.proxy_ssl.authtype = CURL_TLSAUTH_NONE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue