mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
whitespace cleanup: no space first in conditionals
"if(a)" is our style, not "if( a )"
This commit is contained in:
parent
1b758b01c1
commit
889d1e973f
@ -188,7 +188,7 @@ static void destroy_async_data (struct Curl_async *async);
|
|||||||
*/
|
*/
|
||||||
void Curl_resolver_cancel(struct connectdata *conn)
|
void Curl_resolver_cancel(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
if( conn && conn->data && conn->data->state.resolver )
|
if(conn && conn->data && conn->data->state.resolver)
|
||||||
ares_cancel((ares_channel)conn->data->state.resolver);
|
ares_cancel((ares_channel)conn->data->state.resolver);
|
||||||
destroy_async_data(&conn->async);
|
destroy_async_data(&conn->async);
|
||||||
}
|
}
|
||||||
@ -203,8 +203,8 @@ static void destroy_async_data (struct Curl_async *async)
|
|||||||
|
|
||||||
if(async->os_specific) {
|
if(async->os_specific) {
|
||||||
struct ResolverResults *res = (struct ResolverResults *)async->os_specific;
|
struct ResolverResults *res = (struct ResolverResults *)async->os_specific;
|
||||||
if( res ) {
|
if(res) {
|
||||||
if( res->temp_ai ) {
|
if(res->temp_ai) {
|
||||||
Curl_freeaddrinfo(res->temp_ai);
|
Curl_freeaddrinfo(res->temp_ai);
|
||||||
res->temp_ai = NULL;
|
res->temp_ai = NULL;
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
|
|||||||
|
|
||||||
waitperform(conn, 0);
|
waitperform(conn, 0);
|
||||||
|
|
||||||
if( res && !res->num_pending ) {
|
if(res && !res->num_pending) {
|
||||||
(void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
|
(void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
|
||||||
/* temp_ai ownership is moved to the connection, so we need not free-up
|
/* temp_ai ownership is moved to the connection, so we need not free-up
|
||||||
them */
|
them */
|
||||||
@ -465,7 +465,7 @@ static void compound_results(struct ResolverResults *res,
|
|||||||
return;
|
return;
|
||||||
ai_tail = ai;
|
ai_tail = ai;
|
||||||
|
|
||||||
while (ai_tail->ai_next)
|
while(ai_tail->ai_next)
|
||||||
ai_tail = ai_tail->ai_next;
|
ai_tail = ai_tail->ai_next;
|
||||||
|
|
||||||
/* Add the new results to the list of old results. */
|
/* Add the new results to the list of old results. */
|
||||||
@ -507,7 +507,7 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* A successful result overwrites any previous error */
|
/* A successful result overwrites any previous error */
|
||||||
if( res->last_status != ARES_SUCCESS )
|
if(res->last_status != ARES_SUCCESS)
|
||||||
res->last_status = status;
|
res->last_status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,7 +573,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
|
|||||||
conn->async.status = 0; /* clear */
|
conn->async.status = 0; /* clear */
|
||||||
conn->async.dns = NULL; /* clear */
|
conn->async.dns = NULL; /* clear */
|
||||||
res = (struct ResolverResults *)calloc(sizeof(struct ResolverResults),1);
|
res = (struct ResolverResults *)calloc(sizeof(struct ResolverResults),1);
|
||||||
if( !res ) {
|
if(!res) {
|
||||||
Curl_safefree(conn->async.hostname);
|
Curl_safefree(conn->async.hostname);
|
||||||
conn->async.hostname = NULL;
|
conn->async.hostname = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -587,10 +587,10 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
|
|||||||
res->num_pending = 2;
|
res->num_pending = 2;
|
||||||
|
|
||||||
/* areschannel is already setup in the Curl_open() function */
|
/* areschannel is already setup in the Curl_open() function */
|
||||||
ares_gethostbyname((ares_channel)data->state.resolver, hostname, PF_INET,
|
ares_gethostbyname((ares_channel)data->state.resolver, hostname,
|
||||||
query_completed_cb, conn);
|
PF_INET, query_completed_cb, conn);
|
||||||
ares_gethostbyname((ares_channel)data->state.resolver, hostname, PF_INET6,
|
ares_gethostbyname((ares_channel)data->state.resolver, hostname,
|
||||||
query_completed_cb, conn);
|
PF_INET6, query_completed_cb, conn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* CURLRES_IPV6 */
|
#endif /* CURLRES_IPV6 */
|
||||||
|
@ -372,14 +372,14 @@ static CURLcode bindlocal(struct connectdata *conn,
|
|||||||
else {
|
else {
|
||||||
/* no device was given, prepare sa to match af's needs */
|
/* no device was given, prepare sa to match af's needs */
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
if( af == AF_INET6 ) {
|
if(af == AF_INET6) {
|
||||||
si6->sin6_family = AF_INET6;
|
si6->sin6_family = AF_INET6;
|
||||||
si6->sin6_port = htons(port);
|
si6->sin6_port = htons(port);
|
||||||
sizeof_sa = sizeof(struct sockaddr_in6);
|
sizeof_sa = sizeof(struct sockaddr_in6);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if( af == AF_INET ) {
|
if(af == AF_INET) {
|
||||||
si4->sin_family = AF_INET;
|
si4->sin_family = AF_INET;
|
||||||
si4->sin_port = htons(port);
|
si4->sin_port = htons(port);
|
||||||
sizeof_sa = sizeof(struct sockaddr_in);
|
sizeof_sa = sizeof(struct sockaddr_in);
|
||||||
@ -387,7 +387,7 @@ static CURLcode bindlocal(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if( bind(sockfd, sock, sizeof_sa) >= 0) {
|
if(bind(sockfd, sock, sizeof_sa) >= 0) {
|
||||||
/* we succeeded to bind */
|
/* we succeeded to bind */
|
||||||
struct Curl_sockaddr_storage add;
|
struct Curl_sockaddr_storage add;
|
||||||
curl_socklen_t size = sizeof(add);
|
curl_socklen_t size = sizeof(add);
|
||||||
|
@ -373,8 +373,8 @@ Curl_cookie_add(struct SessionHandle *data,
|
|||||||
non-session cookie */
|
non-session cookie */
|
||||||
if(co->expires == 0)
|
if(co->expires == 0)
|
||||||
co->expires = 1;
|
co->expires = 1;
|
||||||
else if( co->expires < 0 )
|
else if(co->expires < 0)
|
||||||
co->expires = 0;
|
co->expires = 0;
|
||||||
}
|
}
|
||||||
else if(!co->name) {
|
else if(!co->name) {
|
||||||
co->name = strdup(name);
|
co->name = strdup(name);
|
||||||
@ -819,8 +819,8 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
|
|||||||
/* only process this cookie if it is not expired or had no expire
|
/* only process this cookie if it is not expired or had no expire
|
||||||
date AND that if the cookie requires we're secure we must only
|
date AND that if the cookie requires we're secure we must only
|
||||||
continue if we are! */
|
continue if we are! */
|
||||||
if( (!co->expires || (co->expires > now)) &&
|
if((!co->expires || (co->expires > now)) &&
|
||||||
(co->secure?secure:TRUE) ) {
|
(co->secure?secure:TRUE)) {
|
||||||
|
|
||||||
/* now check if the domain is correct */
|
/* now check if the domain is correct */
|
||||||
if(!co->domain ||
|
if(!co->domain ||
|
||||||
|
12
lib/easy.c
12
lib/easy.c
@ -133,8 +133,8 @@ static CURLcode win32_init(void)
|
|||||||
/* wVersionRequested in wVersion. wHighVersion contains the */
|
/* wVersionRequested in wVersion. wHighVersion contains the */
|
||||||
/* highest supported version. */
|
/* highest supported version. */
|
||||||
|
|
||||||
if( LOBYTE( wsaData.wVersion ) != LOBYTE(wVersionRequested) ||
|
if(LOBYTE( wsaData.wVersion ) != LOBYTE(wVersionRequested) ||
|
||||||
HIBYTE( wsaData.wVersion ) != HIBYTE(wVersionRequested) ) {
|
HIBYTE( wsaData.wVersion ) != HIBYTE(wVersionRequested) ) {
|
||||||
/* Tell the user that we couldn't find a useable */
|
/* Tell the user that we couldn't find a useable */
|
||||||
|
|
||||||
/* winsock.dll. */
|
/* winsock.dll. */
|
||||||
@ -305,7 +305,7 @@ CURLcode curl_global_init_mem(long flags, curl_malloc_callback m,
|
|||||||
return CURLE_FAILED_INIT;
|
return CURLE_FAILED_INIT;
|
||||||
|
|
||||||
/* Already initialized, don't do it again */
|
/* Already initialized, don't do it again */
|
||||||
if( initialized )
|
if(initialized)
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
|
|
||||||
/* Call the actual init function first */
|
/* Call the actual init function first */
|
||||||
@ -506,7 +506,7 @@ CURLcode curl_easy_perform(CURL *curl)
|
|||||||
if(!data)
|
if(!data)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
|
||||||
if( ! (data->share && data->share->hostcache) ) {
|
if(! (data->share && data->share->hostcache)) {
|
||||||
/* this handle is not using a shared dns cache */
|
/* this handle is not using a shared dns cache */
|
||||||
|
|
||||||
if(data->set.global_dns_cache &&
|
if(data->set.global_dns_cache &&
|
||||||
@ -673,8 +673,8 @@ CURL *curl_easy_duphandle(CURL *incurl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Clone the resolver handle, if present, for the new handle */
|
/* Clone the resolver handle, if present, for the new handle */
|
||||||
if( Curl_resolver_duphandle(&outcurl->state.resolver,
|
if(Curl_resolver_duphandle(&outcurl->state.resolver,
|
||||||
data->state.resolver) != CURLE_OK )
|
data->state.resolver) != CURLE_OK)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
Curl_convert_setup(outcurl);
|
Curl_convert_setup(outcurl);
|
||||||
|
@ -377,7 +377,7 @@ static CURLcode file_upload(struct connectdata *conn)
|
|||||||
|
|
||||||
/*skip bytes before resume point*/
|
/*skip bytes before resume point*/
|
||||||
if(data->state.resume_from) {
|
if(data->state.resume_from) {
|
||||||
if( (curl_off_t)nread <= data->state.resume_from ) {
|
if((curl_off_t)nread <= data->state.resume_from ) {
|
||||||
data->state.resume_from -= nread;
|
data->state.resume_from -= nread;
|
||||||
nread = 0;
|
nread = 0;
|
||||||
buf2 = buf;
|
buf2 = buf;
|
||||||
@ -456,7 +456,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
|
|||||||
fd = conn->data->state.proto.file->fd;
|
fd = conn->data->state.proto.file->fd;
|
||||||
|
|
||||||
/* VMS: This only works reliable for STREAMLF files */
|
/* VMS: This only works reliable for STREAMLF files */
|
||||||
if( -1 != fstat(fd, &statbuf)) {
|
if(-1 != fstat(fd, &statbuf)) {
|
||||||
/* we could stat it, then read out the size */
|
/* we could stat it, then read out the size */
|
||||||
expected_size = statbuf.st_size;
|
expected_size = statbuf.st_size;
|
||||||
/* and store the modification time */
|
/* and store the modification time */
|
||||||
@ -562,7 +562,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
|
|||||||
bytestoread = (expected_size < BUFSIZE-1)?(size_t)expected_size:BUFSIZE-1;
|
bytestoread = (expected_size < BUFSIZE-1)?(size_t)expected_size:BUFSIZE-1;
|
||||||
nread = read(fd, buf, bytestoread);
|
nread = read(fd, buf, bytestoread);
|
||||||
|
|
||||||
if( nread > 0)
|
if(nread > 0)
|
||||||
buf[nread] = 0;
|
buf[nread] = 0;
|
||||||
|
|
||||||
if(nread <= 0 || expected_size == 0)
|
if(nread <= 0 || expected_size == 0)
|
||||||
|
@ -341,7 +341,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||||||
while(return_value == CURL_FORMADD_OK) {
|
while(return_value == CURL_FORMADD_OK) {
|
||||||
|
|
||||||
/* first see if we have more parts of the array param */
|
/* first see if we have more parts of the array param */
|
||||||
if( array_state && forms ) {
|
if(array_state && forms) {
|
||||||
/* get the upcoming option from the given array */
|
/* get the upcoming option from the given array */
|
||||||
option = forms->option;
|
option = forms->option;
|
||||||
array_value = (char *)forms->value;
|
array_value = (char *)forms->value;
|
||||||
@ -598,7 +598,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||||||
(struct curl_slist*)array_value:
|
(struct curl_slist*)array_value:
|
||||||
va_arg(params, struct curl_slist*);
|
va_arg(params, struct curl_slist*);
|
||||||
|
|
||||||
if( current_form->contentheader )
|
if(current_form->contentheader)
|
||||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||||
else
|
else
|
||||||
current_form->contentheader = list;
|
current_form->contentheader = list;
|
||||||
@ -609,7 +609,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||||||
{
|
{
|
||||||
const char *filename = array_state?array_value:
|
const char *filename = array_state?array_value:
|
||||||
va_arg(params, char *);
|
va_arg(params, char *);
|
||||||
if( current_form->showfilename )
|
if(current_form->showfilename)
|
||||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||||
else {
|
else {
|
||||||
current_form->showfilename = strdup(filename);
|
current_form->showfilename = strdup(filename);
|
||||||
@ -633,26 +633,26 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||||||
for(form = first_form;
|
for(form = first_form;
|
||||||
form != NULL;
|
form != NULL;
|
||||||
form = form->more) {
|
form = form->more) {
|
||||||
if( ((!form->name || !form->value) && !post) ||
|
if(((!form->name || !form->value) && !post) ||
|
||||||
( (form->contentslength) &&
|
( (form->contentslength) &&
|
||||||
(form->flags & HTTPPOST_FILENAME) ) ||
|
(form->flags & HTTPPOST_FILENAME) ) ||
|
||||||
( (form->flags & HTTPPOST_FILENAME) &&
|
( (form->flags & HTTPPOST_FILENAME) &&
|
||||||
(form->flags & HTTPPOST_PTRCONTENTS) ) ||
|
(form->flags & HTTPPOST_PTRCONTENTS) ) ||
|
||||||
|
|
||||||
( (!form->buffer) &&
|
( (!form->buffer) &&
|
||||||
(form->flags & HTTPPOST_BUFFER) &&
|
(form->flags & HTTPPOST_BUFFER) &&
|
||||||
(form->flags & HTTPPOST_PTRBUFFER) ) ||
|
(form->flags & HTTPPOST_PTRBUFFER) ) ||
|
||||||
|
|
||||||
( (form->flags & HTTPPOST_READFILE) &&
|
( (form->flags & HTTPPOST_READFILE) &&
|
||||||
(form->flags & HTTPPOST_PTRCONTENTS) )
|
(form->flags & HTTPPOST_PTRCONTENTS) )
|
||||||
) {
|
) {
|
||||||
return_value = CURL_FORMADD_INCOMPLETE;
|
return_value = CURL_FORMADD_INCOMPLETE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( ((form->flags & HTTPPOST_FILENAME) ||
|
if(((form->flags & HTTPPOST_FILENAME) ||
|
||||||
(form->flags & HTTPPOST_BUFFER)) &&
|
(form->flags & HTTPPOST_BUFFER)) &&
|
||||||
!form->contenttype ) {
|
!form->contenttype ) {
|
||||||
/* our contenttype is missing */
|
/* our contenttype is missing */
|
||||||
form->contenttype
|
form->contenttype
|
||||||
= strdup(ContentTypeForFilename(form->value, prevtype));
|
= strdup(ContentTypeForFilename(form->value, prevtype));
|
||||||
@ -662,8 +662,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||||||
}
|
}
|
||||||
form->contenttype_alloc = TRUE;
|
form->contenttype_alloc = TRUE;
|
||||||
}
|
}
|
||||||
if( !(form->flags & HTTPPOST_PTRNAME) &&
|
if(!(form->flags & HTTPPOST_PTRNAME) &&
|
||||||
(form == first_form) ) {
|
(form == first_form) ) {
|
||||||
/* Note that there's small risk that form->name is NULL here if the
|
/* Note that there's small risk that form->name is NULL here if the
|
||||||
app passed in a bad combo, so we better check for that first. */
|
app passed in a bad combo, so we better check for that first. */
|
||||||
if(form->name)
|
if(form->name)
|
||||||
@ -675,9 +675,9 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||||||
}
|
}
|
||||||
form->name_alloc = TRUE;
|
form->name_alloc = TRUE;
|
||||||
}
|
}
|
||||||
if( !(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE |
|
if(!(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE |
|
||||||
HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER |
|
HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER |
|
||||||
HTTPPOST_CALLBACK)) ) {
|
HTTPPOST_CALLBACK)) ) {
|
||||||
/* copy value (without strdup; possibly contains null characters) */
|
/* copy value (without strdup; possibly contains null characters) */
|
||||||
form->value = memdup(form->value, form->contentslength);
|
form->value = memdup(form->value, form->contentslength);
|
||||||
if(!form->value) {
|
if(!form->value) {
|
||||||
@ -919,10 +919,10 @@ void curl_formfree(struct curl_httppost *form)
|
|||||||
if(form->more)
|
if(form->more)
|
||||||
curl_formfree(form->more);
|
curl_formfree(form->more);
|
||||||
|
|
||||||
if( !(form->flags & HTTPPOST_PTRNAME) && form->name)
|
if(!(form->flags & HTTPPOST_PTRNAME) && form->name)
|
||||||
free(form->name); /* free the name */
|
free(form->name); /* free the name */
|
||||||
if( !(form->flags & (HTTPPOST_PTRCONTENTS|HTTPPOST_CALLBACK)) &&
|
if(!(form->flags & (HTTPPOST_PTRCONTENTS|HTTPPOST_CALLBACK)) &&
|
||||||
form->contents)
|
form->contents)
|
||||||
free(form->contents); /* free the contents */
|
free(form->contents); /* free the contents */
|
||||||
if(form->contenttype)
|
if(form->contenttype)
|
||||||
free(form->contenttype); /* free the content type */
|
free(form->contenttype); /* free the content type */
|
||||||
@ -1154,7 +1154,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
curList = file->contentheader;
|
curList = file->contentheader;
|
||||||
while( curList ) {
|
while(curList) {
|
||||||
/* Process the additional headers specified for this form */
|
/* Process the additional headers specified for this form */
|
||||||
result = AddFormDataf( &form, &size, "\r\n%s", curList->data );
|
result = AddFormDataf( &form, &size, "\r\n%s", curList->data );
|
||||||
if(result)
|
if(result)
|
||||||
@ -1350,7 +1350,7 @@ size_t Curl_FormReader(char *buffer,
|
|||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if( (form->data->length - form->sent ) > wantedsize - gotsize) {
|
if((form->data->length - form->sent ) > wantedsize - gotsize) {
|
||||||
|
|
||||||
memcpy(buffer + gotsize , form->data->line + form->sent,
|
memcpy(buffer + gotsize , form->data->line + form->sent,
|
||||||
wantedsize - gotsize);
|
wantedsize - gotsize);
|
||||||
|
14
lib/ftp.c
14
lib/ftp.c
@ -753,11 +753,11 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if( *string_ftpport == ':') {
|
if(*string_ftpport == ':') {
|
||||||
/* :port */
|
/* :port */
|
||||||
ip_end = string_ftpport;
|
ip_end = string_ftpport;
|
||||||
}
|
}
|
||||||
else if( (ip_end = strchr(string_ftpport, ':')) != NULL) {
|
else if((ip_end = strchr(string_ftpport, ':')) != NULL) {
|
||||||
/* either ipv6 or (ipv4|domain|interface):port(-range) */
|
/* either ipv6 or (ipv4|domain|interface):port(-range) */
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
if(Curl_inet_pton(AF_INET6, string_ftpport, sa6) == 1) {
|
if(Curl_inet_pton(AF_INET6, string_ftpport, sa6) == 1) {
|
||||||
@ -776,7 +776,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
|
|||||||
strcpy(addr, string_ftpport);
|
strcpy(addr, string_ftpport);
|
||||||
|
|
||||||
/* parse the port */
|
/* parse the port */
|
||||||
if( ip_end != NULL ) {
|
if(ip_end != NULL) {
|
||||||
if((port_start = strchr(ip_end, ':')) != NULL) {
|
if((port_start = strchr(ip_end, ':')) != NULL) {
|
||||||
port_min = curlx_ultous(strtoul(port_start+1, NULL, 10));
|
port_min = curlx_ultous(strtoul(port_start+1, NULL, 10));
|
||||||
if((port_sep = strchr(port_start, '-')) != NULL) {
|
if((port_sep = strchr(port_start, '-')) != NULL) {
|
||||||
@ -884,8 +884,8 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
|
|||||||
memcpy(sa, ai->ai_addr, ai->ai_addrlen);
|
memcpy(sa, ai->ai_addr, ai->ai_addrlen);
|
||||||
sslen = ai->ai_addrlen;
|
sslen = ai->ai_addrlen;
|
||||||
|
|
||||||
for( port = port_min; port <= port_max; ) {
|
for(port = port_min; port <= port_max;) {
|
||||||
if( sa->sa_family == AF_INET )
|
if(sa->sa_family == AF_INET)
|
||||||
sa4->sin_port = htons(port);
|
sa4->sin_port = htons(port);
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
else
|
else
|
||||||
@ -2112,7 +2112,7 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn,
|
|||||||
/* BLOCKING */
|
/* BLOCKING */
|
||||||
/* PORT means we are now awaiting the server to connect to us. */
|
/* PORT means we are now awaiting the server to connect to us. */
|
||||||
result = AllowServerConnect(conn);
|
result = AllowServerConnect(conn);
|
||||||
if( result )
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2226,7 +2226,7 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
|
|||||||
if(data->set.ftp_use_port) {
|
if(data->set.ftp_use_port) {
|
||||||
/* BLOCKING */
|
/* BLOCKING */
|
||||||
result = AllowServerConnect(conn);
|
result = AllowServerConnect(conn);
|
||||||
if( result )
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
lib/gtls.c
14
lib/gtls.c
@ -443,13 +443,13 @@ gtls_connect_step1(struct connectdata *conn,
|
|||||||
return CURLE_SSL_CONNECT_ERROR;
|
return CURLE_SSL_CONNECT_ERROR;
|
||||||
|
|
||||||
if(data->set.str[STRING_CERT]) {
|
if(data->set.str[STRING_CERT]) {
|
||||||
if( gnutls_certificate_set_x509_key_file(
|
if(gnutls_certificate_set_x509_key_file(
|
||||||
conn->ssl[sockindex].cred,
|
conn->ssl[sockindex].cred,
|
||||||
data->set.str[STRING_CERT],
|
data->set.str[STRING_CERT],
|
||||||
data->set.str[STRING_KEY] ?
|
data->set.str[STRING_KEY] ?
|
||||||
data->set.str[STRING_KEY] : data->set.str[STRING_CERT],
|
data->set.str[STRING_KEY] : data->set.str[STRING_CERT],
|
||||||
do_file_type(data->set.str[STRING_CERT_TYPE]) ) !=
|
do_file_type(data->set.str[STRING_CERT_TYPE]) ) !=
|
||||||
GNUTLS_E_SUCCESS) {
|
GNUTLS_E_SUCCESS) {
|
||||||
failf(data, "error reading X.509 key or certificate file");
|
failf(data, "error reading X.509 key or certificate file");
|
||||||
return CURLE_SSL_CONNECT_ERROR;
|
return CURLE_SSL_CONNECT_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ remove_entry_if_stale(struct SessionHandle *data, struct Curl_dns_entry *dns)
|
|||||||
{
|
{
|
||||||
struct hostcache_prune_data user;
|
struct hostcache_prune_data user;
|
||||||
|
|
||||||
if( !dns || (data->set.dns_cache_timeout == -1) || !data->dns.hostcache)
|
if(!dns || (data->set.dns_cache_timeout == -1) || !data->dns.hostcache)
|
||||||
/* cache forever means never prune, and NULL hostcache means
|
/* cache forever means never prune, and NULL hostcache means
|
||||||
we can't do it */
|
we can't do it */
|
||||||
return 0;
|
return 0;
|
||||||
@ -298,7 +298,7 @@ remove_entry_if_stale(struct SessionHandle *data, struct Curl_dns_entry *dns)
|
|||||||
time(&user.now);
|
time(&user.now);
|
||||||
user.cache_timeout = data->set.dns_cache_timeout;
|
user.cache_timeout = data->set.dns_cache_timeout;
|
||||||
|
|
||||||
if( !hostcache_timestamp_remove(&user,dns) )
|
if(!hostcache_timestamp_remove(&user,dns) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Curl_hash_clean_with_criterium(data->dns.hostcache,
|
Curl_hash_clean_with_criterium(data->dns.hostcache,
|
||||||
@ -428,7 +428,7 @@ int Curl_resolv(struct connectdata *conn,
|
|||||||
free(entry_id);
|
free(entry_id);
|
||||||
|
|
||||||
/* See whether the returned entry is stale. Done before we release lock */
|
/* See whether the returned entry is stale. Done before we release lock */
|
||||||
if( remove_entry_if_stale(data, dns) )
|
if(remove_entry_if_stale(data, dns))
|
||||||
dns = NULL; /* the memory deallocation is being handled by the hash */
|
dns = NULL; /* the memory deallocation is being handled by the hash */
|
||||||
|
|
||||||
if(dns) {
|
if(dns) {
|
||||||
|
@ -1657,8 +1657,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_FTP)) &&
|
if((conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_FTP)) &&
|
||||||
data->set.upload) {
|
data->set.upload) {
|
||||||
httpreq = HTTPREQ_PUT;
|
httpreq = HTTPREQ_PUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
|||||||
case IDENTITY:
|
case IDENTITY:
|
||||||
#endif
|
#endif
|
||||||
if(!k->ignorebody) {
|
if(!k->ignorebody) {
|
||||||
if( !data->set.http_te_skip )
|
if(!data->set.http_te_skip)
|
||||||
result = Curl_client_write(conn, CLIENTWRITE_BODY, datap,
|
result = Curl_client_write(conn, CLIENTWRITE_BODY, datap,
|
||||||
piece);
|
piece);
|
||||||
else
|
else
|
||||||
|
@ -290,7 +290,7 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
|
|||||||
size_t responseTokenLength = 0;
|
size_t responseTokenLength = 0;
|
||||||
|
|
||||||
responseToken = malloc(neg_ctx->output_token.length);
|
responseToken = malloc(neg_ctx->output_token.length);
|
||||||
if( responseToken == NULL)
|
if(responseToken == NULL)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
memcpy(responseToken, neg_ctx->output_token.value,
|
memcpy(responseToken, neg_ctx->output_token.value,
|
||||||
neg_ctx->output_token.length);
|
neg_ctx->output_token.length);
|
||||||
|
@ -171,7 +171,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
|
|||||||
neg_ctx->credentials = (CredHandle *)malloc(sizeof(CredHandle));
|
neg_ctx->credentials = (CredHandle *)malloc(sizeof(CredHandle));
|
||||||
neg_ctx->context = (CtxtHandle *)malloc(sizeof(CtxtHandle));
|
neg_ctx->context = (CtxtHandle *)malloc(sizeof(CtxtHandle));
|
||||||
|
|
||||||
if( !neg_ctx->credentials || !neg_ctx->context)
|
if(!neg_ctx->credentials || !neg_ctx->context)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
neg_ctx->status =
|
neg_ctx->status =
|
||||||
@ -179,7 +179,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
|
|||||||
SECPKG_CRED_OUTBOUND, NULL, NULL,
|
SECPKG_CRED_OUTBOUND, NULL, NULL,
|
||||||
NULL, NULL, neg_ctx->credentials,
|
NULL, NULL, neg_ctx->credentials,
|
||||||
&lifetime);
|
&lifetime);
|
||||||
if( neg_ctx->status != SEC_E_OK )
|
if(neg_ctx->status != SEC_E_OK)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,14 +217,14 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
|
|||||||
&context_attributes,
|
&context_attributes,
|
||||||
&lifetime);
|
&lifetime);
|
||||||
|
|
||||||
if( GSS_ERROR(neg_ctx->status) )
|
if(GSS_ERROR(neg_ctx->status))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if( neg_ctx->status == SEC_I_COMPLETE_NEEDED ||
|
if(neg_ctx->status == SEC_I_COMPLETE_NEEDED ||
|
||||||
neg_ctx->status == SEC_I_COMPLETE_AND_CONTINUE ) {
|
neg_ctx->status == SEC_I_COMPLETE_AND_CONTINUE) {
|
||||||
neg_ctx->status = s_pSecFn->CompleteAuthToken(neg_ctx->context,
|
neg_ctx->status = s_pSecFn->CompleteAuthToken(neg_ctx->context,
|
||||||
&out_buff_desc);
|
&out_buff_desc);
|
||||||
if( GSS_ERROR(neg_ctx->status) )
|
if(GSS_ERROR(neg_ctx->status))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,7 +851,7 @@ static int dprintf_formatf(
|
|||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
str = (char *) p->data.str;
|
str = (char *) p->data.str;
|
||||||
if( str == NULL) {
|
if(str == NULL) {
|
||||||
/* Write null[] if there's space. */
|
/* Write null[] if there's space. */
|
||||||
if(prec == -1 || prec >= (long) sizeof(null) - 1) {
|
if(prec == -1 || prec >= (long) sizeof(null) - 1) {
|
||||||
str = null;
|
str = null;
|
||||||
|
20
lib/multi.c
20
lib/multi.c
@ -1415,17 +1415,17 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||||||
case CURLM_STATE_TOOFAST: /* limit-rate exceeded in either direction */
|
case CURLM_STATE_TOOFAST: /* limit-rate exceeded in either direction */
|
||||||
/* if both rates are within spec, resume transfer */
|
/* if both rates are within spec, resume transfer */
|
||||||
Curl_pgrsUpdate(easy->easy_conn);
|
Curl_pgrsUpdate(easy->easy_conn);
|
||||||
if( ( (data->set.max_send_speed == 0) ||
|
if(( (data->set.max_send_speed == 0) ||
|
||||||
(data->progress.ulspeed < data->set.max_send_speed )) &&
|
(data->progress.ulspeed < data->set.max_send_speed )) &&
|
||||||
( (data->set.max_recv_speed == 0) ||
|
( (data->set.max_recv_speed == 0) ||
|
||||||
(data->progress.dlspeed < data->set.max_recv_speed) ) )
|
(data->progress.dlspeed < data->set.max_recv_speed)))
|
||||||
multistate(easy, CURLM_STATE_PERFORM);
|
multistate(easy, CURLM_STATE_PERFORM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CURLM_STATE_PERFORM:
|
case CURLM_STATE_PERFORM:
|
||||||
/* check if over send speed */
|
/* check if over send speed */
|
||||||
if( (data->set.max_send_speed > 0) &&
|
if((data->set.max_send_speed > 0) &&
|
||||||
(data->progress.ulspeed > data->set.max_send_speed) ) {
|
(data->progress.ulspeed > data->set.max_send_speed)) {
|
||||||
int buffersize;
|
int buffersize;
|
||||||
|
|
||||||
multistate(easy, CURLM_STATE_TOOFAST);
|
multistate(easy, CURLM_STATE_TOOFAST);
|
||||||
@ -1440,8 +1440,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if over recv speed */
|
/* check if over recv speed */
|
||||||
if( (data->set.max_recv_speed > 0) &&
|
if((data->set.max_recv_speed > 0) &&
|
||||||
(data->progress.dlspeed > data->set.max_recv_speed) ) {
|
(data->progress.dlspeed > data->set.max_recv_speed)) {
|
||||||
int buffersize;
|
int buffersize;
|
||||||
|
|
||||||
multistate(easy, CURLM_STATE_TOOFAST);
|
multistate(easy, CURLM_STATE_TOOFAST);
|
||||||
@ -1744,7 +1744,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
|||||||
|
|
||||||
*running_handles = multi->num_alive;
|
*running_handles = multi->num_alive;
|
||||||
|
|
||||||
if( CURLM_OK >= returncode )
|
if(CURLM_OK >= returncode)
|
||||||
update_timer(multi);
|
update_timer(multi);
|
||||||
|
|
||||||
return returncode;
|
return returncode;
|
||||||
@ -2327,7 +2327,7 @@ static int update_timer(struct Curl_multi *multi)
|
|||||||
if(multi_timeout(multi, &timeout_ms)) {
|
if(multi_timeout(multi, &timeout_ms)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if( timeout_ms < 0 ) {
|
if(timeout_ms < 0) {
|
||||||
static const struct timeval none={0,0};
|
static const struct timeval none={0,0};
|
||||||
if(Curl_splaycomparekeys(none, multi->timer_lastcall)) {
|
if(Curl_splaycomparekeys(none, multi->timer_lastcall)) {
|
||||||
multi->timer_lastcall = none;
|
multi->timer_lastcall = none;
|
||||||
|
@ -214,8 +214,8 @@ static int pop3_endofresp(struct pingpong *pp,
|
|||||||
char *line = pp->linestart_resp;
|
char *line = pp->linestart_resp;
|
||||||
size_t len = pp->nread_resp;
|
size_t len = pp->nread_resp;
|
||||||
|
|
||||||
if( ((len >= 3) && !memcmp("+OK", line, 3)) ||
|
if(((len >= 3) && !memcmp("+OK", line, 3)) ||
|
||||||
((len >= 4) && !memcmp("-ERR", line, 4)) ) {
|
((len >= 4) && !memcmp("-ERR", line, 4))) {
|
||||||
*resp=line[1]; /* O or E */
|
*resp=line[1]; /* O or E */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -49,7 +49,7 @@ CURLcode Curl_speedcheck(struct SessionHandle *data,
|
|||||||
for "low speed time" seconds we consider that enough reason
|
for "low speed time" seconds we consider that enough reason
|
||||||
to abort the download. */
|
to abort the download. */
|
||||||
|
|
||||||
if( (howlong/1000) > data->set.low_speed_time) {
|
if((howlong/1000) > data->set.low_speed_time) {
|
||||||
/* we have been this slow for long enough, now die */
|
/* we have been this slow for long enough, now die */
|
||||||
failf(data,
|
failf(data,
|
||||||
"Operation too slow. "
|
"Operation too slow. "
|
||||||
|
@ -421,7 +421,7 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state,
|
|||||||
static size_t tftp_option_add(tftp_state_data_t *state, size_t csize,
|
static size_t tftp_option_add(tftp_state_data_t *state, size_t csize,
|
||||||
char *buf, const char *option)
|
char *buf, const char *option)
|
||||||
{
|
{
|
||||||
if( ( strlen(option) + csize + 1 ) > (size_t)state->blksize )
|
if(( strlen(option) + csize + 1 ) > (size_t)state->blksize)
|
||||||
return 0;
|
return 0;
|
||||||
strcpy(buf, option);
|
strcpy(buf, option);
|
||||||
return( strlen(option) + 1 );
|
return( strlen(option) + 1 );
|
||||||
|
@ -1913,9 +1913,9 @@ CURLcode Curl_follow(struct SessionHandle *data,
|
|||||||
*
|
*
|
||||||
* This behaviour can be overridden with CURLOPT_POSTREDIR.
|
* This behaviour can be overridden with CURLOPT_POSTREDIR.
|
||||||
*/
|
*/
|
||||||
if( (data->set.httpreq == HTTPREQ_POST
|
if((data->set.httpreq == HTTPREQ_POST
|
||||||
|| data->set.httpreq == HTTPREQ_POST_FORM)
|
|| data->set.httpreq == HTTPREQ_POST_FORM)
|
||||||
&& !data->set.post301) {
|
&& !data->set.post301) {
|
||||||
infof(data,
|
infof(data,
|
||||||
"Violate RFC 2616/10.3.2 and switch from POST to GET\n");
|
"Violate RFC 2616/10.3.2 and switch from POST to GET\n");
|
||||||
data->set.httpreq = HTTPREQ_GET;
|
data->set.httpreq = HTTPREQ_GET;
|
||||||
@ -1941,9 +1941,9 @@ CURLcode Curl_follow(struct SessionHandle *data,
|
|||||||
|
|
||||||
This behaviour can be overriden with CURLOPT_POSTREDIR
|
This behaviour can be overriden with CURLOPT_POSTREDIR
|
||||||
*/
|
*/
|
||||||
if( (data->set.httpreq == HTTPREQ_POST
|
if((data->set.httpreq == HTTPREQ_POST
|
||||||
|| data->set.httpreq == HTTPREQ_POST_FORM)
|
|| data->set.httpreq == HTTPREQ_POST_FORM)
|
||||||
&& !data->set.post302) {
|
&& !data->set.post302) {
|
||||||
infof(data,
|
infof(data,
|
||||||
"Violate RFC 2616/10.3.3 and switch from POST to GET\n");
|
"Violate RFC 2616/10.3.3 and switch from POST to GET\n");
|
||||||
data->set.httpreq = HTTPREQ_GET;
|
data->set.httpreq = HTTPREQ_GET;
|
||||||
|
@ -4447,8 +4447,8 @@ static CURLcode set_userpass(struct connectdata *conn,
|
|||||||
const char *user, const char *passwd)
|
const char *user, const char *passwd)
|
||||||
{
|
{
|
||||||
/* If our protocol needs a password and we have none, use the defaults */
|
/* If our protocol needs a password and we have none, use the defaults */
|
||||||
if( (conn->handler->protocol & (CURLPROTO_FTP|CURLPROTO_IMAP)) &&
|
if((conn->handler->protocol & (CURLPROTO_FTP|CURLPROTO_IMAP)) &&
|
||||||
!conn->bits.user_passwd) {
|
!conn->bits.user_passwd) {
|
||||||
|
|
||||||
conn->user = strdup(CURL_DEFAULT_USER);
|
conn->user = strdup(CURL_DEFAULT_USER);
|
||||||
if(conn->user)
|
if(conn->user)
|
||||||
|
@ -1143,7 +1143,8 @@ struct UrlState {
|
|||||||
|
|
||||||
bool authproblem; /* TRUE if there's some problem authenticating */
|
bool authproblem; /* TRUE if there's some problem authenticating */
|
||||||
|
|
||||||
void *resolver; /* resolver state, if it is used in the URL state - ares_channel f.e. */
|
void *resolver; /* resolver state, if it is used in the URL state -
|
||||||
|
ares_channel f.e. */
|
||||||
|
|
||||||
#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)
|
#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)
|
||||||
ENGINE *engine;
|
ENGINE *engine;
|
||||||
|
Loading…
Reference in New Issue
Block a user