#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#ifdef WIN32
#include <windows.h>
{
#ifdef WIN32
/* This shit requires windows.h (HUGE) to be included */
- static char env[MAX_PATH]; /* MAX_PATH is from windef.h */
+ char env[MAX_PATH]; /* MAX_PATH is from windef.h */
char *temp = getenv(variable);
env[0] = '\0';
ExpandEnvironmentStrings(temp, env, sizeof(env));
/* no length control */
char *env = getenv(variable);
#endif
- return env;
+ return env?strdup(env):NULL;
}
char *curl_GetEnv(char *v)
#define NETRC DOT_CHAR "netrc"
- if(!home || (strlen(home)>(sizeof(netrcbuffer)-strlen(NETRC))))
+ if(!home)
return -1;
+ if(strlen(home)>(sizeof(netrcbuffer)-strlen(NETRC))) {
+ free(home);
+ return -1;
+ }
+
sprintf(netrcbuffer, "%s%s%s", home, DIR_CHAR, NETRC);
file = fopen(netrcbuffer, "r");
fclose(file);
}
+ free(home);
+
return retcode;
}
/* 20000318 mgs */
int scr_size [2];
#endif
+ char *colp;
if(data->conf&(CONF_NOPROGRESS|CONF_MUTE))
return;
/* 20000318 mgs
* OS/2 users most likely won't have this env var set, and besides that
* we're using our own way to determine screen width */
- if (curl_GetEnv("COLUMNS") != NULL)
- width = atoi(curl_GetEnv("COLUMNS"));
+ colp = curl_GetEnv("COLUMNS");
+ if (colp != NULL) {
+ width = atoi(colp);
+ free(colp);
+ }
else
width = 79;
#else
data->firstsocket=-1;
}
+ if(data->bits.proxystringalloc) {
+ data->bits.proxystringalloc=0;
+ free(data->proxy);
+ data->proxy=NULL;
+ }
+
if(data->ptr_proxyuserpwd) {
free(data->ptr_proxyuserpwd);
if(proxy && *proxy) {
/* we have a proxy here to set */
data->proxy = proxy;
+ data->bits.proxystringalloc=1; /* this needs to be freed later */
data->bits.httpproxy=1;
}
} /* if (!nope) - it wasn't specfied non-proxy */
} /* NO_PROXY wasn't specified or '*' */
+ if(no_proxy)
+ free(no_proxy);
} /* if not using proxy */
if((conn->protocol&PROT_MISSING) && data->bits.httpproxy ) {
struct Configbits {
bool ftp_append;
bool ftp_ascii;
- bool http_post;
- bool http_set_referer;
+ bool ftp_list_only;
+ bool ftp_use_port;
+ bool hide_progress;
bool http_fail_on_error;
+ bool http_follow_location;
bool http_formpost;
bool http_include_header;
- bool http_follow_location;
+ bool http_post;
bool http_put;
+ bool http_set_referer;
+ bool httpproxy;
+ bool mute;
bool no_body;
- bool ftp_list_only;
- bool use_netrc;
- bool ftp_use_port;
+ bool proxy_user_passwd;
+ bool proxystringalloc; /* the http proxy string is malloc()'ed */
bool set_port;
bool set_range;
- bool mute;
- bool hide_progress;
bool upload;
+ bool use_netrc;
bool user_passwd;
- bool proxy_user_passwd;
bool verbose;
- bool httpproxy;
};
typedef size_t (*progress_callback)(void *clientp,