curl-library
Re: Should check for CURLE_COULDNT_RESOLVE_HOST
Date: Fri, 14 Nov 2003 12:55:34 +0100 (CET)
On Fri, 14 Nov 2003, Siddhartha Prakash Jain wrote:
> We should check for the return value of Curl_is_resolved. Sometimes if the
> url to fetch has an ip address and that ip address is not correct say
> something like 190.222.22.22222 then Curl_is_resolved returns error
> CURLE_COULDNT_RESOLVE_HOST but we ignore that and set rc = 1.
You are right indeed. I take it you mean something like this:
diff -u -r1.107 hostip.c
--- hostip.c 28 Oct 2003 13:06:17 -0000 1.107
+++ hostip.c 14 Nov 2003 11:53:37 -0000
@@ -280,6 +280,7 @@
ssize_t entry_len;
int wait;
struct SessionHandle *data = conn->data;
+ CURLcode result;
/* default to failure */
int rc = -1;
@@ -327,7 +328,9 @@
/* the response to our resolve call will come asynchronously at
a later time, good or bad */
/* First, check that we haven't received the info by now */
- (void)Curl_is_resolved(conn, &dns);
+ result = Curl_is_resolved(conn, &dns);
+ if(result) /* error detected */
+ return -1;
if(dns)
rc = 0; /* pointer provided */
else
(I think I'll setup and use some proper defines instead of those numerical
values, which will make the code using this function slightly easier to read.)
> I am still working on the memory issue but I think that check on the return
> value is relevant independent of that.
Let us know what you find out!
-- Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/ [[ Do not post private mails to this email address. They won't reach me. ]] ------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/Received on 2003-11-14