bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] make wget connect to a given IP/vhost?


From: Tomasz Chmielewski
Subject: Re: [Bug-wget] make wget connect to a given IP/vhost?
Date: Wed, 23 Mar 2011 14:17:40 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Lightning/1.0b2 Thunderbird/3.1.9

On 07.09.2010 16:17, Hrvoje Niksic wrote:
> Tom Mizutani<address@hidden>  writes:
> 
>> If you really believe that "www.example.com" is a virtual server,  I
>> suggest to specify the host with "--header" command line option, as
>> follows:
>>
>> wget http://1.1.1.1/  --header 'Host: www.example.com'
>> wget http://2.2.2.2/  --header 'Host: www.example.com'
> 
> That is exactly the way to do it, and has worked perfectly for me in the
> past (in fact, supporting this was an important use case when the
> --header feature was last revamped).

Replying after 6 months or so :) - but in the end, I don't think it works as it 
should, when the site is redirected.

I will paste 2 examples below with some explanations.

We will use "www.wpkg.org" as an example - it normally redirects to "wpkg.org".


1) example one, we don't use the "--header" - www.wpkg.org redirects to wpkg.org

$ wget -O /dev/null http://www.wpkg.org
--2011-03-23 14:06:44--  http://www.wpkg.org/
Resolving www.wpkg.org... 178.63.195.126, 2a01:4f8:120:14c4::1111
Connecting to www.wpkg.org|178.63.195.126|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://wpkg.org/ [following]
--2011-03-23 14:06:44--  http://wpkg.org/
Resolving wpkg.org... 178.63.195.126, 2a01:4f8:120:14c4::1111
Reusing existing connection to www.wpkg.org:80.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `/dev/null'

    [ <=>                                                                       
                                                                                
           ] 13,424      --.-K/s   in 0.07s   

2011-03-23 14:06:44 (191 KB/s) - `/dev/null' saved [13424]



2) example two - we use the "--header" - we hit redirect number:

$ wget -O /dev/null http://178.63.195.126 --header 'Host: www.wpkg.org'
--2011-03-23 14:10:09--  http://178.63.195.126/
Connecting to 178.63.195.126:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://wpkg.org/ [following]
--2011-03-23 14:10:09--  http://wpkg.org/
Resolving wpkg.org... 178.63.195.126, 2a01:4f8:120:14c4::1111
Reusing existing connection to 178.63.195.126:80.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://wpkg.org/ [following]
--2011-03-23 14:10:09--  http://wpkg.org/
Reusing existing connection to 178.63.195.126:80.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://wpkg.org/ [following]
--2011-03-23 14:10:09--  http://wpkg.org/
Reusing existing connection to 178.63.195.126:80.
HTTP request sent, awaiting response... 301 Moved Permanently
(...)
20 redirections exceeded.

$ echo $?
8

(8 -  Server issued an error response.)

This happens because the 'Host: www.wpkg.org' header is attached to each 
subsequent request.
Because of this, it's sometimes impossible to test if a vhost running on a 
given IP is OK or not!

Any ideas how to best solve it?

-- 
Tomasz Chmielewski
http://wpkg.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]