Module: Monorail::HttpEventMachine
- Defined in:
- lib/monorail.rb,
ext/rubyhttp.cpp
Instance Method Summary collapse
- #process_default ⇒ Object
- #process_http_request ⇒ Object
- #process_monorail_request ⇒ Object
- #process_rails_request ⇒ Object
Instance Method Details
#process_default ⇒ Object
59 60 61 |
# File 'lib/monorail.rb', line 59 def process_default "Monorail default processor" end |
#process_http_request ⇒ Object
54 55 56 57 |
# File 'lib/monorail.rb', line 54 def process_http_request send_data process_actual_request close_connection_after_writing end |
#process_monorail_request ⇒ Object
84 85 86 |
# File 'lib/monorail.rb', line 84 def process_monorail_request Monotreme.run end |
#process_rails_request ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/monorail.rb', line 63 def process_rails_request s = StringIO.new( "", "r+" ) Dispatcher.dispatch( nil, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, s) s.rewind header = [] status = "HTTP/1.1 200 ...\r\n" while line = s.gets and line.chomp! and line.length > 0 if line =~ /\AStatus:[\s]*([\d]{3})/i status = "HTTP/1.1 #{$1} ...\r\n" else header << "#{line}\r\n" end end header.unshift status content = s.read header << "Content-length: #{content.length}\r\n" header << "\r\n" header.join + content end |