[boulder.pm] http/1.1 question

Ray Carlino rcarlino at home.com
Tue Feb 1 00:07:20 CST 2000


Here is the script. It works great with netscape but not with IE5. This runs on
our web server so that users can view the site in text only without us having
to make dup pages. The error I get is that hostname not sent by client which is
the server address. If I change the settings in ie5 not to use http/1.1 then it
works also.

Thanks
Ray

On Mon, 31 Jan 2000, you wrote:
> On Mon, 31 Jan 2000, Ray Carlino wrote:
> 
> > I have a perl script that pares html pages for a text only output. It works
> > great on netscape but IE uses http/1.1 and I get an error saying hostname not
> > in header. How do I get the hostname for a vhost under apache? I am using ip
> > based vhosts and they have different names.
> > 
> > Thanks
> > Ray
> 
> Hi,
> 
> I'm not clear exactly what you're trying to do -- posting some code
> might be helpful if I'm off-base where you're going.
> 
> It sounds like what you're asking is how to get the hostname for
> an IP address?
> 
> use Socket;
> $hostname = gethostbyaddr(inet_aton($ip_address), AF_INET);
> 
> But if you're doing this on your own systems, you can code the info into
> a hash and it'll be much quicker and more robust:
> 
> %addresses = (
>     "1.2.3.4"	=> "foo.bar.com",
>     "1.2.3.5"	=> "baz.bar.com",
> );
> if ( defined $addresses{$ip_address} ) {
>     $hostname = $addresses{$ip_address};
> } else { 
>     # your whoops function 
>     print "Whoops!\n"; 	# Well, maybe something more better than this!
> }
> 
> Walter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nph-text-filter.pl
Type: application/x-perl
Size: 4748 bytes
Desc: not available
Url : http://mail.pm.org/archives/boulder-pm/attachments/20000131/8d62a55e/nph-text-filter.bin


More information about the Boulder-pm mailing list