method

read_request_line

Importance_0

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1_9_3_392) is shown here.

read_request_line(socket) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/webrick/httprequest.rb, line 295
    def read_request_line(socket)
      @request_line = read_line(socket, MAX_URI_LENGTH) if socket
      if @request_line.bytesize >= MAX_URI_LENGTH and @request_line[-1, 1] != LF
        raise HTTPStatus::RequestURITooLarge
      end
      @request_time = Time.now
      raise HTTPStatus::EOFError unless @request_line
      if /^(\S+)\s+(\S++)(?:\s+HTTP\/(\d+\.\d+))?\r?\n/o =~ @request_line
        @request_method = $1
        @unparsed_uri   = $2
        @http_version   = HTTPVersion.new($3 ? $3 : "0.9")
      else
        rl = @request_line.sub(/\x0d?\x0a\z/, '')
        raise HTTPStatus::BadRequest, "bad Request-Line `#{rl}'."
      end
    end
Register or log in to add new notes.