summaryrefslogtreecommitdiff
path: root/lib/smtp.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2016-03-05 20:10:11 +0000
committerSteve Holme <steve_holme@hotmail.com>2016-03-08 19:36:46 +0000
commita5aec58726beae3926bcbe2fed83953ea3cd636e (patch)
tree96470f3195285ff61db0a4c92d2d11ff52bc0f2d /lib/smtp.c
parent307f3cf3b3066ce367a8e694f85e57c63a8bf4b7 (diff)
downloadcurl-a5aec58726beae3926bcbe2fed83953ea3cd636e.tar.gz
imap/pop3/smtp: Fixed connections upgraded with TLS are not reused
Regression since commit 710f14edba. Bug: https://github.com/curl/curl/issues/422 Reported-by: Justin Ehlert
Diffstat (limited to 'lib/smtp.c')
-rw-r--r--lib/smtp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/smtp.c b/lib/smtp.c
index 7102ffbf3..2a87c6eae 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -224,7 +224,11 @@ static const struct SASLproto saslsmtp = {
#ifdef USE_SSL
static void smtp_to_smtps(struct connectdata *conn)
{
+ /* Change the connection handler */
conn->handler = &Curl_handler_smtps;
+
+ /* Set the connection's upgraded to TLS flag */
+ conn->tls_upgraded = TRUE;
}
#else
#define smtp_to_smtps(x) Curl_nop_stmt
@@ -1450,6 +1454,10 @@ static CURLcode smtp_setup_connection(struct connectdata *conn)
struct SessionHandle *data = conn->data;
CURLcode result;
+ /* Clear the TLS upgraded flag */
+ conn->tls_upgraded = FALSE;
+
+ /* Set up the proxy if necessary */
if(conn->bits.httpproxy && !data->set.tunnel_thru_httpproxy) {
/* Unless we have asked to tunnel SMTP operations through the proxy, we
switch and use HTTP operations only */