|
|
86693f |
From 46e85fee025964dd9a8ce2d615bc5f8ece530519 Mon Sep 17 00:00:00 2001
|
|
|
86693f |
From: Steve Holme <steve_holme@hotmail.com>
|
|
|
86693f |
Date: Thu, 20 Feb 2014 23:51:36 +0000
|
|
|
86693f |
Subject: [PATCH] url: Fixed connection re-use when using different log-in credentials
|
|
|
86693f |
|
|
|
86693f |
In addition to FTP, other connection based protocols such as IMAP, POP3,
|
|
|
86693f |
SMTP, SCP, SFTP and LDAP require a new connection when different log-in
|
|
|
86693f |
credentials are specified. Fixed the detection logic to include these
|
|
|
86693f |
other protocols.
|
|
|
86693f |
|
|
|
86693f |
Bug: http://curl.haxx.se/docs/adv_20140326A.html
|
|
|
86693f |
|
|
|
86693f |
[upstream commit 517b06d657aceb11a234b05cc891170c367ab80d]
|
|
|
86693f |
|
|
|
86693f |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
86693f |
---
|
|
|
86693f |
lib/http.c | 2 +-
|
|
|
86693f |
lib/url.c | 6 +++---
|
|
|
86693f |
lib/urldata.h | 2 ++
|
|
|
86693f |
3 files changed, 6 insertions(+), 4 deletions(-)
|
|
|
86693f |
|
|
|
86693f |
diff --git a/lib/http.c b/lib/http.c
|
|
|
86693f |
index f4b7a48..c78036b 100644
|
|
|
86693f |
--- a/lib/http.c
|
|
|
86693f |
+++ b/lib/http.c
|
|
|
86693f |
@@ -142,7 +142,7 @@ const struct Curl_handler Curl_handler_https = {
|
|
|
86693f |
ZERO_NULL, /* readwrite */
|
|
|
86693f |
PORT_HTTPS, /* defport */
|
|
|
86693f |
CURLPROTO_HTTP | CURLPROTO_HTTPS, /* protocol */
|
|
|
86693f |
- PROTOPT_SSL /* flags */
|
|
|
86693f |
+ PROTOPT_SSL | PROTOPT_CREDSPERREQUEST /* flags */
|
|
|
86693f |
};
|
|
|
86693f |
#endif
|
|
|
86693f |
|
|
|
86693f |
diff --git a/lib/url.c b/lib/url.c
|
|
|
86693f |
index 9690dfa..0174ff4 100644
|
|
|
86693f |
--- a/lib/url.c
|
|
|
86693f |
+++ b/lib/url.c
|
|
|
86693f |
@@ -2961,10 +2961,10 @@ ConnectionExists(struct SessionHandle *data,
|
|
|
86693f |
continue;
|
|
|
86693f |
}
|
|
|
86693f |
}
|
|
|
86693f |
- if((needle->handler->protocol & CURLPROTO_FTP) ||
|
|
|
86693f |
+ if((!(needle->handler->flags & PROTOPT_CREDSPERREQUEST)) ||
|
|
|
86693f |
((needle->handler->protocol & CURLPROTO_HTTP) && wantNTLM)) {
|
|
|
86693f |
- /* This is FTP or HTTP+NTLM, verify that we're using the same name
|
|
|
86693f |
- and password as well */
|
|
|
a2d4e1 |
+ /* This proto requires credentials per connection or is HTTP+NTLM,
|
|
|
86693f |
+ so verify that we're using the same name and password as well */
|
|
|
86693f |
if(!strequal(needle->user, check->user) ||
|
|
|
86693f |
!strequal(needle->passwd, check->passwd)) {
|
|
|
86693f |
/* one of them was different */
|
|
|
86693f |
diff --git a/lib/urldata.h b/lib/urldata.h
|
|
|
86693f |
index d597c67..cbf4102 100644
|
|
|
86693f |
--- a/lib/urldata.h
|
|
|
86693f |
+++ b/lib/urldata.h
|
|
|
86693f |
@@ -755,6 +755,8 @@ struct Curl_handler {
|
|
|
86693f |
gets a default */
|
|
|
86693f |
#define PROTOPT_NOURLQUERY (1<<6) /* protocol can't handle
|
|
|
86693f |
url query strings (?foo=bar) ! */
|
|
|
86693f |
+#define PROTOPT_CREDSPERREQUEST (1<<7) /* requires login creditials per request
|
|
|
86693f |
+ as opposed to per connection */
|
|
|
86693f |
|
|
|
86693f |
|
|
|
86693f |
/* return the count of bytes sent, or -1 on error */
|
|
|
86693f |
--
|
|
|
86693f |
1.7.1
|
|
|
86693f |
|