cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Specifying "No Proxy For" domains

From: Combes, Chris M. <ccombes_at_northropgrumman.com>
Date: Mon, 22 Jul 2002 15:38:02 -0400

Holger,

In your case I would suggest checking the url yourself to see if it is one that is part of some list (one that you could
read in from a text file to keep it configurable), prior to making the curl calls, since you know which sites require
the proxy and which ones do not.

I understand that curl does not perform a check for whether a proxy is required or not.

I need similar capability but I do not know ahead of time if proxy information is required or not. I may just run the
curl connect, and if it fails, then try again using proxy, and if it fails this time, then return an error code.

Adding a proxy check to curl would be a good project.

Chris

Holger Rauch wrote:
>
> Hi!
>
> I'm new to libcurl and I'm wondering whether it's possible to specify
> domains for which no proxy should be used (analogous to the "No Proxy
> For" input field in Netscape)? I'm using curl/libcurl version
> 7.9.8. Here's my code, heavily based on the example provided. Maybe there
> is an option that I've overlooked?
>
> /**
> * Used to fetch URL data from a local site
> * but this time using a proxy, so that we can obtain stuff
> * from the Internet
> * ??? How do I make it known to this lib that no proxy is supposed
> * to be used for .heitec.de, .heitec.net, and localhost ???
> */
>
> #include <stdio.h>
> #include <curl/curl.h>
>
> int
> main( int argc,
> char** argv )
> {
> CURL* curl = NULL;
> CURLcode res = NULL;
>
> if ( argc == 2 ) {
> curl = curl_easy_init();
> if ( curl ) {
> curl_easy_setopt( curl,
> CURLOPT_URL,
> argv[1] );
> curl_easy_setopt( curl,
> CURLOPT_PROXY,
> "http://proxy.heitec.net:8080" );
> res = curl_easy_perform( curl );
> curl_easy_cleanup( curl );
> }
> } else {
> printf( "Please pass URL as an argument\n" );
> }
>
> return 0;
> }
>
> Thanks a lot for any help!
>
> Greetings,
>
> Holger
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf

-- 
Christopher M. Combes, Software Engineer 
Northrop Grumman IT
ccombes_at_northopgrumman.com
Newport News, VA 23602 (757) 249-1234
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-07-22