Browse files

setting cookies in the correct place

  • Loading branch information...
1 parent f1c8bd8 commit 071d44a1562b9945b8b4faf1d89bfa7b62952eab @tenderlove committed Sep 26, 2009
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/phuby/php_handler.rb
View
8 lib/phuby/php_handler.rb
@@ -1,6 +1,7 @@
require 'webrick'
require 'cgi'
require 'iconv'
+require 'logger'
module Phuby
class PHPHandler < WEBrick::HTTPServlet::FileHandler
@@ -13,7 +14,11 @@ def initialize req, res
def header value, op
k, v = *value.split(':', 2)
- @res[k] = v.strip
+ if k.downcase == 'set-cookie'
+ @res.cookies << v.strip
+ else
+ @res[k] = v.strip
+ end
end
def write string
@@ -53,6 +58,7 @@ def process verb, req, res
Phuby::Runtime.php do |rt|
rt.eval("date_default_timezone_set('America/Los_Angeles');")
+ rt['logger'] = Logger.new($stdout)
req.request_uri.query.split('&').each do |pair|
k, v = pair.split '='
rt["_GET"][k] = v

0 comments on commit 071d44a

Please sign in to comment.