Class: Low::RequestParser
- Inherits:
-
Object
- Object
- Low::RequestParser
- Includes:
- LowType
- Defined in:
- lib/requests/request_parser.rb
Class Method Summary collapse
Class Method Details
.parse(socket: TCPSocket, host: String, port: Integer) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/requests/request_parser.rb', line 12 def parse(socket: TCPSocket, host: String, port: Integer) -> { ::Protocol::HTTP::Request } stream = IO::Stream(socket) protocol = Async::HTTP::Protocol::HTTP.default.protocol_for(stream) method, path, = parse_request(stream:) headers = parse_headers(stream:) body = parse_body(stream:, method:) ::Protocol::HTTP::Request.new('http', "#{host}:#{port}", method, path, protocol::VERSION, headers, body) end |