Skip to content

Commit

Permalink
privatise: make private functions static
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Jun 3, 2011
1 parent c2eb8c9 commit 5d4e559
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
18 changes: 10 additions & 8 deletions lib/http.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
static int http_getsock_do(struct connectdata *conn, static int http_getsock_do(struct connectdata *conn,
curl_socket_t *socks, curl_socket_t *socks,
int numsocks); int numsocks);
static int http_should_fail(struct connectdata *conn);

#ifdef USE_SSL #ifdef USE_SSL
static CURLcode https_connecting(struct connectdata *conn, bool *done); static CURLcode https_connecting(struct connectdata *conn, bool *done);
static int https_getsock(struct connectdata *conn, static int https_getsock(struct connectdata *conn,
Expand Down Expand Up @@ -193,7 +195,7 @@ char *Curl_checkheaders(struct SessionHandle *data, const char *thisheader)
* case of allocation failure. Returns an empty string if the header value * case of allocation failure. Returns an empty string if the header value
* consists entirely of whitespace. * consists entirely of whitespace.
*/ */
char *Curl_copy_header_value(const char *h) static char *copy_header_value(const char *h)
{ {
const char *start; const char *start;
const char *end; const char *end;
Expand Down Expand Up @@ -496,7 +498,7 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
data->state.authhost.done = TRUE; data->state.authhost.done = TRUE;
} }
} }
if(Curl_http_should_fail(conn)) { if(http_should_fail(conn)) {
failf (data, "The requested URL returned error: %d", failf (data, "The requested URL returned error: %d",
data->req.httpcode); data->req.httpcode);
code = CURLE_HTTP_RETURNED_ERROR; code = CURLE_HTTP_RETURNED_ERROR;
Expand Down Expand Up @@ -819,7 +821,7 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
} }


/** /**
* Curl_http_should_fail() determines whether an HTTP response has gotten us * http_should_fail() determines whether an HTTP response has gotten us
* into an error state or not. * into an error state or not.
* *
* @param conn all information about the current connection * @param conn all information about the current connection
Expand All @@ -828,7 +830,7 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
* *
* @retval 1 communications should not continue * @retval 1 communications should not continue
*/ */
int Curl_http_should_fail(struct connectdata *conn) static int http_should_fail(struct connectdata *conn)
{ {
struct SessionHandle *data; struct SessionHandle *data;
int httpcode; int httpcode;
Expand Down Expand Up @@ -1786,7 +1788,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
custom Host: header if this is NOT a redirect, as setting Host: in the custom Host: header if this is NOT a redirect, as setting Host: in the
redirected request is being out on thin ice. Except if the host name redirected request is being out on thin ice. Except if the host name
is the same as the first one! */ is the same as the first one! */
char *cookiehost = Curl_copy_header_value(ptr); char *cookiehost = copy_header_value(ptr);
if(!cookiehost) if(!cookiehost)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
if(!*cookiehost) if(!*cookiehost)
Expand Down Expand Up @@ -2792,7 +2794,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
* When all the headers have been parsed, see if we should give * When all the headers have been parsed, see if we should give
* up and return an error. * up and return an error.
*/ */
if(Curl_http_should_fail(conn)) { if(http_should_fail(conn)) {
failf (data, "The requested URL returned error: %d", failf (data, "The requested URL returned error: %d",
k->httpcode); k->httpcode);
return CURLE_HTTP_RETURNED_ERROR; return CURLE_HTTP_RETURNED_ERROR;
Expand Down Expand Up @@ -3084,7 +3086,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
} }
/* check for Content-Type: header lines to get the MIME-type */ /* check for Content-Type: header lines to get the MIME-type */
else if(checkprefix("Content-Type:", k->p)) { else if(checkprefix("Content-Type:", k->p)) {
char *contenttype = Curl_copy_header_value(k->p); char *contenttype = copy_header_value(k->p);
if(!contenttype) if(!contenttype)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
if(!*contenttype) if(!*contenttype)
Expand Down Expand Up @@ -3290,7 +3292,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
checkprefix("Location:", k->p) && checkprefix("Location:", k->p) &&
!data->req.location) { !data->req.location) {
/* this is the URL that the server advises us to use instead */ /* this is the URL that the server advises us to use instead */
char *location = Curl_copy_header_value(k->p); char *location = copy_header_value(k->p);
if(!location) if(!location)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
if(!*location) if(!*location)
Expand Down
5 changes: 0 additions & 5 deletions lib/http.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ bool Curl_compareheader(const char *headerline, /* line to check */


char *Curl_checkheaders(struct SessionHandle *data, const char *thisheader); char *Curl_checkheaders(struct SessionHandle *data, const char *thisheader);


char *Curl_copy_header_value(const char *h);


/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* /*
* The add_buffer series of functions are used to build one large memory chunk * The add_buffer series of functions are used to build one large memory chunk
Expand Down Expand Up @@ -83,8 +80,6 @@ CURLcode Curl_http_input_auth(struct connectdata *conn,
CURLcode Curl_http_auth_act(struct connectdata *conn); CURLcode Curl_http_auth_act(struct connectdata *conn);
CURLcode Curl_http_perhapsrewind(struct connectdata *conn); CURLcode Curl_http_perhapsrewind(struct connectdata *conn);


int Curl_http_should_fail(struct connectdata *conn);

/* If only the PICKNONE bit is set, there has been a round-trip and we /* If only the PICKNONE bit is set, there has been a round-trip and we
selected to use no auth at all. Ie, we actively select no auth, as opposed selected to use no auth at all. Ie, we actively select no auth, as opposed
to not having one selected. The other CURLAUTH_* defines are present in the to not having one selected. The other CURLAUTH_* defines are present in the
Expand Down

0 comments on commit 5d4e559

Please sign in to comment.