Class: Web::ModRubyConnection

Inherits:
Connection show all
Defined in:
lib/web/sapi/apache.rb

Constant Summary

Constants inherited from Connection

Connection::ENV_KEYS, Connection::EOL, Connection::HTTP_STATUS, Connection::MULTIPLE_KEY

Instance Attribute Summary

Attributes inherited from Connection

#application_loaded, #cgd, #content, #cookie, #env, #get, #local, #options, #output, #post, #raw_post_data, #request, #ruleset, #run_caller, #templates

Instance Method Summary collapse

Methods inherited from Connection

#[], #[]=, #add_header, #apply_options, #assert_content, #assert_cookie, #assert_form_includes, #assert_header, #assert_local_includes, #assert_template_not_used, #assert_template_used, #assert_vars_equals, #call_progress_hook, #charset, #charset=, #clear, #close, #closed?, #content_type, #content_type=, #cookies_sent, create, downcase_env, #encoding, #encoding=, #flush, #full_content_type, #get_content, #get_cookie, #get_form, #get_form_fields, #get_form_value, #get_formreader, #get_header, #header, #header_sent?, #key?, #keys, #location, #location=, #merge_get_and_post, #mod_ruby_query_string, #multipart?, normalize, #nph?, #ob_get_flush, #ob_start, #parse_multipart, parse_query_string, #parse_request, #progress_hook, #read_multipart, #report_error, #report_error2stderr, #send_file, #send_header, server_sniff, #session, #set_cookie, #set_full_content_type, #set_redirect, #setup_variables, #single_param, #split_content_type, #split_params, #status, #status=, #trace_output, trace_output_template, #unbuffered?

Methods included from Test::Unit::Assertions

#assert_includes

Constructor Details

#initialize(options = {}) ⇒ ModRubyConnection

Returns a new instance of ModRubyConnection.



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/web/sapi/apache.rb', line 36

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_implementationObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/web/sapi/apache.rb', line 48

def send_header_implementation
  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