cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Is curl suitable for iOS/Android when http proxy is used

From: Cédric Deltheil <cedric_at_moodstocks.com>
Date: Fri, 15 Jan 2016 13:57:25 +0100

On Fri, Jan 15, 2016, at 01:25 PM, JOHAN LANTZ wrote:
> My doubt at this moment is how devices using a http proxy would work.
> I have not confirmed it but I would assume that if you use the native
> API’s from Apple, the proxy would be taken care of by default while if
> we use curl we would be forced to ask the
 user to manually provide a password, something I guess most users don’t
 know how to do or would be reluctant to doing.

From what I experienced on iOS I do confirm you need to explicitly set
the proxy via ad-hoc `curl_easy_setopt` API calls, like:

curl_easy_setopt(handle, CURLOPT_PROXY, host);
curl_easy_setopt(handle, CURLOPT_PROXYPORT, port);

The good news is that it is possible (to some extent) to auto-detect the
proxy settings via dedicated CoreFoundation API-s, e.g. you can detect
if 1/ there is no HTTP proxy configured, 2/ there is an HTTP proxy
manually configured, and 3/ there is an HTTP proxy automatically
configured with a PAC file URL (that you must then fetch).

You can also check if the proxy is authenticated and get the username.
But you cannot obtain the password: so in such a case you would need a
custom UI prompt.

All of these auto-detected settings should be set at libcurl level as
explained above.

Hope that helps, Cédric

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2016-01-15