 
       {:ok, {:http_error, invalid_line}, _rest} ->
         {:error, {:invalid_line, invalid_line}}
+
+      {:error, :invalid} ->
+        {:error, {:line_length_limit_exceeded, :status_line}}
 
       {:more, :undefined} ->
         {:more, :undefined}

  @type body_read_state :: {:complete, binary} | {:bytes, non_neg_integer} | :chunked

  @crlf "\r\n"

  @doc """
  Serialize a request to wire format

        when option: {:scheme, atom} | {:line_length_limit, integer}
  def parse_request(buffer, options) do
    scheme = Keyword.get(options, :scheme)
    line_length_limit = Keyword.get(options, :line_length_limit, @line_length_limit)

    case :erlang.decode_packet(:http_bin, buffer, line_length: line_length_limit) do
      {:ok, {:http_request, method, {:abs_path, path_and_query}, _version}, rest} ->
