package shuttle_http

  1. Overview
  2. Docs
Async library for HTTP/1.1 servers and clients

Install

dune-project
 Dependency

Authors

Maintainers

Sources

shuttle-0.9.0.tbz
sha256=fd61626c46dcbd63449746b55e1b0821119e5215c6b32330f9671fbb306812ef
sha512=f06946e9271acd8df613385f7b94facb3d807b031c7eb21fac30886db0f45d8615b6eb71132455008b746513de3590d77890518e0c1a2672f1434cd9c1d97f67

doc/shuttle_http/Shuttle_http/Body/index.html

Module Shuttle_http.BodySource

Sourcemodule Stream : sig ... end

Stream represents streaming HTTP bodies. This module provides utilities to create and consume streams, while enforcing the invariant that only one consume can read from a stream, and that a stream can only be consumed once.

Sourcetype t = private
  1. | Empty
  2. | Fixed of string
  3. | Stream of Stream.t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
Sourceval string : string -> t

string str creates a fixed length encoded body from a user provided string.

Sourceval empty : t

empty is a zero length body.

Sourceval of_pipe : [ `Chunked | `Fixed of int ] -> string Async.Pipe.Reader.t -> t

of_pipe is a convenience function that creates a streaming body from a user provided Async_kernel.Pipe.Reader.t. The pipe will be closed whenever the streaming body is closed, or EOF is reached.

Sourceval stream : Stream.t -> t

stream creates a streaming body from a user provided streaming module.

Sourceval to_stream : t -> Stream.t

to_stream converts a HTTP body to a stream.