cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: POP3 not using same connection for multiple requests when using starttls

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 3 Nov 2011 11:08:35 +0100 (CET)

On Wed, 2 Nov 2011, Steve Holme wrote:

> I have attempted to debug libcurl and the problem appears to be in url.c in
> the ConnectionExists() function when it is trying to determine if an
> existing connection should be reused. A fair way through the function it
> checks an existing connection's handler flags against the new connection's
> handler flags to see if the SSL flag is the same:
>
> if((needle->handler->flags&PROTOPT_SSL) !=
> (check->handler->flags&PROTOPT_SSL))
> /* don't do mixed SSL and non-SSL connections */
> continue;

Yes, this is indeed the culprit of this problem you see. The problem for
libcurl here is that the "raw" pop3 protocol has no SSL, but it will be
updated at run-time with STARTTLS to feature it (and when libcurl switches to
the TLS version, it changes the handler pointer to point to the pop3s struct
which _has_ the SSL bit set).

Therefore, the handler->flags's PROTOPT_SSL bit is not enough to use for this
check!

> Because I am not too familiar with this area of code I was wondering if
> there is any way of performing an additional check on new connection to see
> if it is about to enter SSL mode and if so don't move on to the next item in
> the loop but instead continue checking the rest of the criteria needed to
> return the correct reuse value?

Yes, we should be able to extend that check so that requests that are "plain
text but STARTTLS-requested" would match and be able to re-use the connections
that are already STARTTLS'ed.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-11-03