Permalink
Browse files

[run-yarn-locally] allowed POST requests

  • Loading branch information...
1 parent ef1a111 commit 14f42fa3b01dde38680585394d62ed695b3fb683 @masak committed May 9, 2009
Showing with 11 additions and 3 deletions.
  1. +11 −3 bin/run-yarn-locally
View
@@ -6,16 +6,24 @@ defined @*ARGS[0] && @*ARGS[0] eq '--request' ?? request() !! daemon();
# Serve one page
sub request($c) {
my $r = $c.get_request;
+ warn "{hhmm} {$r.req_method} {$r.url.path} {$r.header('User-Agent')}";
if $r.req_method eq 'GET' {
- # log request info to the standard error stream
- warn "{hhmm} GET {$r.url.path} {$r.header('User-Agent')}";
my $qs = $r.url.path ~~ / '?' (.*) $/
- ?? $0
+ ?? ~$0
!! '';
$c.send_response(
~([~] Yarn.call({"QUERY_STRING" => $qs}).[2])
);
}
+ elsif $r.req_method eq 'POST' {
+ my $qs = $r.url.path ~~ / '?' (.*) $/
+ ?? ~$0
+ !! '';
+ $c.send_response(
+ ~([~] Yarn.call({"REQUEST_METHOD" => 'POST',
+ "QUERY_STRING" => $qs}).[2])
+ );
+ }
else {
warn "{hhmm} rejected {$r.req_method} {$r.url.path}";
$c.send_error('RC_FORBIDDEN');

0 comments on commit 14f42fa

Please sign in to comment.