cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Cannot resolve localhost or 127.0.0.1

From: weiping guo <weiping_guo_at_yahoo.com>
Date: Fri, 11 Jan 2008 11:17:45 -0800 (PST)

Sorry, my bad. My original code looks like this.

char url[REQUEST_LEN*2];
memset(url,0, REQUEST_LEN*2);
int n = sprintf(url, "http://%s:%d/%s?%s", this->ip_, this->port_, this->url_, request);

It seems that curl is trying to cache the DNS entry. For the first time to call this function, it always return an error. Subsequent calls never fail.

Any suggestions?

Thanks.
Weiping

----- Original Message ----
From: Dan Fandrich <dan_at_coneharvesters.com>
To: curl-users_at_cool.haxx.se
Sent: Friday, January 11, 2008 1:53:18 PM
Subject: Re: Cannot resolve localhost or 127.0.0.1

On Fri, Jan 11, 2008 at 10:26:54AM -0800, weiping guo wrote:
> //composite the requested url
> // http://127.0.0.1:8000/
> char url[REQUEST_LEN*2];
> memset(url,0, REQUEST_LEN*2);
> int n = sprintf(url, "// http://127.0.0.1:8000/connector", this->proxy_ip_, this->proxy_port_, this->proxy_url_, request);

This line is clearly wrong. It will result in a URL of
"// http://127.0.0.1:8000/connector" which isn't a URL at all. The four
parameters after the string aren't even used.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
Received on 2008-01-11