summaryrefslogtreecommitdiffstats
path: root/lib/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c55
1 files changed, 34 insertions, 21 deletions
diff --git a/lib/url.c b/lib/url.c
index 4f5673e..61dad44 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -888,8 +888,8 @@ static bool conn_maxage(struct Curl_easy *data,
idletime /= 1000; /* integer seconds is fine */
if(idletime > data->set.maxage_conn) {
- infof(data, "Too old connection (%ld seconds idle), disconnect it",
- idletime);
+ infof(data, "Too old connection (%" CURL_FORMAT_TIMEDIFF_T
+ " seconds idle), disconnect it", idletime);
return TRUE;
}
@@ -898,8 +898,8 @@ static bool conn_maxage(struct Curl_easy *data,
if(data->set.maxlifetime_conn && lifetime > data->set.maxlifetime_conn) {
infof(data,
- "Too old connection (%ld seconds since creation), disconnect it",
- lifetime);
+ "Too old connection (%" CURL_FORMAT_TIMEDIFF_T
+ " seconds since creation), disconnect it", lifetime);
return TRUE;
}
@@ -1169,7 +1169,7 @@ ConnectionExists(struct Curl_easy *data,
foundPendingCandidate = TRUE;
/* Don't pick a connection that hasn't connected yet */
infof(data, "Connection #%" CURL_FORMAT_CURL_OFF_T
- "isn't open enough, can't reuse", check->connection_id);
+ " isn't open enough, can't reuse", check->connection_id);
continue;
}
@@ -2033,13 +2033,13 @@ void Curl_free_request_state(struct Curl_easy *data)
{
Curl_safefree(data->req.p.http);
Curl_safefree(data->req.newurl);
-
#ifndef CURL_DISABLE_DOH
if(data->req.doh) {
Curl_close(&data->req.doh->probe[0].easy);
Curl_close(&data->req.doh->probe[1].easy);
}
#endif
+ Curl_client_cleanup(data);
}
@@ -2076,7 +2076,6 @@ static char *detect_proxy(struct Curl_easy *data,
char proxy_env[128];
const char *protop = conn->handler->scheme;
char *envp = proxy_env;
- char *prox;
#ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)data;
#endif
@@ -2089,7 +2088,7 @@ static char *detect_proxy(struct Curl_easy *data,
strcpy(envp, "_proxy");
/* read the protocol proxy: */
- prox = curl_getenv(proxy_env);
+ proxy = curl_getenv(proxy_env);
/*
* We don't try the uppercase version of HTTP_PROXY because of
@@ -2103,23 +2102,35 @@ static char *detect_proxy(struct Curl_easy *data,
* This can cause 'internal' http/ftp requests to be
* arbitrarily redirected by any external attacker.
*/
- if(!prox && !strcasecompare("http_proxy", proxy_env)) {
+ if(!proxy && !strcasecompare("http_proxy", proxy_env)) {
/* There was no lowercase variable, try the uppercase version: */
Curl_strntoupper(proxy_env, proxy_env, sizeof(proxy_env));
- prox = curl_getenv(proxy_env);
+ proxy = curl_getenv(proxy_env);
}
envp = proxy_env;
- if(prox) {
- proxy = prox; /* use this */
- }
- else {
- envp = (char *)"all_proxy";
- proxy = curl_getenv(envp); /* default proxy to use */
+ if(!proxy) {
+#ifdef USE_WEBSOCKETS
+ /* websocket proxy fallbacks */
+ if(strcasecompare("ws_proxy", proxy_env)) {
+ proxy = curl_getenv("http_proxy");
+ }
+ else if(strcasecompare("wss_proxy", proxy_env)) {
+ proxy = curl_getenv("https_proxy");
+ if(!proxy)
+ proxy = curl_getenv("HTTPS_PROXY");
+ }
if(!proxy) {
- envp = (char *)"ALL_PROXY";
- proxy = curl_getenv(envp);
+#endif
+ envp = (char *)"all_proxy";
+ proxy = curl_getenv(envp); /* default proxy to use */
+ if(!proxy) {
+ envp = (char *)"ALL_PROXY";
+ proxy = curl_getenv(envp);
+ }
+#ifdef USE_WEBSOCKETS
}
+#endif
}
if(proxy)
infof(data, "Uses proxy env variable %s == '%s'", envp, proxy);
@@ -2719,7 +2730,9 @@ static CURLcode override_login(struct Curl_easy *data,
data->set.str[STRING_NETRC_FILE]);
if(ret > 0) {
infof(data, "Couldn't find host %s in the %s file; using defaults",
- conn->host.name, data->set.str[STRING_NETRC_FILE]);
+ conn->host.name,
+ (data->set.str[STRING_NETRC_FILE] ?
+ data->set.str[STRING_NETRC_FILE] : ".netrc"));
}
else if(ret < 0) {
failf(data, ".netrc parser error");
@@ -3214,8 +3227,8 @@ static CURLcode resolve_host(struct Curl_easy *data,
if(rc == CURLRESOLV_PENDING)
*async = TRUE;
else if(rc == CURLRESOLV_TIMEDOUT) {
- failf(data, "Failed to resolve host '%s' with timeout after %ld ms",
- connhost->dispname,
+ failf(data, "Failed to resolve host '%s' with timeout after %"
+ CURL_FORMAT_TIMEDIFF_T " ms", connhost->dispname,
Curl_timediff(Curl_now(), data->progress.t_startsingle));
return CURLE_OPERATION_TIMEDOUT;
}