cURL / Mailing Lists / curl-users / Single Mail

curl-users

Curl and transparent proxies (e.g. Squid)

From: <gerd_roethig_at_web.de>
Date: Wed, 2 Jul 2014 10:57:47 +0200
Hello all and best greetings,
 
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.
 
But how do I configure curl in this scenario?
 
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
< Date: Wed, 02 Jul 2014 08:55:07 GMT
< Server: Apache/2.2.12 (Linux/SUSE)
< Vary: accept-language,accept-charset
< Accept-Ranges: bytes
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=iso-8859-1
< Content-Language: en
<
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Object not found!</title>
<link rev="made" href="mailto:%5bno%20address%20given%5d" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
    body { color: #000000; background-color: #FFFFFF; }
    a:link { color: #0000CC; }
    p, address {margin-left: 3em;}
    span {font-size: smaller;}
/*]]>*/--></style>
</head>
<body>
<h1>Object not found!</h1>
<p>

    The requested URL was not found on this server.
 
    If you entered the URL manually please check your
    spelling and try again.
 
</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:%5bno%20address%20given%5d">webmaster</a>.
</p>
<h2>Error 404</h2>
<address>
  <a href="/">www.heise.de</a><br />
  <span>Wed Jul  2 10:55:07 2014<br />
  Apache/2.2.12 (Linux/SUSE)</span>
</address>
</body>
</html>
* Connection #0 to host 10.10.10.10 left intact
E:\apps\flash>
 
What settings do I have to provide to curl so that it can handle that transparent proxy properly?
 
Thank you very much for your help in advance and kind regards,
 
Gerd

-------------------------------------------------------------------
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