Skip Menu |

This queue is for tickets about the HTTP-Server-Simple CPAN distribution.

Report information
The Basics
Id: 12766
Status: resolved
Priority: 0/
Queue: HTTP-Server-Simple

People
Owner: Nobody in particular
Requestors: emileaben [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: small test-breakage of gethostnamebyaddr of 'localhost'
module: HTTP-Server-Simple-0.09 perl -V Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=freebsd, osvers=4.8-release, archname=i386-freebsd uname='freebsd narus2.caida.org 4.8-release freebsd 4.8-release #0: thu apr 3 10:53:38 gmt 2003 root@freebsd-stable.sentex.ca:usrobjusrsrcsysgeneric i386 ' OS: FreeBSD 4.8-RELEASE FreeBSD 4.8-RELEASE #0 t/04cgi.t fails on my system, but module seems to work fine. t/04cgi.t assumes '127.0.0.1' will be translated into 'localhost' or 'localhost.localdomain' it tests for this with lines like: SERVER_URL => 'SERVER_URL: http://localhost(?:\.localdomain)?:'.PORT.'/', But on the system I use 127.0.0.1 is translated into localhost.example.com, which is valid. so I think the regexp that t/04cgi.t should test against is: SERVER_URL: http://localhost(?:[\.\w]+)?:'.PORT.'/', diff: # diff t/04cgi.t t/04cgi.t.orig 8c8 < url => 'url: http://localhost(?:[\.\w]+)?:'.PORT, --- Show quoted text
> url => 'url: http://localhost(?:\.localdomain)?:'.PORT,
18c18 < SERVER_URL => 'SERVER_URL: http://localhost(?:[\.\w]+)?:'.PORT.'/', --- Show quoted text
> SERVER_URL => 'SERVER_URL: http://localhost(?:\.localdomain)?:'.PORT.'/',
emile
From: Harald Kapper <hk [...] kapper.net>
Subject: [cpan #12766] [rt-users] HTTP::Server::Simple - testfiles assume incorrectly localhost
Date: Tue, 05 Jul 2005 00:21:15 +0200
To: rt-users [...] lists.bestpractical.com
RT-Send-Cc:
hi actually I'm installing RT on a new box and I saw the HTTP::Server::Simple test-scripts assume that opening a socket on 127.0.0.1 will always get us the servername localhost, this is very well not true especially on default redhat-setups where the hosts file gives 127.0.0.1 the local hostname at first. sidenote - during finally then testing HTTP::Server::Simple::Mason I also had a hard time because the used LWP::Simple::get in the testscript (line 18 01live.t) automagically uses the http_proxy defined for the system, but this gets us nowhere on localhost-opened ports that we try to reach (then via the proxy) :) regards Harald Kapper, icq# 36178328 http://kapper.net managing director, owner, loeblichgasse 6 chief executive officer 1090 vienna, .at tel +43 1 3195500-0, fax +43 1 3195502, hk@kapper.net --------------mark--------------- The following Statement is False. The previous Statement is True. - Welcome to my World - Show quoted text
_______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Be sure to check out the RT Wiki at http://wiki.bestpractical.com
From: mbarbon [...] cpan.org
[guest - Wed May 11 19:15:08 2005]: Show quoted text
> module: HTTP-Server-Simple-0.09
still true for 0.11 (in this case ActivePerl, Perl 5.8.6, Win2000) Show quoted text
> t/04cgi.t fails on my system, but module seems to work fine. > > t/04cgi.t assumes '127.0.0.1' will be translated into 'localhost' or > 'localhost.localdomain' it tests for this with lines like: > SERVER_URL => 'SERVER_URL: > http://localhost(?:\.localdomain)?:'.PORT.'/', > > But on the system I use 127.0.0.1 is translated into > localhost.example.com, which is valid. so I think the regexp that > t/04cgi.t should test against is: > SERVER_URL: http://localhost(?:[\.\w]+)?:'.PORT.'/',
This would still fail in my system. I suggest the patch below (also attached against whitespace mangling). This should be more robust. Thanks! Mattia --- t/04cgi.t.orig 2005-07-16 18:26:51.608726400 +0200 +++ t/04cgi.t 2005-07-16 18:31:23.649902400 +0200 @@ -4,10 +4,11 @@ use constant PORT => 13432; +my $host = gethostbyaddr(inet_aton('localhost'), AF_INET); our %methods=( - url => 'url: http://localhost(?:\.localdomain)?:'.PORT, + url => "url: http://$host:".PORT, path_info => 'path_info: /cgitest/path_info', - remote_host => 'remote_host: localhost', - server_name => 'server_name: localhost', + remote_host => "remote_host: $host", + server_name => "server_name: $host", server_port => 'server_port: '.PORT, server_software => 'server_software: HTTP::Server::Simple/\d+.\d+', @@ -16,12 +17,12 @@ our %envvars=( - SERVER_URL => 'SERVER_URL: http://localhost(?:\.localdomain)?:'.PORT.'/', + SERVER_URL => "SERVER_URL: http://$host:".PORT.'/', SERVER_PORT => 'SERVER_PORT: '.PORT, REQUEST_METHOD => 'REQUEST_METHOD: GET', REQUEST_URI => 'REQUEST_URI: /cgitest/REQUEST_URI', SERVER_PROTOCOL => 'SERVER_PROTOCOL: HTTP/1.1', - SERVER_NAME => 'SERVER_NAME: localhost', + SERVER_NAME => "SERVER_NAME: $host", SERVER_SOFTWARE => 'SERVER_SOFTWARE: HTTP::Server::Simple/\d+.\d+', - REMOTE_HOST => 'REMOTE_HOST: localhost', + REMOTE_HOST => "REMOTE_HOST: $host", REMOTE_ADDR => 'REMOTE_ADDR: 127.0.0.1', QUERY_STRING => 'QUERY_STRING: ',
--- t/04cgi.t.orig 2005-07-16 18:26:51.608726400 +0200 +++ t/04cgi.t 2005-07-16 18:31:23.649902400 +0200 @@ -4,10 +4,11 @@ use constant PORT => 13432; +my $host = gethostbyaddr(inet_aton('localhost'), AF_INET); our %methods=( - url => 'url: http://localhost(?:\.localdomain)?:'.PORT, + url => "url: http://$host:".PORT, path_info => 'path_info: /cgitest/path_info', - remote_host => 'remote_host: localhost', - server_name => 'server_name: localhost', + remote_host => "remote_host: $host", + server_name => "server_name: $host", server_port => 'server_port: '.PORT, server_software => 'server_software: HTTP::Server::Simple/\d+.\d+', @@ -16,12 +17,12 @@ our %envvars=( - SERVER_URL => 'SERVER_URL: http://localhost(?:\.localdomain)?:'.PORT.'/', + SERVER_URL => "SERVER_URL: http://$host:".PORT.'/', SERVER_PORT => 'SERVER_PORT: '.PORT, REQUEST_METHOD => 'REQUEST_METHOD: GET', REQUEST_URI => 'REQUEST_URI: /cgitest/REQUEST_URI', SERVER_PROTOCOL => 'SERVER_PROTOCOL: HTTP/1.1', - SERVER_NAME => 'SERVER_NAME: localhost', + SERVER_NAME => "SERVER_NAME: $host", SERVER_SOFTWARE => 'SERVER_SOFTWARE: HTTP::Server::Simple/\d+.\d+', - REMOTE_HOST => 'REMOTE_HOST: localhost', + REMOTE_HOST => "REMOTE_HOST: $host", REMOTE_ADDR => 'REMOTE_ADDR: 127.0.0.1', QUERY_STRING => 'QUERY_STRING: ',
Date: Sun, 17 Jul 2005 02:17:35 -0400
From: jesse <jesse [...] fsck.com>
To: via RT <bug-HTTP-Server-Simple [...] rt.cpan.org>
Subject: Re: [cpan #12766] small test-breakage of gethostnamebyaddr of 'localhost'
RT-Send-Cc:
On Sat, Jul 16, 2005 at 12:51:58PM -0400, via RT wrote: Show quoted text
> > > This would still fail in my system. I suggest the patch below > (also attached against whitespace mangling). This should be more > robust.
Thanks! Applied.