summaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c66
1 files changed, 28 insertions, 38 deletions
diff --git a/lib/url.c b/lib/url.c
index eb22dcc37..2b47b235d 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -488,9 +488,8 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
define since we internally only use the lower 16 bits for the passed
in bitmask to not conflict with the private bits */
set->allowed_protocols = CURLPROTO_ALL;
- set->redir_protocols = CURLPROTO_ALL & /* All except FILE, SCP and SMB */
- ~(CURLPROTO_FILE | CURLPROTO_SCP | CURLPROTO_SMB |
- CURLPROTO_SMBS);
+ set->redir_protocols = CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FTP |
+ CURLPROTO_FTPS;
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
/*
@@ -881,6 +880,26 @@ proxy_info_matches(const struct proxy_info* data,
#define proxy_info_matches(x,y) FALSE
#endif
+/* A connection has to have been idle for a shorter time than 'maxage_conn' to
+ be subject for reuse. The success rate is just too low after this. */
+
+static bool conn_maxage(struct Curl_easy *data,
+ struct connectdata *conn,
+ struct curltime now)
+{
+ if(!conn->data) {
+ timediff_t idletime = Curl_timediff(now, conn->lastused);
+ idletime /= 1000; /* integer seconds is fine */
+
+ if(idletime > data->set.maxage_conn) {
+ infof(data, "Too old connection (%ld seconds), disconnect it\n",
+ idletime);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
/*
* This function checks if the given connection is dead and extracts it from
* the connection cache if so.
@@ -897,7 +916,11 @@ static bool extract_if_dead(struct connectdata *conn,
/* The check for a dead socket makes sense only if the connection isn't in
use */
bool dead;
- if(conn->handler->connection_check) {
+ struct curltime now = Curl_now();
+ if(conn_maxage(data, conn, now)) {
+ dead = TRUE;
+ }
+ else if(conn->handler->connection_check) {
/* The protocol has a special method for checking the state of the
connection. Use it to check if the connection is dead. */
unsigned int state;
@@ -964,25 +987,6 @@ static void prune_dead_connections(struct Curl_easy *data)
}
}
-/* A connection has to have been idle for a shorter time than 'maxage_conn' to
- be subject for reuse. The success rate is just too low after this. */
-
-static bool conn_maxage(struct Curl_easy *data,
- struct connectdata *conn,
- struct curltime now)
-{
- if(!conn->data) {
- timediff_t idletime = Curl_timediff(now, conn->lastused);
- idletime /= 1000; /* integer seconds is fine */
-
- if(idletime/1000 > data->set.maxage_conn) {
- infof(data, "Too old connection (%ld seconds), disconnect it\n",
- idletime);
- return TRUE;
- }
- }
- return FALSE;
-}
/*
* Given one filled in connection struct (named needle), this function should
* detect if there already is one that has all the significant details
@@ -1006,7 +1010,6 @@ ConnectionExists(struct Curl_easy *data,
bool foundPendingCandidate = FALSE;
bool canmultiplex = IsMultiplexingPossible(data, needle);
struct connectbundle *bundle;
- struct curltime now = Curl_now();
const char *hostbundle;
#ifdef USE_NTLM
@@ -1074,12 +1077,6 @@ ConnectionExists(struct Curl_easy *data,
/* connect-only connections will not be reused */
continue;
- if(conn_maxage(data, check, now) || extract_if_dead(check, data)) {
- /* disconnect it */
- (void)Curl_disconnect(data, check, /* dead_connection */TRUE);
- continue;
- }
-
multiplexed = CONN_INUSE(check) &&
(bundle->multiuse == BUNDLE_MULTIPLEX);
@@ -1673,13 +1670,6 @@ static void free_idnconverted_hostname(struct hostname *host)
#endif
}
-static void llist_dtor(void *user, void *element)
-{
- (void)user;
- (void)element;
- /* Do nothing */
-}
-
/*
* Allocate and initialize a new connectdata object.
*/
@@ -1791,7 +1781,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
#endif
/* Initialize the easy handle list */
- Curl_llist_init(&conn->easyq, (curl_llist_dtor) llist_dtor);
+ Curl_llist_init(&conn->easyq, NULL);
#ifdef HAVE_GSSAPI
conn->data_prot = PROT_CLEAR;