Class: Web::CGD::ModRuby

Inherits:
Web::CGD show all
Defined in:
lib/web/sapi/mod_ruby.rb

Constant Summary

Constants included from Parser

Parser::EOL

Instance Attribute Summary

Attributes inherited from Web::CGD

#cookies, #env, #input, #multiple_params, #options, #output

Instance Method Summary collapse

Methods inherited from Web::CGD

#close, create, #nph?, #send_nph_header

Methods included from Parser

#downcase_env, #mod_ruby_query_string, mod_ruby_query_string, #multipart?, #normalize, normalize, parse_cookie, #parse_cookie, #parse_multipart, #parse_params, #parse_query_string, parse_query_string, #parse_query_string_typed, #parse_request, #query_string, #read_multipart

Constructor Details

#initialize(options = {}) ⇒ ModRuby

Returns a new instance of ModRuby.



8
9
10
11
12
13
14
15
16
17
# File 'lib/web/sapi/mod_ruby.rb', line 8

def initialize( options = {} )
  options[:env] = {}
  ENV.each{|k,v|
    options[:env][k] = v
  }
  Apache::request.headers_in.each{ |k,v|
    options[:env][k] = v
  }
  super(options)
end

Instance Method Details

#send_header(header) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/web/sapi/mod_ruby.rb', line 19

def send_header header
  Apache::request.status_line  = header['Status'].first.split.shift
  Apache::request.content_type = header['Content-Type'].first
  Apache::request.content_encoding = (header['Content-Encoding'] || [ ]).first
  
  header.delete( "Status" )
  header.delete( "Content-Type" )
  header.delete( "Content-Encoding" )
  
  if (header["Set-Cookie"])
    header["Set-Cookie"].each{ |cookie|
      Apache::request.headers_out.add( "Set-Cookie", cookie )
    }
    header.delete( "Set-Cookie" )
  end
  
  header.each{ |k,v|
    Apache::request.headers_out[k] = v.last
  }
  
  Apache::request.send_http_header
  
end