cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Networking Question : Windows vs *Unix

From: Jon Torrey <ntox101_at_gmail.com>
Date: Wed, 27 Aug 2014 09:30:54 -0400

>
> On which "unix" and which curl version?

I compiled and linked with curl-master from the git repository. I am
running ARM integrity RTOS which is an OS for embedded systems. It is a
POSIX compatible OS which has no command line shell and no ability to run
the configure script.

I have preprocessor defines so I modified curl_setup.h to include my own
hand crafted config file. I took your advice from an earlier post - run
configure script on Linux to generate a config file then modify to my needs.

No, gethostbyaddr is not used by libcurl. getaddrinfo() is though, if
> configure detects such a function.

In the config file there is a define for gethostbyaddr() but you are right,
after a doing a file grep I see no libcurl source which checks to see if it
is defined ( //#define HAVE_GETHOSTBYADDR 1 )

What is very interesting, if I try to do a gethostbyname("google.com"), I
>> get an IP just fine. If I do a gethostbyname() of the URL stated below, I
>> get jibberish output.
>>
>
> You mean in a stand-alone program using these functions or only when used
> with curl?

I test these networking functions in a stand-alone program, and now that I
think about it maybe I should do some simple name resolving examples to
test libCURL more. Inside hostip4.c, the file decides which DNS lookup
method it will used based on defines so knowing this, I've been testing on
my system each function to see if I can get a correct name resolve with my
FQDM (fully qualified domain name).

> C-ares is portable to basically all platforms that can build and run curl
> so you _could_ probably use c-ares too if you really wanted to.

Defining USE_ARES in turn causes libCURL to "include ares.h" so I cannot
use C-ares that way. Is there another way?

Ok, an old-style gethostbyname_r call. Did configure detect the correct *_r
> version for you?
>

I do not have the gethostbyname_r function in our system. Doing a search
on anything that begins with 'gethost' returns the following :

gethostEnt
gethostbyaddr
gethostbyname
gethostbyname2
gethostname

On Tue, Aug 26, 2014 at 5:18 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Tue, 26 Aug 2014, Jon Torrey wrote:
>
> Recently, I have written an application which uses the same code but does
>> not behave normally. Curl fails to resolve the hostname.
>>
>
> On which "unix" and which curl version?
>
>
> However, while debugging, I see curl calls gethostname() and
>> gethostbyname() functions as well as gethostbyaddr()
>>
>
> No, gethostbyaddr is not used by libcurl. getaddrinfo() is though, if
> configure detects such a function.
>
>
> What is very interesting, if I try to do a gethostbyname("google.com"),
>> I get an IP just fine. If I do a gethostbyname() of the URL stated below,
>> I get jibberish output.
>>
>
> You mean in a stand-alone program using these functions or only when used
> with curl?
>
>
> NOTE: my OS does not have ares.h
>>
>
> C-ares is portable to basically all platforms that can build and run curl
> so you _could_ probably use c-ares too if you really wanted to.
>
>
> Below is the output of curl. I starred out some content of the URL for
>> security and privacy reasons but for clarification, they are normal ASCII
>> a-z characters.
>>
>> I/O: * Curl_ipv4_resolve_r failed for dev1.***dev.com
>>
>
> Ok, an old-style gethostbyname_r call. Did configure detect the correct
> *_r version for you?
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-27