cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Curl and transparent proxies (e.g. Squid)

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 2 Jul 2014 22:26:36 +0200

On Wed, Jul 02, 2014 at 10:57:47AM +0200, gerd_roethig_at_web.de wrote:
> I already did quite some research on various sources in the net but was not
> able to find anything helpful for my particular problem.
>
> The screnario is that I have some client PCs in a network behind a transparent
> proxy (squid/3.1.12).
>
> Everything works fine using a browser set to "automatically detect network
> settings". Interestingly, if I set the browser to "no proxy" as I would have
> expected to be possible when using transparent proxies, the browser is not able
> to get anything from the web.

Are you sure it's a transparent proxy then? A browser set to automatically
detect proxies is likely to do so using DHCP or WPAD.

> But how do I configure curl in this scenario?

curl doesn't support either of those natively, so some kind of application
helper would need to be used to detect the actual proxy being used and
configure curl to use it. If the proxy is configured with a .pac file, this
becomes difficult because the proxy used could be different for each URL.

> If I omit proxy settings entirely, I get a "connection refused" error on every
> URL I want to access.
> If I provide the proxy address and port with the -proxy option, I get the
> following:
>
> E:\apps\flash>curl -x 10.10.10.10:80 -v http://www.heise.de/newsticker/
> * About to connect() to proxy 10.10.10.10 port 80 (#0)
> * Trying 10.10.10.10...
> * Connected to 10.10.10.10 (10.10.10.10) port 80 (#0)
> > GET http://www.heise.de/newsticker/ HTTP/1.1
> > User-Agent: curl/7.29.0
> > Host: www.heise.de
> > Accept: */*
> > Proxy-Connection: Keep-Alive
> >
> < HTTP/1.1 404 Not Found

This looks like it's not a proxy server, but a regular web server.

> What settings do I have to provide to curl so that it can handle that
> transparent proxy properly?

It doesn't look like a transparent proxy situation to me.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-07-02