diff --git a/lib/curl_rtmp.c b/lib/curl_rtmp.c
index 183db0dedc6c56ded8e6699faa098d434780cac0..bae8a76c06b0203e659deddb2dc4f644cdbde02f 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 750f728e9cc63c7d27dd11edccfdb131f6b5c487..e079fd1884a6e89cd095c99a3dc661408584483f 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 52c175f10d533fbc428d6db507fd8f08fa879197..ad671233cc7bf61d20acd31721f25bb2f3a9a7ae 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 be7cc239833441ac62893bbe445c751fc8baf259..6b4381909418d1fe93d1671b26ca7da12f75200c 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 70a3f06bf9cb472289d6bf8b055b82f33e040c32..6718bafb1e2ff3bdd3d81a5ab3ba861c44303aab 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 2a74066b05a7676eb37d76ea2cb7d8a5a87652f1..01a78a977d18437b0225d783ca35ae43e2440866 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 12af795538edc24f20e00a3d901ab79a3f2a2fe2..6ba66577032b2ca1bc2f42825098b2507eb572f5 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 386f796e5d52eb832d37fbae281eb623af027197..ec723beb209a40048c74389a873b1baab4c77d7e 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 2c1cc00c374b2179aef996caa2a4c86a18237c96..a5447e4f3db96e1dca3217dc75db2c21246417a1 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 baf561ff0a4df6965005d714fe2ecd9b04fe2f9e..c39ae011e803de753c4e5a75c5f8d89206b5a37d 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 d9e7dbb90e469a31263537892a834b7744e73387..ab79a8080fb27b3c79613aed8c83c8eec50a23fb 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 cfd4d981cb1c1705a69f2944975e7a555ec7ffe2..ff0d288c7d63001857ec8f4ab45fdc955ef0bbce 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 1551ea9102006e46b0d5dac6fa8297e722bf9d63..f760d84bae9d9c32f743b6ceee9d36eca8ddc5a6 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 a716a556debe3e6e27494cb2d77393c728190277..1a76b8b889be1f677efda9ff8fcded443defee94 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 a70ceac246f273c0e1d26ebda4b4ed910c065819..ff59acadde43d83cffddf17f44732fcc5f7c0a11 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 8302396f8057bc185ee2eac2ac9e7768f5803990..266b83441717a511bb99f47d09b9b2bba88bc0ba 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 e9a7f4a170c56e190b3a400a8e710e2ab31feb8a..5faefd931fce1c3588867168bbaebfeee886290c 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 20cce14a4a5543c2673a7cdcda1e87343391f6e2..7588cedc55c1060c5395926ce1edb8d73a792899 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