Class: Phuby::PHPHandler

Inherits:
WEBrick::HTTPServlet::FileHandler
  • Object
show all
Defined in:
lib/phuby/php_handler.rb

Defined Under Namespace

Classes: Events

Instance Method Summary collapse

Constructor Details

#initialize(server, root = server.config[:DocumentRoot] || Dir.pwd, *args) ⇒ PHPHandler

Returns a new instance of PHPHandler.



33
34
35
# File 'lib/phuby/php_handler.rb', line 33

def initialize server, root = server.config[:DocumentRoot] || Dir.pwd, *args
  super
end

Instance Method Details

#do_GET(req, res) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/phuby/php_handler.rb', line 45

def do_GET req, res
  req.path << "index.php" if req.path =~ /\/$/

  return super(req, res) unless req.path =~ /\.php$/

  process :GET, req, res
end

#do_POST(req, res) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/phuby/php_handler.rb', line 37

def do_POST req, res
  req.path << "index.php" if req.path =~ /\/$/

  return super(req, res) unless req.path =~ /\.php$/

  process :POST, req, res
end