summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-03-14 22:52:14 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-03-14 22:52:14 +0100
commit13b64d75589647f8d151e035bd2c5d340a1c37ee (patch)
tree9c34a261f8803232da1b93836d2fa7b4e33db4b4 /lib
parent8831000bc07de463d277975a3ddfb6a31dcf14b4 (diff)
downloadcurl-13b64d75589647f8d151e035bd2c5d340a1c37ee.tar.gz
protocols: use CURLPROTO_ internally
The PROT_* set of internal defines for the protocols is no longer used. We now use the same bits internally as we have defined in the public header using the CURLPROTO_ prefix. This is for simplicity and because the PROT_* prefix was already used duplicated internally for a set of KRB4 values. The PROTOPT_* defines were moved up to just below the struct definition within which they are used.
Diffstat (limited to 'lib')
-rw-r--r--lib/curl_rtmp.c12
-rw-r--r--lib/dict.c2
-rw-r--r--lib/file.c2
-rw-r--r--lib/ftp.c10
-rw-r--r--lib/gopher.c2
-rw-r--r--lib/http.c36
-rw-r--r--lib/imap.c12
-rw-r--r--lib/openldap.c4
-rw-r--r--lib/pop3.c10
-rw-r--r--lib/rtsp.c2
-rw-r--r--lib/sendf.c2
-rw-r--r--lib/smtp.c10
-rw-r--r--lib/ssh.c14
-rw-r--r--lib/telnet.c2
-rw-r--r--lib/tftp.c2
-rw-r--r--lib/transfer.c21
-rw-r--r--lib/url.c18
-rw-r--r--lib/urldata.h53
18 files changed, 94 insertions, 120 deletions
diff --git a/lib/curl_rtmp.c b/lib/curl_rtmp.c
index 183db0ded..bae8a76c0 100644
--- a/lib/curl_rtmp.c
+++ b/lib/curl_rtmp.c
@@ -74,7 +74,7 @@ const struct Curl_handler Curl_handler_rtmp = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
PORT_RTMP, /* defport */
- PROT_RTMP, /* protocol */
+ CURLPROTO_RTMP, /* protocol */
PROTOPT_NONE /* flags*/
};
@@ -92,7 +92,7 @@ const struct Curl_handler Curl_handler_rtmpt = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
PORT_RTMPT, /* defport */
- PROT_RTMPT, /* protocol */
+ CURLPROTO_RTMPT, /* protocol */
PROTOPT_NONE /* flags*/
};
@@ -110,7 +110,7 @@ const struct Curl_handler Curl_handler_rtmpe = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
PORT_RTMP, /* defport */
- PROT_RTMPE, /* protocol */
+ CURLPROTO_RTMPE, /* protocol */
PROTOPT_NONE /* flags*/
};
@@ -128,7 +128,7 @@ const struct Curl_handler Curl_handler_rtmpte = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
PORT_RTMPT, /* defport */
- PROT_RTMPTE, /* protocol */
+ CURLPROTO_RTMPTE, /* protocol */
PROTOPT_NONE /* flags*/
};
@@ -146,7 +146,7 @@ const struct Curl_handler Curl_handler_rtmps = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
PORT_RTMPS, /* defport */
- PROT_RTMPS, /* protocol */
+ CURLPROTO_RTMPS, /* protocol */
PROTOPT_NONE /* flags*/
};
const struct Curl_handler Curl_handler_rtmpts = {
@@ -163,7 +163,7 @@ const struct Curl_handler Curl_handler_rtmpts = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
PORT_RTMPS, /* defport */
- PROT_RTMPTS, /* protocol */
+ CURLPROTO_RTMPTS, /* protocol */
PROTOPT_NONE /* flags*/
};
diff --git a/lib/dict.c b/lib/dict.c
index 750f728e9..e079fd188 100644
--- a/lib/dict.c
+++ b/lib/dict.c
@@ -108,7 +108,7 @@ const struct Curl_handler Curl_handler_dict = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_DICT, /* defport */
- PROT_DICT, /* protocol */
+ CURLPROTO_DICT, /* protocol */
PROTOPT_NONE /* flags */
};
diff --git a/lib/file.c b/lib/file.c
index 52c175f10..ad671233c 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -127,7 +127,7 @@ const struct Curl_handler Curl_handler_file = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
0, /* defport */
- PROT_FILE, /* protocol */
+ CURLPROTO_FILE, /* protocol */
PROTOPT_BANPROXY /* flags */
};
diff --git a/lib/ftp.c b/lib/ftp.c
index be7cc2398..6b4381909 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -179,7 +179,7 @@ const struct Curl_handler Curl_handler_ftp = {
ZERO_NULL, /* perform_getsock */
ftp_disconnect, /* disconnect */
PORT_FTP, /* defport */
- PROT_FTP, /* protocol */
+ CURLPROTO_FTP, /* protocol */
PROTOPT_DUAL | PROTOPT_CLOSEACTION /* flags */
};
@@ -203,7 +203,7 @@ const struct Curl_handler Curl_handler_ftps = {
ZERO_NULL, /* perform_getsock */
ftp_disconnect, /* disconnect */
PORT_FTPS, /* defport */
- PROT_FTP | PROT_FTPS, /* protocol */
+ CURLPROTO_FTP | CURLPROTO_FTPS, /* protocol */
PROTOPT_SSL | PROTOPT_DUAL | PROTOPT_CLOSEACTION /* flags */
};
#endif
@@ -227,7 +227,7 @@ static const struct Curl_handler Curl_handler_ftp_proxy = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_FTP, /* defport */
- PROT_HTTP, /* protocol */
+ CURLPROTO_HTTP, /* protocol */
PROTOPT_NONE /* flags */
};
@@ -251,7 +251,7 @@ static const struct Curl_handler Curl_handler_ftps_proxy = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_FTPS, /* defport */
- PROT_HTTP, /* protocol */
+ CURLPROTO_HTTP, /* protocol */
PROTOPT_NONE /* flags */
};
#endif
@@ -2952,7 +2952,7 @@ static CURLcode ftp_connect(struct connectdata *conn,
}
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
- if(conn->handler->protocol & PROT_FTPS) {
+ if(conn->handler->protocol & CURLPROTO_FTPS) {
/* BLOCKING */
/* FTPS is simply ftp with SSL for the control channel */
/* now, perform the SSL initialization for this socket */
diff --git a/lib/gopher.c b/lib/gopher.c
index 70a3f06bf..6718bafb1 100644
--- a/lib/gopher.c
+++ b/lib/gopher.c
@@ -113,7 +113,7 @@ const struct Curl_handler Curl_handler_gopher = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_GOPHER, /* defport */
- PROT_GOPHER, /* protocol */
+ CURLPROTO_GOPHER, /* protocol */
PROTOPT_NONE /* flags */
};
diff --git a/lib/http.c b/lib/http.c
index 2a74066b0..01a78a977 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -142,7 +142,7 @@ const struct Curl_handler Curl_handler_http = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_HTTP, /* defport */
- PROT_HTTP, /* protocol */
+ CURLPROTO_HTTP, /* protocol */
PROTOPT_NONE /* flags */
};
@@ -164,7 +164,7 @@ const struct Curl_handler Curl_handler_https = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_HTTPS, /* defport */
- PROT_HTTP | PROT_HTTPS, /* protocol */
+ CURLPROTO_HTTP | CURLPROTO_HTTPS, /* protocol */
PROTOPT_SSL /* flags */
};
#endif
@@ -347,7 +347,7 @@ CURLcode Curl_http_perhapsrewind(struct connectdata *conn)
curl_off_t bytessent;
curl_off_t expectsend = -1; /* default is unknown */
- if(!http || !(conn->handler->protocol & PROT_HTTP))
+ if(!http || !(conn->handler->protocol & CURLPROTO_HTTP))
/* If this is still NULL, we have not reach very far and we can
safely skip this rewinding stuff, or this is attempted to get used
when HTTP isn't activated */
@@ -1028,7 +1028,7 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in,
}
#endif /* CURL_DOES_CONVERSIONS */
- if(conn->handler->protocol & PROT_HTTPS) {
+ if(conn->handler->protocol & CURLPROTO_HTTPS) {
/* We never send more than CURL_MAX_WRITE_SIZE bytes in one single chunk
when we speak HTTPS, as if only a fraction of it is sent now, this data
needs to fit into the normal read-callback buffer later on and that
@@ -1775,7 +1775,7 @@ CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
}
#endif /* CURL_DISABLE_PROXY */
- if(conn->handler->protocol & PROT_HTTPS) {
+ if(conn->handler->protocol & CURLPROTO_HTTPS) {
/* perform SSL initialization */
if(data->state.used_interface == Curl_if_multi) {
result = https_connecting(conn, done);
@@ -1814,7 +1814,7 @@ static int http_getsock_do(struct connectdata *conn,
static CURLcode https_connecting(struct connectdata *conn, bool *done)
{
CURLcode result;
- DEBUGASSERT((conn) && (conn->handler->protocol & PROT_HTTPS));
+ DEBUGASSERT((conn) && (conn->handler->protocol & CURLPROTO_HTTPS));
/* perform SSL initialization for this socket */
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, done);
@@ -1832,7 +1832,7 @@ static int https_getsock(struct connectdata *conn,
curl_socket_t *socks,
int numsocks)
{
- if(conn->handler->protocol & PROT_HTTPS) {
+ if(conn->handler->protocol & CURLPROTO_HTTPS) {
struct ssl_connect_data *connssl = &conn->ssl[FIRSTSOCKET];
if(!numsocks)
@@ -2124,7 +2124,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
return CURLE_OUT_OF_MEMORY;
}
- if( (conn->handler->protocol&(PROT_HTTP|PROT_FTP)) &&
+ if( (conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_FTP)) &&
data->set.upload) {
httpreq = HTTPREQ_PUT;
}
@@ -2205,7 +2205,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
Curl_compareheader(ptr, "Transfer-Encoding:", "chunked");
}
else {
- if((conn->handler->protocol&PROT_HTTP) &&
+ if((conn->handler->protocol&CURLPROTO_HTTP) &&
data->set.upload &&
(data->set.infilesize == -1)) {
if(conn->bits.authneg)
@@ -2261,9 +2261,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
/* When building Host: headers, we must put the host name within
[brackets] if the host name is a plain IPv6-address. RFC2732-style. */
- if(((conn->given->protocol&PROT_HTTPS) &&
+ if(((conn->given->protocol&CURLPROTO_HTTPS) &&
(conn->remote_port == PORT_HTTPS)) ||
- ((conn->given->protocol&PROT_HTTP) &&
+ ((conn->given->protocol&CURLPROTO_HTTP) &&
(conn->remote_port == PORT_HTTP)) )
/* if(HTTPS on port 443) OR (HTTP on port 80) then don't include
the port number in the host string */
@@ -2580,7 +2580,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
conn->allocptr.cookiehost?
conn->allocptr.cookiehost:host,
data->state.path,
- (bool)(conn->handler->protocol&PROT_HTTPS?
+ (bool)(conn->handler->protocol&CURLPROTO_HTTPS?
TRUE:FALSE));
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
}
@@ -3041,7 +3041,7 @@ checkprotoprefix(struct SessionHandle *data, struct connectdata *conn,
const char *s)
{
#ifndef CURL_DISABLE_RTSP
- if(conn->handler->protocol & PROT_RTSP)
+ if(conn->handler->protocol & CURLPROTO_RTSP)
return checkrtspprefix(data, s);
#else
(void)conn;
@@ -3218,7 +3218,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
if((k->size == -1) && !k->chunk && !conn->bits.close &&
(conn->httpversion >= 11) &&
- !(conn->handler->protocol & PROT_RTSP)) {
+ !(conn->handler->protocol & CURLPROTO_RTSP)) {
/* On HTTP 1.1, when connection is not to get closed, but no
Content-Length nor Content-Encoding chunked have been
received, according to RFC2616 section 4.4 point 5, we
@@ -3379,7 +3379,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
#define HEADER1 k->p /* no conversion needed, just use k->p */
#endif /* CURL_DOES_CONVERSIONS */
- if(conn->handler->protocol & PROT_HTTP) {
+ if(conn->handler->protocol & CURLPROTO_HTTP) {
nc = sscanf(HEADER1,
" HTTP/%d.%d %3d",
&httpversion_major,
@@ -3407,7 +3407,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
}
}
}
- else if(conn->handler->protocol & PROT_RTSP) {
+ else if(conn->handler->protocol & CURLPROTO_RTSP) {
nc = sscanf(HEADER1,
" RTSP/%d.%d %3d",
&rtspversion_major,
@@ -3598,7 +3598,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
conn->bits.close = TRUE; /* close when done */
}
else if(Curl_compareheader(k->p, "Transfer-Encoding:", "chunked") &&
- !(conn->handler->protocol & PROT_RTSP)) {
+ !(conn->handler->protocol & CURLPROTO_RTSP)) {
/*
* [RFC 2616, section 3.6.1] A 'chunked' transfer encoding
* means that the server will send a series of "chunks". Each
@@ -3721,7 +3721,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
}
}
#ifndef CURL_DISABLE_RTSP
- else if(conn->handler->protocol & PROT_RTSP) {
+ else if(conn->handler->protocol & CURLPROTO_RTSP) {
result = Curl_rtsp_parseheader(conn, k->p);
if(result)
return result;
diff --git a/lib/imap.c b/lib/imap.c
index 12af79553..6ba665770 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -128,7 +128,7 @@ const struct Curl_handler Curl_handler_imap = {
ZERO_NULL, /* perform_getsock */
imap_disconnect, /* disconnect */
PORT_IMAP, /* defport */
- PROT_IMAP, /* protocol */
+ CURLPROTO_IMAP, /* protocol */
PROTOPT_CLOSEACTION /* flags */
};
@@ -152,7 +152,7 @@ const struct Curl_handler Curl_handler_imaps = {
ZERO_NULL, /* perform_getsock */
imap_disconnect, /* disconnect */
PORT_IMAPS, /* defport */
- PROT_IMAP | PROT_IMAPS, /* protocol */
+ CURLPROTO_IMAP | CURLPROTO_IMAPS, /* protocol */
PROTOPT_CLOSEACTION | PROTOPT_SSL /* flags */
};
#endif
@@ -176,7 +176,7 @@ static const struct Curl_handler Curl_handler_imap_proxy = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_IMAP, /* defport */
- PROT_HTTP, /* protocol */
+ CURLPROTO_HTTP, /* protocol */
PROTOPT_NONE /* flags */
};
@@ -200,7 +200,7 @@ static const struct Curl_handler Curl_handler_imaps_proxy = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_IMAPS, /* defport */
- PROT_HTTP, /* protocol */
+ CURLPROTO_HTTP, /* protocol */
PROTOPT_NONE /* flags */
};
#endif
@@ -621,7 +621,7 @@ static CURLcode imap_multi_statemach(struct connectdata *conn,
struct imap_conn *imapc = &conn->proto.imapc;
CURLcode result;
- if((conn->handler->protocol & PROT_IMAPS) && !imapc->ssldone) {
+ if((conn->handler->protocol & CURLPROTO_IMAPS) && !imapc->ssldone) {
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &imapc->ssldone);
}
else {
@@ -738,7 +738,7 @@ static CURLcode imap_connect(struct connectdata *conn,
}
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
- if((conn->handler->protocol & PROT_IMAPS) &&
+ if((conn->handler->protocol & CURLPROTO_IMAPS) &&
data->state.used_interface != Curl_if_multi) {
/* BLOCKING */
/* IMAPS is simply imap with SSL for the control channel */
diff --git a/lib/openldap.c b/lib/openldap.c
index 386f796e5..ec723beb2 100644
--- a/lib/openldap.c
+++ b/lib/openldap.c
@@ -83,7 +83,7 @@ const struct Curl_handler Curl_handler_ldap = {
ZERO_NULL, /* perform_getsock */
ldap_disconnect, /* disconnect */
PORT_LDAP, /* defport */
- PROT_LDAP, /* protocol */
+ CURLPROTO_LDAP, /* protocol */
PROTOPT_NONE /* flags */
};
@@ -106,7 +106,7 @@ const struct Curl_handler Curl_handler_ldaps = {
ZERO_NULL, /* perform_getsock */
ldap_disconnect, /* disconnect */
PORT_LDAPS, /* defport */
- PROT_LDAP, /* protocol */
+ CURLPROTO_LDAP, /* protocol */
PROTOPT_SSL /* flags */
};
#endif
diff --git a/lib/pop3.c b/lib/pop3.c
index 2c1cc00c3..a5447e4f3 100644
--- a/lib/pop3.c
+++ b/lib/pop3.c
@@ -128,7 +128,7 @@ const struct Curl_handler Curl_handler_pop3 = {
ZERO_NULL, /* perform_getsock */
pop3_disconnect, /* disconnect */
PORT_POP3, /* defport */
- PROT_POP3, /* protocol */
+ CURLPROTO_POP3, /* protocol */
PROTOPT_CLOSEACTION /* flags */
};
@@ -152,7 +152,7 @@ const struct Curl_handler Curl_handler_pop3s = {
ZERO_NULL, /* perform_getsock */
pop3_disconnect, /* disconnect */
PORT_POP3S, /* defport */
- PROT_POP3 | PROT_POP3S, /* protocol */
+ CURLPROTO_POP3 | CURLPROTO_POP3S, /* protocol */
PROTOPT_CLOSEACTION | PROTOPT_SSL /* flags */
};
#endif
@@ -176,7 +176,7 @@ static const struct Curl_handler Curl_handler_pop3_proxy = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_POP3, /* defport */
- PROT_HTTP, /* protocol */
+ CURLPROTO_HTTP, /* protocol */
PROTOPT_NONE /* flags */
};
@@ -200,7 +200,7 @@ static const struct Curl_handler Curl_handler_pop3s_proxy = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_POP3S, /* defport */
- PROT_HTTP, /* protocol */
+ CURLPROTO_HTTP, /* protocol */
PROTOPT_NONE /* flags */
};
#endif
@@ -641,7 +641,7 @@ static CURLcode pop3_connect(struct connectdata *conn,
}
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
- if(conn->handler->protocol & PROT_POP3S) {
+ if(conn->handler->protocol & CURLPROTO_POP3S) {
/* BLOCKING */
/* POP3S is simply pop3 with SSL for the control channel */
/* now, perform the SSL initialization for this socket */
diff --git a/lib/rtsp.c b/lib/rtsp.c
index baf561ff0..c39ae011e 100644
--- a/lib/rtsp.c
+++ b/lib/rtsp.c
@@ -96,7 +96,7 @@ const struct Curl_handler Curl_handler_rtsp = {
ZERO_NULL, /* perform_getsock */
Curl_rtsp_disconnect, /* disconnect */
PORT_RTSP, /* defport */
- PROT_RTSP, /* protocol */
+ CURLPROTO_RTSP, /* protocol */
PROTOPT_NONE /* flags */
};
diff --git a/lib/sendf.c b/lib/sendf.c
index d9e7dbb90..ab79a8080 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -441,7 +441,7 @@ CURLcode Curl_client_write(struct connectdata *conn,
}
if(type & CLIENTWRITE_BODY) {
- if((conn->handler->protocol&PROT_FTP) &&
+ if((conn->handler->protocol&CURLPROTO_FTP) &&
conn->proto.ftpc.transfertype == 'A') {
#ifdef CURL_DOES_CONVERSIONS
/* convert from the network encoding */
diff --git a/lib/smtp.c b/lib/smtp.c
index cfd4d981c..ff0d288c7 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -135,7 +135,7 @@ const struct Curl_handler Curl_handler_smtp = {
ZERO_NULL, /* perform_getsock */
smtp_disconnect, /* disconnect */
PORT_SMTP, /* defport */
- PROT_SMTP, /* protocol */
+ CURLPROTO_SMTP, /* protocol */
PROTOPT_CLOSEACTION /* flags */
};
@@ -159,7 +159,7 @@ const struct Curl_handler Curl_handler_smtps = {
ZERO_NULL, /* perform_getsock */
smtp_disconnect, /* disconnect */
PORT_SMTPS, /* defport */
- PROT_SMTP | PROT_SMTPS, /* protocol */
+ CURLPROTO_SMTP | CURLPROTO_SMTPS, /* protocol */
PROTOPT_CLOSEACTION | PROTOPT_SSL /* flags */
};
#endif
@@ -183,7 +183,7 @@ static const struct Curl_handler Curl_handler_smtp_proxy = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_SMTP, /* defport */
- PROT_HTTP, /* protocol */
+ CURLPROTO_HTTP, /* protocol */
PROTOPT_NONE /* flags */
};
@@ -207,7 +207,7 @@ static const struct Curl_handler Curl_handler_smtps_proxy = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_SMTPS, /* defport */
- PROT_HTTP, /* protocol */
+ CURLPROTO_HTTP, /* protocol */
PROTOPT_NONE /* flags */
};
#endif
@@ -1105,7 +1105,7 @@ static CURLcode smtp_connect(struct connectdata *conn,
}
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
- if(conn->handler->protocol & PROT_SMTPS) {
+ if(conn->handler->protocol & CURLPROTO_SMTPS) {
/* BLOCKING */
/* SMTPS is simply smtp with SSL for the control channel */
/* now, perform the SSL initialization for this socket */
diff --git a/lib/ssh.c b/lib/ssh.c
index 1551ea910..f760d84ba 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -175,7 +175,7 @@ const struct Curl_handler Curl_handler_scp = {
ssh_perform_getsock, /* perform_getsock */
scp_disconnect, /* disconnect */
PORT_SSH, /* defport */
- PROT_SCP, /* protocol */
+ CURLPROTO_SCP, /* protocol */
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION /* flags */
};
@@ -198,7 +198,7 @@ const struct Curl_handler Curl_handler_sftp = {
ssh_perform_getsock, /* perform_getsock */
sftp_disconnect, /* disconnect */
PORT_SSH, /* defport */
- PROT_SFTP, /* protocol */
+ CURLPROTO_SFTP, /* protocol */
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION /* flags */
};
@@ -413,7 +413,7 @@ static CURLcode ssh_getworkingpath(struct connectdata *conn,
return CURLE_OUT_OF_MEMORY;
/* Check for /~/ , indicating relative to the user's home directory */
- if(conn->handler->protocol & PROT_SCP) {
+ if(conn->handler->protocol & CURLPROTO_SCP) {
real_path = malloc(working_path_len+1);
if(real_path == NULL) {
free(working_path);
@@ -425,7 +425,7 @@ static CURLcode ssh_getworkingpath(struct connectdata *conn,
else
memcpy(real_path, working_path, 1 + working_path_len);
}
- else if(conn->handler->protocol & PROT_SFTP) {
+ else if(conn->handler->protocol & CURLPROTO_SFTP) {
if((working_path_len > 1) && (working_path[1] == '~')) {
size_t homelen = strlen(homedir);
real_path = malloc(homelen + working_path_len + 1);
@@ -933,7 +933,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
conn->sockfd = sock;
conn->writesockfd = CURL_SOCKET_BAD;
- if(conn->handler->protocol == PROT_SFTP) {
+ if(conn->handler->protocol == CURLPROTO_SFTP) {
state(conn, SSH_SFTP_INIT);
break;
}
@@ -2568,7 +2568,7 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done)
if(result)
return result;
- if(conn->handler->protocol & PROT_SCP) {
+ if(conn->handler->protocol & CURLPROTO_SCP) {
conn->recv[FIRSTSOCKET] = scp_recv;
conn->send[FIRSTSOCKET] = scp_send;
} else {
@@ -2717,7 +2717,7 @@ static CURLcode ssh_do(struct connectdata *conn, bool *done)
Curl_pgrsSetUploadSize(data, 0);
Curl_pgrsSetDownloadSize(data, 0);
- if(conn->handler->protocol & PROT_SCP)
+ if(conn->handler->protocol & CURLPROTO_SCP)
res = scp_perform(conn, &connected, done);
else
res = sftp_perform(conn, &connected, done);
diff --git a/lib/telnet.c b/lib/telnet.c
index a716a556d..1a76b8b88 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -196,7 +196,7 @@ const struct Curl_handler Curl_handler_telnet = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
PORT_TELNET, /* defport */
- PROT_TELNET, /* protocol */
+ CURLPROTO_TELNET, /* protocol */
PROTOPT_NONE /* flags */
};
diff --git a/lib/tftp.c b/lib/tftp.c
index a70ceac24..ff59acadd 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -196,7 +196,7 @@ const struct Curl_handler Curl_handler_tftp = {
ZERO_NULL, /* perform_getsock */
tftp_disconnect, /* disconnect */
PORT_TFTP, /* defport */
- PROT_TFTP, /* protocol */
+ CURLPROTO_TFTP, /* protocol */
PROTOPT_NONE /* flags */
};
diff --git a/lib/transfer.c b/lib/transfer.c
index 8302396f8..266b83441 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -125,7 +125,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
#ifdef CURL_DOES_CONVERSIONS
bool sending_http_headers = FALSE;
- if((conn->protocol&(PROT_HTTP|PROT_RTSP)) &&
+ if((conn->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) &&
(data->state.proto.http->sending == HTTPSEND_REQUEST)) {
/* We're sending the HTTP request headers, not the data.
Remember that so we don't re-translate them into garbage. */
@@ -322,7 +322,7 @@ static int data_pending(const struct connectdata *conn)
{
/* in the case of libssh2, we can never be really sure that we have emptied
its internal buffers so we MUST always try until we get EAGAIN back */
- return conn->handler->protocol&(PROT_SCP|PROT_SFTP) ||
+ return conn->handler->protocol&(CURLPROTO_SCP|CURLPROTO_SFTP) ||
Curl_ssl_data_pending(conn, FIRSTSOCKET);
}
@@ -469,7 +469,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
#ifndef CURL_DISABLE_RTSP
/* Check for RTP at the beginning of the data */
- if(conn->handler->protocol & PROT_RTSP) {
+ if(conn->handler->protocol & CURLPROTO_RTSP) {
result = Curl_rtsp_rtp_readwrite(data, conn, &nread, &readmore);
if(result)
return result;
@@ -491,7 +491,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
#ifndef CURL_DISABLE_RTSP
/* Check for RTP after the headers if there is no Content */
if(k->maxdownload <= 0 && nread > 0 &&
- (conn->handler->protocol & PROT_RTSP)) {
+ (conn->handler->protocol & CURLPROTO_RTSP)) {
result = Curl_rtsp_rtp_readwrite(data, conn, &nread, &readmore);
if(result)
return result;
@@ -517,7 +517,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
if(0 == k->bodywrites && !is_empty_data) {
/* These checks are only made the first time we are about to
write a piece of the body */
- if(conn->handler->protocol&(PROT_HTTP|PROT_RTSP)) {
+ if(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) {
/* HTTP-only checks */
if(data->req.newurl) {
@@ -704,7 +704,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
if(!k->ignorebody) {
#ifndef CURL_DISABLE_POP3
- if(conn->handler->protocol&PROT_POP3)
+ if(conn->handler->protocol&CURLPROTO_POP3)
result = Curl_pop3_write(conn, k->str, nread);
else
#endif /* CURL_DISABLE_POP3 */
@@ -747,7 +747,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
#ifndef CURL_DISABLE_RTSP
if(excess > 0 && !conn->bits.stream_was_rewound &&
- (conn->handler->protocol & PROT_RTSP)) {
+ (conn->handler->protocol & CURLPROTO_RTSP)) {
/* Check for RTP after the content if there is unrewound excess */
/* Parse the excess data */
@@ -835,7 +835,7 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
break;
}
- if(conn->handler->protocol&(PROT_HTTP|PROT_RTSP)) {
+ if(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) {
if(data->state.proto.http->sending == HTTPSEND_REQUEST)
/* We're sending the HTTP request headers, not the data.
Remember that so we don't change the line endings. */
@@ -873,7 +873,7 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
data->req.upload_present = nread;
#ifndef CURL_DISABLE_SMTP
- if(conn->handler->protocol & PROT_SMTP) {
+ if(conn->handler->protocol & CURLPROTO_SMTP) {
result = Curl_smtp_escape_eob(conn, nread);
if(result)
return result;
@@ -2060,7 +2060,8 @@ CURLcode Curl_retry_request(struct connectdata *conn,
/* if we're talking upload, we can't do the checks below, unless the protocol
is HTTP as when uploading over HTTP we will still get a response */
- if(data->set.upload && !(conn->handler->protocol&(PROT_HTTP|PROT_RTSP)))
+ if(data->set.upload &&
+ !(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)))
return CURLE_OK;
if(/* workaround for broken TLS servers */ data->state.ssl_connect_retry ||
diff --git a/lib/url.c b/lib/url.c
index e9a7f4a17..5faefd931 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -766,9 +766,9 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
/* for the *protocols fields we don't use the CURLPROTO_ALL convenience
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 = PROT_ALL;
+ set->allowed_protocols = CURLPROTO_ALL;
set->redir_protocols =
- PROT_ALL & ~(CURLPROTO_FILE|CURLPROTO_SCP); /* not FILE or SCP */
+ CURLPROTO_ALL & ~(CURLPROTO_FILE|CURLPROTO_SCP); /* not FILE or SCP */
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
/*
@@ -2774,7 +2774,7 @@ static bool RTSPConnIsDead(struct connectdata *check)
static bool IsPipeliningPossible(const struct SessionHandle *handle,
const struct connectdata *conn)
{
- if((conn->handler->protocol & PROT_HTTP) &&
+ if((conn->handler->protocol & CURLPROTO_HTTP) &&
handle->multi && Curl_multi_canPipeline(handle->multi) &&
(handle->set.httpreq == HTTPREQ_GET ||
handle->set.httpreq == HTTPREQ_HEAD) &&
@@ -2932,7 +2932,7 @@ ConnectionExists(struct SessionHandle *data,
use */
bool dead;
#ifndef CURL_DISABLE_RTSP
- if(check->handler->protocol & PROT_RTSP)
+ if(check->handler->protocol & CURLPROTO_RTSP)
/* RTSP is a special case due to RTP interleaving */
dead = RTSPConnIsDead(check);
else
@@ -3055,8 +3055,8 @@ ConnectionExists(struct SessionHandle *data,
continue;
}
}
- if((needle->handler->protocol & PROT_FTP) ||
- ((needle->handler->protocol & PROT_HTTP) &&
+ if((needle->handler->protocol & CURLPROTO_FTP) ||
+ ((needle->handler->protocol & CURLPROTO_HTTP) &&
(data->state.authhost.want==CURLAUTH_NTLM))) {
/* This is FTP or HTTP+NTLM, verify that we're using the same name
and password as well */
@@ -4507,7 +4507,7 @@ static CURLcode set_userpass(struct connectdata *conn,
const char *user, const char *passwd)
{
/* If our protocol needs a password and we have none, use the defaults */
- if( (conn->handler->protocol & (PROT_FTP|PROT_IMAP)) &&
+ if( (conn->handler->protocol & (CURLPROTO_FTP|CURLPROTO_IMAP)) &&
!conn->bits.user_passwd) {
conn->user = strdup(CURL_DEFAULT_USER);
@@ -4879,7 +4879,7 @@ static CURLcode create_conn(struct SessionHandle *data,
* file: is a special case in that it doesn't need a network connection
***********************************************************************/
#ifndef CURL_DISABLE_FILE
- if(conn->handler->protocol & PROT_FILE) {
+ if(conn->handler->protocol & CURLPROTO_FILE) {
bool done;
/* this is supposed to be the connect function so we better at least check
that the file is present here! */
@@ -5039,7 +5039,7 @@ static CURLcode setup_conn(struct connectdata *conn,
Curl_pgrsTime(data, TIMER_NAMELOOKUP);
- if(conn->handler->protocol & PROT_FILE) {
+ if(conn->handler->protocol & CURLPROTO_FILE) {
/* There's nothing in this function to setup if we're only doing
a file:// transfer */
*protocol_done = TRUE;
diff --git a/lib/urldata.h b/lib/urldata.h
index 20cce14a4..7588cedc5 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -695,10 +695,22 @@ struct Curl_handler {
CURLcode (*disconnect)(struct connectdata *, bool dead_connection);
long defport; /* Default port. */
- unsigned int protocol; /* PROT_* flags concerning the protocol set */
+ unsigned int protocol; /* See CURLPROTO_* */
unsigned int flags; /* Extra particular characteristics, see PROTOPT_* */
};
+#define PROTOPT_NONE 0 /* nothing extra */
+#define PROTOPT_SSL (1<<0) /* uses SSL */
+#define PROTOPT_DUAL (1<<1) /* this protocol uses two connections */
+#define PROTOPT_CLOSEACTION (1<<2) /* need action before socket close */
+/* some protocols will have to call the underlying functions without regard to
+ what exact state the socket signals. IE even if the socket says "readable",
+ the send function might need to be called while uploading, or vice versa.
+*/
+#define PROTOPT_DIRLOCK (1<<3)
+#define PROTOPT_BANPROXY (1<<4) /* not allowed to use proxy */
+
+
/* return the count of bytes sent, or -1 on error */
typedef ssize_t (Curl_send)(struct connectdata *conn, /* connection data */
int sockindex, /* socketindex */
@@ -737,45 +749,6 @@ struct connectdata {
long connectindex; /* what index in the connection cache connects index this
particular struct has */
-#define PROT_HTTP CURLPROTO_HTTP
-#define PROT_HTTPS CURLPROTO_HTTPS
-#define PROT_FTP CURLPROTO_FTP
-#define PROT_TELNET CURLPROTO_TELNET
-#define PROT_DICT CURLPROTO_DICT
-#define PROT_LDAP CURLPROTO_LDAP
-#define PROT_FILE CURLPROTO_FILE
-#define PROT_FTPS CURLPROTO_FTPS
-#define PROT_TFTP CURLPROTO_TFTP
-#define PROT_SCP CURLPROTO_SCP
-#define PROT_SFTP CURLPROTO_SFTP
-#define PROT_IMAP CURLPROTO_IMAP
-#define PROT_IMAPS CURLPROTO_IMAPS
-#define PROT_POP3 CURLPROTO_POP3
-#define PROT_POP3S CURLPROTO_POP3S
-#define PROT_SMTP CURLPROTO_SMTP
-#define PROT_SMTPS CURLPROTO_SMTPS
-#define PROT_RTSP CURLPROTO_RTSP
-#define PROT_RTMP CURLPROTO_RTMP
-#define PROT_RTMPT CURLPROTO_RTMPT
-#define PROT_RTMPE CURLPROTO_RTMPE
-#define PROT_RTMPTE CURLPROTO_RTMPTE
-#define PROT_RTMPS CURLPROTO_RTMPS
-#define PROT_RTMPTS CURLPROTO_RTMPTS
-#define PROT_GOPHER CURLPROTO_GOPHER
-
-#define PROT_ALL ~0
-
-#define PROTOPT_NONE 0 /* nothing extra */
-#define PROTOPT_SSL (1<<0) /* uses SSL */
-#define PROTOPT_DUAL (1<<1) /* this protocol uses two connections */
-#define PROTOPT_CLOSEACTION (1<<2) /* need action before socket close */
-/* some protocols will have to call the underlying functions without regard to
- what exact state the socket signals. IE even if the socket says "readable",
- the send function might need to be called while uploading, or vice versa.
-*/
-#define PROTOPT_DIRLOCK (1<<3)
-#define PROTOPT_BANPROXY (1<<4) /* not allowed to use proxy */
-
/* 'dns_entry' is the particular host we use. This points to an entry in the
DNS cache and it will not get pruned while locked. It gets unlocked in
Curl_done(). This entry will be NULL if the connection is re-used as then