[erlang-questions] Use of http:request

Greg Smyth gsmyth@REDACTED
Mon Jan 18 17:59:39 CET 2010


To anyone following along, this was basically a mixture of me failing
to set the Host header explicitly for the HTTP/1.1 request, the
http:request client trying to helpfully do this for me, the server
trying a redirect for this "Host:" form to an address that didn't
exist... And the client doing an autoredirect... :)

Cheers,
Greg

On Fri, Jan 15, 2010 at 11:06 AM, Greg Smyth <gsmyth@REDACTED> wrote:
> On Thu, Jan 14, 2010 at 10:52 PM, Tomas Abrahamsson
> <tomas.abrahamsson@REDACTED> wrote:
>>> I'm having a bit of a problem understanding why http:request is
>>> returning "{error,nxdomain}" - whenever the box seems to resolve
>>> properly via inet:gethostbyname:-
>>
>> What version of Erlang are you running?
>
> I have access to 2 machines, one running R12B-5 (inets-5.0.12), and
> one running R13B-1 (inets-5.0.13) - both are currently exhibiting the
> same failure with http:request....
>
>>
>> This has happened to me with R12B-5 (inets-5.0.12), I think, but I cannot
>> reproduce it with the R13B02 (inets-5.1.3) I currently have at hand.
>>
>> The problem in my case was that the web server had both an ipv6
>> address and an ipv4 address, and I didn't have any ipv6 networking
>> properly set up, and the http:request in R12B-5 by default tried first ipv6
>> then ipv4. So it found an ipv6 address, couldn't reach it and ended up
>> with an {error,enetunreach}.
>>
>> You could try to run "dig AAAA webserver001.cluster1.company.com"
>> or inet:gethostbyname("webserver001.cluster1.company.com", inet6).
>> to see if it has an ipv6 address. In my case it was the www.ida.liu.se
>> that I tried to reach.
>
> This is where it gets interesting... :)
>
> I get an ipv6 address for the webserver returned from
> inet:gethostbyname in R13 - but not in R12 (and interestingly, not
> from a "dig AAAA" on either machine)
>
>>
>> If this is the problem for you, then you may try
>> http:set_options([{ipv6,disabled}]).
>
> Tried this on both machines - doesn't seem to make a difference for
> this particular case...
>
> Thanks for the help,
> Greg
>
>>
>> BRs
>> Tomas
>>
>


More information about the erlang-questions mailing list