};
#endif
-
CURLcode Curl_http_setup_conn(struct connectdata *conn)
{
/* allocate the HTTP-specific struct for the SessionHandle, only to survive
if(Curl_raw_nequal(head->data, thisheader, thislen))
return head->data;
}
+
return NULL;
}
* It takes a connectdata struct as input instead of the SessionHandle simply
* to know if this is a proxy request or not, as it then might check a
* different header list.
- *
*/
char *Curl_checkProxyheaders(const struct connectdata *conn,
const char *thisheader)
size_t thislen = strlen(thisheader);
struct SessionHandle *data = conn->data;
- for(head = (conn->bits.proxy && data->set.sep_headers)?
- data->set.proxyheaders:data->set.headers;
+ for(head = (conn->bits.proxy && data->set.sep_headers) ?
+ data->set.proxyheaders : data->set.headers;
head; head=head->next) {
if(Curl_raw_nequal(head->data, thisheader, thislen))
return head->data;
}
+
return NULL;
}
free(*userp);
*userp = aprintf("%sAuthorization: Basic %s\r\n",
- proxy?"Proxy-":"",
+ proxy ? "Proxy-" : "",
authorization);
free(authorization);
if(!*userp)
return result;
}
}
-
else if((data->req.httpcode < 300) &&
(!data->state.authhost.done) &&
conn->bits.authneg) {
return result;
}
-
/*
* Output the correct authentication header depending on the auth type
* and whether or not it is to a proxy.
negdata->state = GSS_AUTHNONE;
if((authstatus->picked == CURLAUTH_NEGOTIATE) &&
negdata->context && !GSS_ERROR(negdata->status)) {
- auth="Negotiate";
+ auth = "Negotiate";
result = Curl_output_negotiate(conn, proxy);
if(result)
return result;
#endif
#ifdef USE_NTLM
if(authstatus->picked == CURLAUTH_NTLM) {
- auth="NTLM";
+ auth = "NTLM";
result = Curl_output_ntlm(conn, proxy);
if(result)
return result;
#endif
#ifndef CURL_DISABLE_CRYPTO_AUTH
if(authstatus->picked == CURLAUTH_DIGEST) {
- auth="Digest";
+ auth = "Digest";
result = Curl_output_digest(conn,
proxy,
(const unsigned char *)request,
!Curl_checkProxyheaders(conn, "Proxy-authorization:")) ||
(!proxy && conn->bits.user_passwd &&
!Curl_checkheaders(conn, "Authorization:"))) {
- auth="Basic";
+ auth = "Basic";
result = http_output_basic(conn, proxy);
if(result)
return result;
}
+
/* NOTE: this function should set 'done' TRUE, as the other auth
functions work that way */
authstatus->done = TRUE;
if(auth) {
infof(data, "%s auth using %s with user '%s'\n",
- proxy?"Proxy":"Server", auth,
- proxy?(conn->proxyuser?conn->proxyuser:""):
- (conn->user?conn->user:""));
+ proxy ? "Proxy" : "Server", auth,
+ proxy ? (conn->proxyuser ? conn->proxyuser : "") :
+ (conn->user ? conn->user : ""));
authstatus->multi = (!authstatus->done) ? TRUE : FALSE;
}
else
return result;
}
-
/*
* Curl_http_input_auth() deals with Proxy-Authenticate: and WWW-Authenticate:
* headers. They are dealt with both in the transfer.c main loop and in the
* request is sent, and then it is again set _after_ all response 401/407
* headers have been received but then only to a single preferred method
* (bit).
- *
*/
while(*auth) {
while(*auth && ISSPACE(*auth))
auth++;
}
+
return CURLE_OK;
}
** Any code >= 400 that's not 401 or 407 is always
** a terminal error
*/
- if((httpcode != 401) &&
- (httpcode != 407))
+ if((httpcode != 401) && (httpcode != 407))
return 1;
/*
struct HTTP *http = conn->data->req.protop;
size_t fullsize = size * nitems;
- if(0 == http->postsize)
+ if(!http->postsize)
/* nothing to return */
return 0;
return result;
}
-
if((conn->handler->flags & PROTOPT_SSL) && conn->httpversion != 20) {
/* We never send more than CURL_MAX_WRITE_SIZE bytes in one single chunk
when we speak HTTPS, as if only a fraction of it is sent now, this data
buffer is using this size.
*/
- sendsize= (size > CURL_MAX_WRITE_SIZE)?CURL_MAX_WRITE_SIZE:size;
+ sendsize = (size > CURL_MAX_WRITE_SIZE) ? CURL_MAX_WRITE_SIZE : size;
/* OpenSSL is very picky and we must send the SAME buffer pointer to the
library when we attempt to re-send this buffer. Sending the same data
* only send away a part).
*/
/* how much of the header that was sent */
- size_t headlen = (size_t)amount>headersize?headersize:(size_t)amount;
+ size_t headlen = (size_t)amount>headersize ? headersize : (size_t)amount;
size_t bodylen = amount - headlen;
if(conn->data->set.verbose) {
buffer size that doubles the required size. If this new size
would wrap size_t, then just use the largest possible one */
- if((size > (size_t)-1/2) || (in->size_used > (size_t)-1/2) ||
- (~(size*2) < (in->size_used*2)))
+ if((size > (size_t)-1 / 2) || (in->size_used > (size_t)-1 / 2) ||
+ (~(size * 2) < (in->size_used * 2)))
new_size = (size_t)-1;
else
- new_size = (in->size_used+size)*2;
+ new_size = (in->size_used+size) * 2;
if(in->buffer)
/* we have a buffer, enlarge the existing one */
return GETSOCK_READSOCK(0);
}
}
+
return CURLE_OK;
}
#else
conn->seek_func = data->set.seek_func; /* restore */
conn->seek_client = data->set.seek_client; /* restore */
- if(http == NULL)
+ if(!http)
return CURLE_OK;
if(http->send_buffer) {
return CURLE_OK;
}
-
/*
* Determine if we should use HTTP 1.1 (OR BETTER) for this request. Reasons
* to avoid it include:
data->state.expect100header = TRUE;
}
}
+
return result;
}
headers = headers->next;
}
}
+
return CURLE_OK;
}