# `Quiver.Conn.HTTP1`
[🔗](https://github.com/edlontech/quiver/blob/main/lib/quiver/conn/http1.ex#L1)

HTTP/1.1 connection as a stateless data struct.

Wraps a TCP or SSL transport. Sequential request-response
with keep-alive support.

# `t`

```elixir
@type t() :: %Quiver.Conn.HTTP1{
  buffer: binary(),
  closed: boolean(),
  host: String.t(),
  keep_alive: boolean(),
  parse_state: Quiver.Conn.HTTP1.Parse.parse_state(),
  port: :inet.port_number(),
  recv_timeout: timeout(),
  request_ref: reference() | nil,
  request_state: :idle | :in_flight,
  scheme: :http | :https,
  transport: Quiver.Transport.t(),
  transport_mod: module()
}
```

# `open?`

Returns whether the connection may accept another request.

Does not probe the underlying transport -- a TCP reset that occurred
since the last send/recv will not be detected here. Dead connections
are discovered on the next request attempt.

# `recv_body_chunk`

```elixir
@spec recv_body_chunk(t()) ::
  {:ok, t(), binary()} | {:done, t()} | {:error, t(), term()}
```

Receives the next chunk of response body data.

Returns `{:ok, conn, chunk}` with binary data, `{:done, conn}` when the body is
complete, or `{:error, conn, reason}` on failure.

# `recv_response_headers`

```elixir
@spec recv_response_headers(t()) ::
  {:ok, t(), non_neg_integer(), [{String.t(), String.t()}], [binary()]}
  | {:error, t(), term()}
```

Receives response status and headers after a request has been sent via `open_request/5`.

Returns any body data that arrived alongside the headers in `initial_body_chunks`.
Call `recv_body_chunk/1` to continue receiving the body.

# `stream_request`

```elixir
@spec stream_request(
  t(),
  Quiver.Conn.method(),
  String.t(),
  Quiver.Conn.headers(),
  Enumerable.t()
) :: {:ok, t(), Quiver.Response.t()} | {:error, t(), term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
