curl-library
Re: CURLPROXY_HTTP_1_0 does not affect protocol version (still HTTP/1.1)
Date: Thu, 21 Apr 2011 11:58:01 +0400
* Daniel Stenberg <daniel_at_haxx.se> [Wed, 20 Apr 2011 15:45:14 +0200
(CEST)]:
> If we should make it a new proxy type now? Is it really worth
> the bother? I mean existing apps already use it like this and
> we need to support the current approach until we break the
> ABI (years in the future) anyway. The question is then if we
> gain anything by introducing a second way, albeit possibly
> somewhat more logical.
For me it does not look like introducing the second way of doing things.
Rather, it is like introducing a straight path of doing things instead
of using a historical detour route.
We do not set an extra option (like, say, CURLOPT_SOCKSPROXY_FLAVOUR) to
select between SOCKS4 and SOCKS4A, right?
As for breaking existing ABI: we can leave CURLOPT_HTTPPROXYTUNNEL
option in the ABI for compatibility reasons, although mark it as
"obsolete" or "deprecated" in the documentation. Thus, the ABI will not
be broken. Inside libcurl, calls to CURLOPT_HTTPPROXYTUNNEL will be
silently translated into setting appropriate proxy type in the handle.
When an existing application sets CURLOPT_HTTPPROXYTUNNEL option,
curl_*_setopt() also sets an appropriate proxy type.
If the application then sets CURLOPT_PROXYTYPE, curl_*_setopt() takes
into account that the tunnel has been requested, assumes that the
application is using legacy ABI, and translates HTTP or HTTP_1_0 proxy
type to its tunnelling version.
If the application does not set PROXYTUNNEL, proxy types are not
translated by curl_*_setopt() (new ABI is used).
This will leave the ABI compatible with the older versions. Well, almost
compatible... For maximum compatibility, we could also translate proxy
types in curl_*_getinfo().
The translation itself is trivial.
For curl_*_setopt( CURLOPT_PROXYTYPE ):
- if HTTPPROXYTUNNEL is not set, do not change proxy type.
- if PROXYTYPE is CURLPROXY_HTTP, translate to CURLPROXY_HTTPTUNNEL
(or how we agree to name it)
- if PROXYTYPE is CURLPROXY_HTTP_1_0, translate to
CURLPROXY_HTTPTUNNEL_1_0
For curl_*_setopt( CURLOPT_HTTPPROXYTUNNEL ):
- if HTTPPROXYTUNNEL is being set, also set the proxy type to
CURLPROXY_HTTPTUNNEL.
- if it is being cleared, set proxy type to CURLPROXY_HTTP.
For curl_*_getinfo( CURLOPT_PROXYTYPE ):
- if HTTPPROXYTUNNEL is not set, return proxy type as is (no legacy
ABI used).
- if PROXYTYPE is TUNNEL, return CURLPROXY_HTTP
- if PROXYTYPE is TUNNEL_1_0, return CURLPROXY_HTTP_1_0
-- Best regards. ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2011-04-21