mirror of
https://github.com/curl/curl.git
synced 2025-02-17 14:59:45 +08:00
url: Fixed connection re-use when using different log-in credentials
In addition to FTP, other connection based protocols such as IMAP, POP3, SMTP, SCP, SFTP and LDAP require a new connection when different log-in credentials are specified. Fixed the detection logic to include these other protocols. Bug: http://curl.haxx.se/docs/adv_20140326A.html
This commit is contained in:
parent
e798e6759b
commit
517b06d657
@ -145,7 +145,7 @@ const struct Curl_handler Curl_handler_https = {
|
|||||||
ZERO_NULL, /* readwrite */
|
ZERO_NULL, /* readwrite */
|
||||||
PORT_HTTPS, /* defport */
|
PORT_HTTPS, /* defport */
|
||||||
CURLPROTO_HTTP | CURLPROTO_HTTPS, /* protocol */
|
CURLPROTO_HTTP | CURLPROTO_HTTPS, /* protocol */
|
||||||
PROTOPT_SSL /* flags */
|
PROTOPT_SSL | PROTOPT_CREDSPERREQUEST /* flags */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3060,9 +3060,10 @@ ConnectionExists(struct SessionHandle *data,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((needle->handler->protocol & CURLPROTO_FTP) || wantNTLMhttp) {
|
if((!(needle->handler->flags & PROTOPT_CREDSPERREQUEST)) ||
|
||||||
/* This is FTP or HTTP+NTLM, verify that we're using the same name
|
wantNTLMhttp) {
|
||||||
and password as well */
|
/* This protocol requires credentials per connection or is HTTP+NTLM,
|
||||||
|
so verify that we're using the same name and password as well */
|
||||||
if(!strequal(needle->user, check->user) ||
|
if(!strequal(needle->user, check->user) ||
|
||||||
!strequal(needle->passwd, check->passwd)) {
|
!strequal(needle->passwd, check->passwd)) {
|
||||||
/* one of them was different */
|
/* one of them was different */
|
||||||
|
@ -795,6 +795,8 @@ struct Curl_handler {
|
|||||||
gets a default */
|
gets a default */
|
||||||
#define PROTOPT_NOURLQUERY (1<<6) /* protocol can't handle
|
#define PROTOPT_NOURLQUERY (1<<6) /* protocol can't handle
|
||||||
url query strings (?foo=bar) ! */
|
url query strings (?foo=bar) ! */
|
||||||
|
#define PROTOPT_CREDSPERREQUEST (1<<7) /* requires login creditials per request
|
||||||
|
as opposed to per connection */
|
||||||
|
|
||||||
|
|
||||||
/* return the count of bytes sent, or -1 on error */
|
/* return the count of bytes sent, or -1 on error */
|
||||||
|
Loading…
Reference in New Issue
Block a user