Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
No, its a bug in the test suite, it doesn't specify localhost or 127.0.0.1 but uses the default, which is 0.0.0.0, which is fine for the module but not for the test suite.

If you don't have a personal firewall, windows will happily let you create an internet accessible webserver, which is why test suites need to specify localhost, you can't rely on secure linux semantics.

I've even gone as far as to disable my internet net stop "dhcp client" when installing modules since my personal firewall broke.

Here is what I used (apply with patch -p1 < thepatch.patch from within HTTP-Server-Simple--- directory)

diff -ruN HTTP-Server-Simple-0.43/t/00smoke.t HTTP-Server-Simple-0.430 +1/t/00smoke.t --- HTTP-Server-Simple-0.43/t/00smoke.t 2008-02-15 09:37:12.0000000 +00 -0800 +++ HTTP-Server-Simple-0.4301/t/00smoke.t 2011-03-05 06:55:12.00000 +0000 -0800 @@ -2,7 +2,7 @@ use_ok(HTTP::Server::Simple); ok(HTTP::Server::Simple->can('new'), 'can new()'); -my $s= HTTP::Server::Simple->new(); +my $s= HTTP::Server::Simple->new();; $s->host('127.0.0.1'); isa_ok($s,'HTTP::Server::Simple'); is($s->port(),8080,'Defaults to 8080'); is($s->port(13432),13432,'Can change port'); diff -ruN HTTP-Server-Simple-0.43/t/01live.t HTTP-Server-Simple-0.4301 +/t/01live.t --- HTTP-Server-Simple-0.43/t/01live.t 2010-04-02 09:53:07.00000000 +0 -0700 +++ HTTP-Server-Simple-0.4301/t/01live.t 2011-03-05 06:55:12.000000 +000 -0800 @@ -19,7 +19,7 @@ use base qw(HTTP::Server::Simple::CGI); sub setup_listener { - my $self = shift; + my $self = shift;; $self ->host('127.0.0.1'); $self->SUPER::setup_listener(); sleep 2; } @@ -38,7 +38,7 @@ { - my $s=HTTP::Server::Simple::CGI->new($PORT); + my $s=HTTP::Server::Simple::CGI->new($PORT);; $s->host('127.0.0. +1'); $s->host("localhost"); my $pid=$s->background(); diag("started server PID='$pid'") if ($ENV{'TEST_VERBOSE'}); @@ -111,7 +111,7 @@ sub run_server_tests { my $class = shift; - my $s = $class->new($PORT); + my $s = $class->new($PORT);; $s ->host('127.0.0.1'); is($s->port(),$PORT,"Constructor set port correctly"); my $pid=$s->background(); diff -ruN HTTP-Server-Simple-0.43/t/04cgi.t HTTP-Server-Simple-0.4301/ +t/04cgi.t --- HTTP-Server-Simple-0.43/t/04cgi.t 2010-02-04 12:23:19.000000000 + -0800 +++ HTTP-Server-Simple-0.4301/t/04cgi.t 2011-03-05 07:04:19.0000000 +00 -0800 @@ -5,12 +5,12 @@ plan tests => 23; my $PORT = 40000 + int(rand(10000)); -my $host = gethostbyaddr(inet_aton('localhost'), AF_INET); +$main::host = gethostbyaddr(inet_aton('localhost'), AF_INET) || 'loca +lhost'; my %methods=( - url => "url: http://$host:".$PORT, + url => "url: http://${main::host}:$PORT", path_info => 'path_info: /cgitest/path_info', - server_name => "server_name: $host", + server_name => "server_name: $main::host", server_port => 'server_port: '.$PORT, server_software => 'server_software: HTTP::Server::Simp +le/\d+.\d+', request_method => 'request_method: GET', @@ -18,12 +18,12 @@ ); my %envvars=( - SERVER_URL => "SERVER_URL: http://$host:".$PORT.'/', + SERVER_URL => "SERVER_URL: http://${main::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: $host", + SERVER_NAME => "SERVER_NAME: $main::host", SERVER_SOFTWARE => 'SERVER_SOFTWARE: HTTP::Server::Simp +le/\d+.\d+', REMOTE_ADDR => 'REMOTE_ADDR: 127.0.0.1', QUERY_STRING => 'QUERY_STRING: ', @@ -31,7 +31,7 @@ ); { - my $server=CGIServer->new($PORT); + my $server=CGIServer->new($PORT);; $server->host( $main::host ); is($server->port(),$PORT,'Constructor set port correctly'); sleep(3); # wait just a moment @@ -132,7 +132,7 @@ use Env; sub handle_request { - my $self=shift; + my $self=shift;; $self->host($main::host ); my $cgi=shift;

In reply to Re: HTTP-Server-Simple-0.44 tests and undefined $self->host by Anonymous Monk
in thread HTTP-Server-Simple-0.44 tests and undefined $self->host by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (5)
    As of 2020-11-24 23:32 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?