Discussion:
Setting proxy type using CURLOPT_PROXY?
Tillmann Steinbrecher
2006-08-23 12:38:12 UTC
Permalink
Hi,

the documentation is a bit unclear about setting the proxy
protocol using CURLOPT_PROXY. First, it states:
"The proxy string may be prefixed with [protocol]:// since any such
prefix will be ignored", which is clear, but later, it says:
"Starting with 7.14.1, the proxy host string can be specified the exact
same way as the proxy environment variables, include protocol prefix"

I'm not sure what to make of it. Can I set the proxy protocol this way,
or can I not?

For convenience, I want to specify the entire proxy configuration in one
string (e.g. read from config file). Does this work:
curl_easy_setopt(curl, CURLOPT_PROXY,
"socks5://user:***@gatekeeper.mycompany.net");

Or do I have to check manually if the string starts with "socks5" or
whatever, and then use CURLOPT_PROXYTYPE? Even if I have to do so, is it
safe to assume that - even in future versions - libcurl will not be
confused if the protocol is a string it doesn't know (e.g. "socks5")?

bye,
Tillmann
Daniel Stenberg
2006-08-23 21:48:58 UTC
Permalink
Post by Tillmann Steinbrecher
the documentation is a bit unclear about setting the proxy
"The proxy string may be prefixed with [protocol]:// since any such
"Starting with 7.14.1, the proxy host string can be specified the exact
same way as the proxy environment variables, include protocol prefix"
I'm not sure what to make of it. Can I set the proxy protocol this way, or
can I not?
You could just try and see if it works! ;-)

But yes, the second paragraph is very confusingly written and I've just
changed it to instead say:

Starting with 7.14.1, the proxy host string given in environment
variables can be specified the exact same way as the proxy can
be set with CURLOPT_PROXY: to include protocol prefix (http://) and
embedded user + password.
Post by Tillmann Steinbrecher
For convenience, I want to specify the entire proxy configuration in one
string (e.g. read from config file). Does this work: curl_easy_setopt(curl,
Yes it should work except for that libcurl won't detect the type of the proxy
based on the given string.
Post by Tillmann Steinbrecher
Or do I have to check manually if the string starts with "socks5" or
whatever, and then use CURLOPT_PROXYTYPE?
Yes you do. I don't think socks5:// is any standard prefix for this, is it?
Post by Tillmann Steinbrecher
Even if I have to do so, is it safe to assume that - even in future versions
- libcurl will not be confused if the protocol is a string it doesn't know
(e.g. "socks5")?
It is safe that it will continue to ignore the protocol part of _PROXY strings
as suddenly starting to care about it will break lots of existing apps and I
make an effort in introducing changes in manners that don't do that.
--
Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Dan Fandrich
2006-08-23 22:07:43 UTC
Permalink
Post by Daniel Stenberg
It is safe that it will continue to ignore the protocol part of _PROXY
strings as suddenly starting to care about it will break lots of existing
apps and I make an effort in introducing changes in manners that don't do
that.
Are you keeping a list of such changes that would be nice to make when it
becomes safe to do so? Every once in a while a nice clean-up item like
this comes up on the list, but it's too disruptive to make. If it ever
becomes necessary to break backward compatibility and move to libcurl.so.4,
all of these kind of changes could be done in one go.
Post by Daniel Stenberg
Dan
--
http://www.MoveAnnouncer.com The web change of address service
Let webmasters know that your web site has moved
Daniel Stenberg
2006-08-24 06:27:23 UTC
Permalink
Post by Dan Fandrich
Are you keeping a list of such changes that would be nice to make when it
becomes safe to do so?
Not really. And I think it is harder than it sounds like, since most of this
kind of changes will have their pros and cons depending on different people.
Post by Dan Fandrich
Every once in a while a nice clean-up item like this comes up on the list,
but it's too disruptive to make. If it ever becomes necessary to break
backward compatibility and move to libcurl.so.4, all of these kind of
changes could be done in one go.
I've gathered a few loose ideas in the "NEXT MAJOR RELEASE" section at the
bottom of the TODO document, but they're far from set in stone.
--
Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Loading...