Stop overloading the conn->protocol field with the PROT_MISSING bit. It

really didn't belong there and had no real point.
This commit is contained in:
Daniel Stenberg 2009-12-17 16:03:39 +00:00
parent 91d05903b4
commit 54c60d0067
2 changed files with 9 additions and 7 deletions

View File

@ -3302,7 +3302,8 @@ static CURLcode findprotocol(struct SessionHandle *data,
* Parse URL and fill in the relevant members of the connection struct. * Parse URL and fill in the relevant members of the connection struct.
*/ */
static CURLcode parseurlandfillconn(struct SessionHandle *data, static CURLcode parseurlandfillconn(struct SessionHandle *data,
struct connectdata *conn) struct connectdata *conn,
bool *prot_missing)
{ {
char *at; char *at;
char *tmp; char *tmp;
@ -3311,6 +3312,8 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
char protobuf[16]; char protobuf[16];
const char *protop; const char *protop;
prot_missing = FALSE;
/************************************************************* /*************************************************************
* Parse the URL. * Parse the URL.
* *
@ -3418,7 +3421,7 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
protop = "http"; protop = "http";
} }
conn->protocol |= PROT_MISSING; /* not given in URL */ *prot_missing = TRUE; /* not given in URL */
} }
else else
protop = protobuf; protop = protobuf;
@ -4341,6 +4344,7 @@ static CURLcode create_conn(struct SessionHandle *data,
char passwd[MAX_CURL_PASSWORD_LENGTH]; char passwd[MAX_CURL_PASSWORD_LENGTH];
bool reuse; bool reuse;
char *proxy = NULL; char *proxy = NULL;
bool prot_missing = FALSE;
*async = FALSE; *async = FALSE;
@ -4447,7 +4451,7 @@ static CURLcode create_conn(struct SessionHandle *data,
conn->host.name = conn->host.rawalloc; conn->host.name = conn->host.rawalloc;
conn->host.name[0] = 0; conn->host.name[0] = 0;
result = parseurlandfillconn(data, conn); result = parseurlandfillconn(data, conn, &prot_missing);
if(result != CURLE_OK) { if(result != CURLE_OK) {
return result; return result;
} }
@ -4455,7 +4459,7 @@ static CURLcode create_conn(struct SessionHandle *data,
/************************************************************* /*************************************************************
* No protocol part in URL was used, add it! * No protocol part in URL was used, add it!
*************************************************************/ *************************************************************/
if(conn->protocol&PROT_MISSING) { if(prot_missing) {
/* We're guessing prefixes here and if we're told to use a proxy or if /* We're guessing prefixes here and if we're told to use a proxy or if
we're gonna follow a Location: later or... then we need the protocol we're gonna follow a Location: later or... then we need the protocol
part added so that we have a valid URL. */ part added so that we have a valid URL. */
@ -4470,7 +4474,6 @@ static CURLcode create_conn(struct SessionHandle *data,
data->change.url = reurl; data->change.url = reurl;
data->change.url_alloc = TRUE; /* free this later */ data->change.url_alloc = TRUE; /* free this later */
conn->protocol &= ~PROT_MISSING; /* switch that one off again */
} }
/************************************************************* /*************************************************************
@ -4519,7 +4522,7 @@ static CURLcode create_conn(struct SessionHandle *data,
} }
/* proxy must be freed later unless NULL */ /* proxy must be freed later unless NULL */
if(proxy && *proxy) { if(proxy && *proxy) {
long bits = conn->protocol & (PROT_HTTPS|PROT_SSL|PROT_MISSING); long bits = conn->protocol & (PROT_HTTPS|PROT_SSL);
if((conn->proxytype == CURLPROXY_HTTP) || if((conn->proxytype == CURLPROXY_HTTP) ||
(conn->proxytype == CURLPROXY_HTTP_1_0)) { (conn->proxytype == CURLPROXY_HTTP_1_0)) {

View File

@ -679,7 +679,6 @@ struct connectdata {
#define PROT_EXTMASK 0xfffff #define PROT_EXTMASK 0xfffff
#define PROT_SSL (1<<25) /* protocol requires SSL */ #define PROT_SSL (1<<25) /* protocol requires SSL */
#define PROT_MISSING (1<<26)
/* these ones need action before socket close */ /* these ones need action before socket close */
#define PROT_CLOSEACTION (PROT_FTP | PROT_TFTP | PROT_IMAP | PROT_POP3) #define PROT_CLOSEACTION (PROT_FTP | PROT_TFTP | PROT_IMAP | PROT_POP3)