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.
This commit is contained in:
Daniel Stenberg
2011-03-14 22:52:14 +01:00
parent 8831000bc0
commit 13b64d7558
18 changed files with 94 additions and 120 deletions

View File

@@ -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 ||