54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/rsence/http/rackup.rb', line 54
def self.call(env)
request = Request.new(env)
response = Response.new
request_method = request.request_method.downcase
if request_method == 'get'
puts "get: #{request.fullpath}" if $DEBUG_MODE
sleep @@ping_sim if @@ping_sim
not_found( request, response ) unless @@transporter.servlet( :get, request, response )
elsif request_method == 'post'
puts "post: #{request.fullpath}" if $DEBUG_MODE
sleep @@ping_sim if @@ping_sim
not_found( request, response ) unless @@transporter.servlet( :post, request, response )
else
puts "unsupported method: #{request_method.inspect}"
end
response.['Content-Length'] = response.body.bytesize.to_s unless response..has_key?('Content-Length')
return [response.status, response., response.body]
end
|