diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-03-14 22:22:22 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-03-14 22:22:22 +0100 |
commit | 8831000bc07de463d277975a3ddfb6a31dcf14b4 (patch) | |
tree | 0313bc919a3ee27021c352e9efad38ad8c62407e /lib/pop3.c | |
parent | ed8749e308a9ed0da49ad46b8b2ba5e8aae80244 (diff) |
protocol handler: added flags field
The protocol handler struct got a 'flags' field for special information
and characteristics of the given protocol.
This now enables us to move away central protocol information such as
CLOSEACTION and DUALCHANNEL from single defines in a central place, out
to each protocol's definition. It also made us stop abusing the protocol
field for other info than the protocol, and we could start cleaning up
other protocol-specific things by adding flags bits to set in the
handler struct.
The "protocol" field connectdata struct was removed as well and the code
now refers directly to the conn->handler->protocol field instead. To
make things work properly, the code now always store a conn->given
pointer that points out the original handler struct so that the code can
learn details from the original protocol even if conn->handler is
modified along the way - for example when switching to go over a HTTP
proxy.
Diffstat (limited to 'lib/pop3.c')
-rw-r--r-- | lib/pop3.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/pop3.c b/lib/pop3.c index 9f6744363..2c1cc00c3 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -128,7 +128,8 @@ const struct Curl_handler Curl_handler_pop3 = { ZERO_NULL, /* perform_getsock */ pop3_disconnect, /* disconnect */ PORT_POP3, /* defport */ - PROT_POP3 /* protocol */ + PROT_POP3, /* protocol */ + PROTOPT_CLOSEACTION /* flags */ }; @@ -151,7 +152,8 @@ const struct Curl_handler Curl_handler_pop3s = { ZERO_NULL, /* perform_getsock */ pop3_disconnect, /* disconnect */ PORT_POP3S, /* defport */ - PROT_POP3 | PROT_POP3S | PROT_SSL /* protocol */ + PROT_POP3 | PROT_POP3S, /* protocol */ + PROTOPT_CLOSEACTION | PROTOPT_SSL /* flags */ }; #endif @@ -174,7 +176,8 @@ static const struct Curl_handler Curl_handler_pop3_proxy = { ZERO_NULL, /* perform_getsock */ ZERO_NULL, /* disconnect */ PORT_POP3, /* defport */ - PROT_HTTP /* protocol */ + PROT_HTTP, /* protocol */ + PROTOPT_NONE /* flags */ }; @@ -197,7 +200,8 @@ static const struct Curl_handler Curl_handler_pop3s_proxy = { ZERO_NULL, /* perform_getsock */ ZERO_NULL, /* disconnect */ PORT_POP3S, /* defport */ - PROT_HTTP /* protocol */ + PROT_HTTP, /* protocol */ + PROTOPT_NONE /* flags */ }; #endif #endif @@ -288,7 +292,7 @@ static CURLcode pop3_state_starttls_resp(struct connectdata *conn, /* Curl_ssl_connect is BLOCKING */ result = Curl_ssl_connect(conn, FIRSTSOCKET); if(CURLE_OK == result) { - conn->protocol |= PROT_POP3S; + conn->handler = &Curl_handler_pop3s; result = pop3_state_user(conn); } } @@ -637,7 +641,7 @@ static CURLcode pop3_connect(struct connectdata *conn, } #endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */ - if(conn->protocol & PROT_POP3S) { + if(conn->handler->protocol & PROT_POP3S) { /* BLOCKING */ /* POP3S is simply pop3 with SSL for the control channel */ /* now, perform the SSL initialization for this socket */ |