Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support HTTP::Easy again... or i'll fork it :)

  • Loading branch information...
commit d34e77022553fad88e7e721fba5fad56bccc2501 1 parent 2806cbc
@azawawi authored
Showing with 6 additions and 5 deletions.
  1. +1 −1  META.info
  2. +5 −4 lib/Farabi6.pm6
View
2  META.info
@@ -2,6 +2,6 @@
"name" : "Farabi6",
"version" : "*",
"description" : "Perl 6 in-browser Editor",
- "depends" : [ "File::Spec", "HTTP::Server::Simple", "JSON::Tiny", "Pod::To::HTML", "URI" ],
+ "depends" : [ "File::Spec", "HTTP::Easy", "JSON::Tiny", "Pod::To::HTML", "URI" ],
"source-url" : "git://github.com/azawawi/farabi6.git"
}
View
9 lib/Farabi6.pm6
@@ -4,7 +4,7 @@ class Farabi6 {
# External
use File::Spec;
-use HTTP::Server::Simple::PSGI;
+use HTTP::Easy::PSGI;
use URI;
# Internal
@@ -35,8 +35,10 @@ method run(Str $host, Int $port) is export {
say "Farabi6 is serving files from {$files-dir} at http://$host:$port";
my $app = sub (%env)
{
+ return [400,['Content-Type' => 'text/plain'],['']] if %env<REQUEST_METHOD> eq '';
+
my Str $filename;
- my Str $uri = %env<REQUEST_URI>;
+ my Str $uri = %env<REQUEST_URI>;
$uri ~~= s/\?.*$//;
#TODO use psgi.input once HTTP::Server::Simple supports it
@@ -103,8 +105,7 @@ method run(Str $host, Int $port) is export {
];
}
- my $server = HTTP::Server::Simple::PSGI.new($port);
- $server.host = $host;
+ my $server = HTTP::Easy::PSGI.new(:debug, :host($host), :port($port));
$server.app($app);
$server.run;
}
Please sign in to comment.
Something went wrong with that request. Please try again.