Skip to content

Commit

Permalink
Use localhost name instead of default
Browse files Browse the repository at this point in the history
  • Loading branch information
ash committed Nov 28, 2011
1 parent 756b3c5 commit 96d213b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
File renamed without changes.
11 changes: 5 additions & 6 deletions lib/Areno.pm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ sub run {

$this->{request} = new Areno::Request($env);
$this->{doc} = $this->new_doc($env);

my $site = $this->dispatch($this->{sites}, $env);
my $page = $site->dispatch($env);

Expand All @@ -98,24 +98,23 @@ sub run {

sub dispatch {
my ($this, $env) = @_;

my $sites = $this->{sites};

my $server_name = $env->{HTTP_HOST};
if ($server_name) {
$server_name =~ s/:\d+$//;
$server_name =~ s/^localhost$/default/;
}
else {
$server_name = 'default';
$server_name = 'localhost';
}

if (exists $sites->{$server_name}) {
return $sites->{$server_name};
}
else {
warn "Non-existing site '$server_name' requested\n";
return $sites->{default};
return $sites->{localhost};
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Areno/Page.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sub route {
}

sub transform {
'default'
'localhost'
}

sub init {
Expand Down
2 changes: 1 addition & 1 deletion sites/default/Default.pm → sites/localhost/Default.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Areno::Default;
package Areno::Localhost::Default;

use strict;
use base 'Areno::Page';
Expand Down
2 changes: 1 addition & 1 deletion sites/default/Favicon.pm → sites/localhost/Favicon.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Areno::Favicon;
package Areno::Localhost::Favicon;

use strict;
use base 'Areno::Page';
Expand Down

0 comments on commit 96d213b

Please sign in to comment.