Skip to content

Commit

Permalink
[Web::Handler::HTTPDaemon] generalized the call
Browse files Browse the repository at this point in the history
Now not only the port, but also the host name is a parameter.
  • Loading branch information
Carl Masak committed Oct 24, 2009
1 parent 92f7b99 commit e24dabb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Web/Handler/HTTPDaemon.pm
Expand Up @@ -3,8 +3,8 @@ use v6;
use HTTP::Daemon; use HTTP::Daemon;


class Web::Handler::HTTPDaemon { class Web::Handler::HTTPDaemon {
method run(&app, :$port = 8888) { method run(&app, :$host = 'localhost', :$port = 8888) {
my HTTP::Daemon $d .= new(LocalPort => $port); my HTTP::Daemon $d .= new(LocalAddr => $host, LocalPort => $port);
while my $c = $d.accept and my HTTP::Request $r = $c.get_request { while my $c = $d.accept and my HTTP::Request $r = $c.get_request {
my $qs = $r.url.path ~~ / '?' (.*) $/ ?? $0 !! ''; my $qs = $r.url.path ~~ / '?' (.*) $/ ?? $0 !! '';
my %env = { "QUERY_STRING" => $qs }; my %env = { "QUERY_STRING" => $qs };
Expand Down

0 comments on commit e24dabb

Please sign in to comment.