mrblib/mrb_simplehttpserver.rb
def request_to_env(req)
    string_io = StringIO.new
    string_io.write req.body
    string_io.rewind

    req.headers.merge(
      Shelf::REQUEST_METHOD   => req.method,
      Shelf::PATH_INFO        => req.path || ROOT_PATH,
      Shelf::QUERY_STRING     => req.query,
      Shelf::HTTP_VERSION     => HTTP_VERSION,
      Shelf::SERVER_NAME      => 'mruby-simplehttpserver',
      Shelf::SERVER_ADDR      => host,
      Shelf::SERVER_PORT      => port,
      Shelf::SHELF_URL_SCHEME => req.schema,
      Shelf::SHELF_INPUT      => string_io
    )
  end
# Convert the parsed HTTP request into an environemt hash
# to be passed to the shelf app.
#
# @param [ HTTP::Request ] req The parsed HTTP request object.
#
# @return [ Hash<String, Object> ]
Convert the parsed HTTP request into an environemt hash
to be passed to the shelf app.
Convert the parsed HTTP request into an environemt hash to be passed to the shelf app .
def request_to_env(req)
    string_io = StringIO.new
    string_io.write req.body
    string_io.rewind
    req.headers.merge(
      Shelf::REQUEST_METHOD   => req.method,
      Shelf::PATH_INFO        => req.path || ROOT_PATH,
      Shelf::QUERY_STRING     => req.query,
      Shelf::HTTP_VERSION     => HTTP_VERSION,
      Shelf::SERVER_NAME      => 'mruby-simplehttpserver',
      Shelf::SERVER_ADDR      => host,
      Shelf::SERVER_PORT      => port,
      Shelf::SHELF_URL_SCHEME => req.schema,
      Shelf::SHELF_INPUT      => string_io
    )
  end
def request_to_env ( req ) string_io = StringIO . new string_io . write req . body string_io . rewind req . headers . merge ( Shelf :: REQUEST_METHOD => req . method , Shelf :: PATH_INFO => req . path || ROOT_PATH , Shelf :: QUERY_STRING => req . query , Shelf :: HTTP_VERSION => HTTP_VERSION , Shelf :: SERVER_NAME => 'mruby-simplehttpserver' , Shelf :: SERVER_ADDR => host , Shelf :: SERVER_PORT => port , Shelf :: SHELF_URL_SCHEME => req . schema , Shelf :: SHELF_INPUT => string_io ) end
Convert the parsed HTTP request into an environemt hash
to be passed to the shelf app.
Convert the parsed HTTP request into an environemt hash to be passed to the shelf app .
None
 Hash<String, Object> 
req
req The parsed HTTP request object.
req The parsed HTTP request object .