return_value = CURL_FORMADD_OPTION_TWICE;
else
current_form->namelength =
- array_state?(long)array_value:(long)va_arg(params, long);
+ array_state?(size_t)array_value:(size_t)va_arg(params, long);
break;
/*
return_value = CURL_FORMADD_OPTION_TWICE;
else
current_form->contentslength =
- array_state?(long)array_value:va_arg(params, long);
+ array_state?(size_t)array_value:(size_t)va_arg(params, long);
break;
/* Get contents from a given file name */
if (current_form->flags != 0)
return_value = CURL_FORMADD_OPTION_TWICE;
else {
- char *filename = array_state?
+ const char *filename = array_state?
array_value:va_arg(params, char *);
if (filename) {
current_form->value = strdup(filename);
/* We upload a file */
case CURLFORM_FILE:
{
- char *filename = array_state?array_value:
+ const char *filename = array_state?array_value:
va_arg(params, char *);
if (current_form->value) {
case CURLFORM_BUFFER:
{
- char *filename = array_state?array_value:
+ const char *filename = array_state?array_value:
va_arg(params, char *);
if (current_form->value) {
return_value = CURL_FORMADD_OPTION_TWICE;
else
current_form->bufferlength =
- array_state?(long)array_value:va_arg(params, long);
+ array_state?(size_t)array_value:(size_t)va_arg(params, long);
break;
case CURLFORM_CONTENTTYPE:
{
- char *contenttype =
+ const char *contenttype =
array_state?array_value:va_arg(params, char *);
if (current_form->contenttype) {
if (current_form->flags & HTTPPOST_FILENAME) {
}
case CURLFORM_FILENAME:
{
- char *filename = array_state?array_value:
+ const char *filename = array_state?array_value:
va_arg(params, char *);
if( current_form->showfilename )
return_value = CURL_FORMADD_OPTION_TWICE;
}
#endif
-static char *strippath(char *fullfile)
+static char *strippath(const char *fullfile)
{
char *filename;
char *base;
/* we got a whole chunk of data, which can be anything from one
* byte to a set of lines and possible just a piece of the last
* line */
- int i;
+ ssize_t i;
data->reqdata.keep.headerbytecount += gotbytes;
/* we got a whole chunk of data, which can be anything from one
* byte to a set of lines and possible just a piece of the last
* line */
- int i;
+ ssize_t i;
data->reqdata.keep.headerbytecount += gotbytes;
{
struct ftp_conn *ftpc = &conn->proto.ftpc;
CURLcode result;
- int want = ascii?'A':'I';
+ char want = ascii?'A':'I';
if (ftpc->transfertype == want) {
state(conn, newstate);
state(conn, newstate);
/* keep track of our current transfer type */
- ftpc->transfertype = (char)want;
+ ftpc->transfertype = want;
return CURLE_OK;
}
*/
static CURLcode
Curl_http_output_auth(struct connectdata *conn,
- char *request,
- char *path,
+ const char *request,
+ const char *path,
bool proxytunnel) /* TRUE if this is the request setting
up the proxy tunnel */
{
CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data;
- char *auth=NULL;
+ const char *auth=NULL;
struct auth *authhost;
struct auth *authproxy;
(conn->bits.tunnel_proxy == proxytunnel)) {
#ifdef USE_NTLM
if(authproxy->picked == CURLAUTH_NTLM) {
- auth=(char *)"NTLM";
+ auth="NTLM";
result = Curl_output_ntlm(conn, TRUE);
if(result)
return result;
/* Basic */
if(conn->bits.proxy_user_passwd &&
!checkheaders(data, "Proxy-authorization:")) {
- auth=(char *)"Basic";
+ auth="Basic";
result = Curl_output_basic(conn, TRUE);
if(result)
return result;
}
#ifndef CURL_DISABLE_CRYPTO_AUTH
else if(authproxy->picked == CURLAUTH_DIGEST) {
- auth=(char *)"Digest";
+ auth="Digest";
result = Curl_output_digest(conn,
TRUE, /* proxy */
- (unsigned char *)request,
- (unsigned char *)path);
+ (const unsigned char *)request,
+ (const unsigned char *)path);
if(result)
return result;
}
if((authhost->picked == CURLAUTH_GSSNEGOTIATE) &&
data->state.negotiate.context &&
!GSS_ERROR(data->state.negotiate.status)) {
- auth=(char *)"GSS-Negotiate";
+ auth="GSS-Negotiate";
result = Curl_output_negotiate(conn);
if (result)
return result;
#endif
#ifdef USE_NTLM
if(authhost->picked == CURLAUTH_NTLM) {
- auth=(char *)"NTLM";
+ auth="NTLM";
result = Curl_output_ntlm(conn, FALSE);
if(result)
return result;
{
#ifndef CURL_DISABLE_CRYPTO_AUTH
if(authhost->picked == CURLAUTH_DIGEST) {
- auth=(char *)"Digest";
+ auth="Digest";
result = Curl_output_digest(conn,
FALSE, /* not a proxy */
- (unsigned char *)request,
- (unsigned char *)path);
+ (const unsigned char *)request,
+ (const unsigned char *)path);
if(result)
return result;
} else
if(authhost->picked == CURLAUTH_BASIC) {
if(conn->bits.user_passwd &&
!checkheaders(data, "Authorization:")) {
- auth=(char *)"Basic";
+ auth="Basic";
result = Curl_output_basic(conn, FALSE);
if(result)
return result;
CURLcode Curl_http_input_auth(struct connectdata *conn,
int httpcode,
- char *header) /* the first non-space */
+ const char *header) /* the first non-space */
{
/*
* This resource requires authentication
struct SessionHandle *data = conn->data;
long *availp;
- char *start;
+ const char *start;
struct auth *authp;
if (httpcode == 407) {
CURLcode Curl_proxyCONNECT(struct connectdata *conn,
int sockindex,
- char *hostname,
+ const char *hostname,
unsigned short remote_port)
{
int subversion=0;
/* ftp can use this as well */
CURLcode Curl_proxyCONNECT(struct connectdata *conn,
int tunnelsocket,
- char *hostname, unsigned short remote_port);
+ const char *hostname, unsigned short remote_port);
/* protocol-specific functions set up to be called by the main engine */
CURLcode Curl_http(struct connectdata *conn, bool *done);
/* These functions are in http.c */
void Curl_http_auth_stage(struct SessionHandle *data, int stage);
CURLcode Curl_http_input_auth(struct connectdata *conn,
- int httpcode, char *header);
+ int httpcode, const char *header);
CURLcode Curl_http_auth_act(struct connectdata *conn);
int Curl_http_should_fail(struct connectdata *conn);
CURLdigest Curl_input_digest(struct connectdata *conn,
bool proxy,
- char *header) /* rest of the *-authenticate:
- header */
+ const char *header) /* rest of the *-authenticate:
+ header */
{
bool more = TRUE;
char *token = NULL;
CURLcode Curl_output_digest(struct connectdata *conn,
bool proxy,
- unsigned char *request,
- unsigned char *uripath)
+ const unsigned char *request,
+ const unsigned char *uripath)
{
/* We have a Digest setup for this, use it! Now, to get all the details for
this sorted out, I must urge you dear friend to read up on the RFC2617
/* this is for digest header input */
CURLdigest Curl_input_digest(struct connectdata *conn,
- bool proxy, char *header);
+ bool proxy, const char *header);
/* this is for creating digest header output */
CURLcode Curl_output_digest(struct connectdata *conn,
bool proxy,
- unsigned char *request,
- unsigned char *uripath);
+ const unsigned char *request,
+ const unsigned char *uripath);
void Curl_digest_cleanup_one(struct digestdata *dig);
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH)
infof(conn->data, "%s", buf);
}
-int Curl_input_negotiate(struct connectdata *conn, char *header)
+int Curl_input_negotiate(struct connectdata *conn, const char *header)
{
struct negotiatedata *neg_ctx = &conn->data->state.negotiate;
OM_uint32 major_status, minor_status, minor_status2;
#ifdef HAVE_GSSAPI
/* this is for Negotiate header input */
-int Curl_input_negotiate(struct connectdata *conn, char *header);
+int Curl_input_negotiate(struct connectdata *conn, const char *header);
/* this is for creating Negotiate header output */
CURLcode Curl_output_negotiate(struct connectdata *conn);
CURLntlm Curl_input_ntlm(struct connectdata *conn,
bool proxy, /* if proxy or not */
- char *header) /* rest of the www-authenticate:
- header */
+ const char *header) /* rest of the www-authenticate:
+ header */
{
/* point to the correct struct with this */
struct ntlmdata *ntlm;
} CURLntlm;
/* this is for ntlm header input */
-CURLntlm Curl_input_ntlm(struct connectdata *conn, bool proxy, char *header);
+CURLntlm Curl_input_ntlm(struct connectdata *conn, bool proxy,
+ const char *header);
/* this is for creating ntlm header output */
CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy);
* Nonsupport "Identification Protocol (RFC1413)"
*/
CURLcode Curl_SOCKS4(const char *proxy_name,
- char *hostname,
+ const char *hostname,
int remote_port,
int sockindex,
struct connectdata *conn)
*/
CURLcode Curl_SOCKS5(const char *proxy_name,
const char *proxy_password,
- char *hostname,
+ const char *hostname,
int remote_port,
int sockindex,
struct connectdata *conn)
* final destination server.
*/
CURLcode Curl_SOCKS4(const char *proxy_name,
- char *hostname,
+ const char *hostname,
int remote_port,
int sockindex,
struct connectdata *conn);
*/
CURLcode Curl_SOCKS5(const char *proxy_name,
const char *proxy_password,
- char *hostname,
+ const char *hostname,
int remote_port,
int sockindex,
struct connectdata *conn);
void *ssl_sessionid,
size_t idsize)
{
- int i;
+ long i;
struct SessionHandle *data=conn->data; /* the mother of all structs */
struct curl_ssl_session *store = &data->state.session[0];
long oldest_age=data->state.session[0].age; /* zero if unused */
void Curl_ssl_close_all(struct SessionHandle *data)
{
#ifdef USE_SSL
- int i;
+ long i;
/* kill the session ID cache */
if(data->state.session) {
for(i=0; i< data->set.ssl.numsessions; i++)
return -1;
}
- return (int)nread;
+ return nread;
#else /* USE_SSL */
(void)conn;
#endif /* USE_SSLEAY */
}
-bool Curl_ssl_data_pending(struct connectdata *conn,
+bool Curl_ssl_data_pending(const struct connectdata *conn,
int connindex)
{
#ifdef USE_SSLEAY
CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
-bool Curl_ssl_data_pending(struct connectdata *conn,
+bool Curl_ssl_data_pending(const struct connectdata *conn,
int connindex);
#if !defined(USE_SSL) && !defined(SSLGEN_C)
static int Curl_ASN1_UTCTIME_output(struct connectdata *conn,
const char *prefix,
- ASN1_UTCTIME *tm)
+ const ASN1_UTCTIME *tm)
{
- char *asn1_string;
+ const char *asn1_string;
int gmt=FALSE;
int i;
int year=0,month=0,day=0,hour=0,minute=0,second=0;
return 0;
i=tm->length;
- asn1_string=(char *)tm->data;
+ asn1_string=(const char *)tm->data;
if(i < 10)
return 1;
static int hostmatch(const char *hostname, const char *pattern)
{
while (1) {
- int c = *pattern++;
+ char c = *pattern++;
if (c == '\0')
return (*hostname ? HOST_NOMATCH : HOST_MATCH);
return CURLE_OK;
}
-static int data_pending(struct connectdata *conn)
+static int data_pending(const struct connectdata *conn)
{
/* in the case of libssh2, we can never be really sure that we have emptied
its internal buffers so we MUST always try until we get EAGAIN back */
if((k->keepon & KEEP_WRITE) && (select_res & CURL_CSELECT_OUT)) {
/* write */
- int i, si;
+ ssize_t i, si;
ssize_t bytes_written;
bool writedone=TRUE;
* keeps track of. This function will only be called for connections that are
* in the proper state to have this information available.
*/
-int Curl_single_getsock(struct connectdata *conn,
+int Curl_single_getsock(const struct connectdata *conn,
curl_socket_t *sock, /* points to numsocks number
of sockets */
int numsocks)
{
- struct SessionHandle *data = conn->data;
+ const struct SessionHandle *data = conn->data;
int bitmap = GETSOCK_BLANK;
- int index = 0;
+ unsigned index = 0;
if(numsocks < 2)
/* simple check but we might need two slots */
* strlen_url() returns the length of the given URL if the spaces within the
* URL were properly URL encoded.
*/
-static int strlen_url(char *url)
+static size_t strlen_url(const char *url)
{
- char *ptr;
- int newlen=0;
+ const char *ptr;
+ size_t newlen=0;
bool left=TRUE; /* left side of the ? */
for(ptr=url; *ptr; ptr++) {
switch(*ptr) {
case '?':
left=FALSE;
+ /* fall through */
default:
newlen++;
break;
/* strcpy_url() copies a url to a output buffer and URL-encodes the spaces in
* the source URL accordingly.
*/
-static void strcpy_url(char *output, char *url)
+static void strcpy_url(char *output, const char *url)
{
/* we must add this with whitespace-replacing */
bool left=TRUE;
- char *iptr;
+ const char *iptr;
char *optr = output;
for(iptr = url; /* read from here */
*iptr; /* until zero byte */
switch(*iptr) {
case '?':
left=FALSE;
+ /* fall through */
default:
*optr++=*iptr;
break;
CURLcode Curl_posttransfer(struct SessionHandle *data);
CURLcode Curl_follow(struct SessionHandle *data, char *newurl, bool retry);
CURLcode Curl_readwrite(struct connectdata *conn, bool *done);
-int Curl_single_getsock(struct connectdata *conn,
+int Curl_single_getsock(const struct connectdata *conn,
curl_socket_t *socks,
int numsocks);
CURLcode Curl_readwrite_init(struct connectdata *conn);