package cohttp

  1. Overview
  2. Docs
type version = [
  1. | `HTTP_1_0
  2. | `HTTP_1_1
  3. | `Other of string
]
include sig ... end
val version_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> version
val __version_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> version
val sexp_of_version : version -> Ppx_sexp_conv_lib.Sexp.t
type meth = [
  1. | `GET
  2. | `POST
  3. | `HEAD
  4. | `DELETE
  5. | `PATCH
  6. | `PUT
  7. | `OPTIONS
  8. | `TRACE
  9. | `CONNECT
  10. | `Other of string
]
include sig ... end
val meth_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> meth
val __meth_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> meth
val sexp_of_meth : meth -> Ppx_sexp_conv_lib.Sexp.t
type informational_status = [
  1. | `Continue
    (*

    Client should continue with request

    *)
  2. | `Switching_protocols
    (*

    Server is switching protocols

    *)
  3. | `Processing
    (*

    Server has received and is processing the request

    *)
  4. | `Checkpoint
    (*

    resume aborted PUT or POST requests

    *)
]

Informational

include sig ... end
val informational_status_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> informational_status
val __informational_status_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> informational_status
val sexp_of_informational_status : informational_status -> Ppx_sexp_conv_lib.Sexp.t
type success_status = [
  1. | `OK
    (*

    standard response for successful HTTP requests

    *)
  2. | `Created
    (*

    request has been fulfilled; new resource created

    *)
  3. | `Accepted
    (*

    request accepted, processing pending

    *)
  4. | `Non_authoritative_information
    (*

    request processed, information may be from another source

    *)
  5. | `No_content
    (*

    request processed, no content returned

    *)
  6. | `Reset_content
    (*

    request processed, no content returned, reset document view

    *)
  7. | `Partial_content
    (*

    partial resource return due to request header

    *)
  8. | `Multi_status
    (*

    XML, can contain multiple separate responses

    *)
  9. | `Already_reported
    (*

    results previously returned

    *)
  10. | `Im_used
    (*

    request fulfilled, reponse is instance-manipulations

    *)
]

Success

include sig ... end
val success_status_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> success_status
val __success_status_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> success_status
val sexp_of_success_status : success_status -> Ppx_sexp_conv_lib.Sexp.t
type redirection_status = [
  1. | `Multiple_choices
    (*

    multiple options for the resource delivered

    *)
  2. | `Moved_permanently
    (*

    this and all future requests directed to the given URI

    *)
  3. | `Found
    (*

    temporary response to request found via alternative URI

    *)
  4. | `See_other
    (*

    permanent response to request found via alternative URI

    *)
  5. | `Not_modified
    (*

    resource has not been modified since last requested

    *)
  6. | `Use_proxy
    (*

    content located elsewhere, retrieve from there

    *)
  7. | `Switch_proxy
    (*

    subsequent requests should use the specified proxy

    *)
  8. | `Temporary_redirect
    (*

    connect again to different URI as provided

    *)
  9. | `Resume_incomplete
    (*

    resumable HTTP requests

    *)
]

Redirection

include sig ... end
val redirection_status_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> redirection_status
val __redirection_status_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> redirection_status
val sexp_of_redirection_status : redirection_status -> Ppx_sexp_conv_lib.Sexp.t
type client_error_status = [
  1. | `Bad_request
    (*

    request cannot be fulfilled due to bad syntax

    *)
  2. | `Unauthorized
    (*

    authentication is possible but has failed

    *)
  3. | `Payment_required
    (*

    payment required, reserved for future use

    *)
  4. | `Forbidden
    (*

    server refuses to respond to request

    *)
  5. | `Not_found
    (*

    requested resource could not be found

    *)
  6. | `Method_not_allowed
    (*

    request method not supported by that resource

    *)
  7. | `Not_acceptable
    (*

    content not acceptable according to the Accept headers

    *)
  8. | `Proxy_authentication_required
    (*

    client must first authenticate itself with the proxy

    *)
  9. | `Request_timeout
    (*

    server timed out waiting for the request

    *)
  10. | `Conflict
    (*

    request could not be processed because of conflict

    *)
  11. | `Gone
    (*

    resource is no longer available and will not be available again

    *)
  12. | `Length_required
    (*

    request did not specify the length of its content

    *)
  13. | `Precondition_failed
    (*

    server does not meet request preconditions

    *)
  14. | `Request_entity_too_large
    (*

    request is larger than the server is willing or able to process

    *)
  15. | `Request_uri_too_long
    (*

    URI provided was too long for the server to process

    *)
  16. | `Unsupported_media_type
    (*

    server does not support media type

    *)
  17. | `Requested_range_not_satisfiable
    (*

    client has asked for unprovidable portion of the file

    *)
  18. | `Expectation_failed
    (*

    server cannot meet requirements of Expect request-header field

    *)
  19. | `I_m_a_teapot
    (*

    I'm a teapot

    *)
  20. | `Enhance_your_calm
    (*

    Twitter rate limiting

    *)
  21. | `Unprocessable_entity
    (*

    request unable to be followed due to semantic errors

    *)
  22. | `Locked
    (*

    resource that is being accessed is locked

    *)
  23. | `Failed_dependency
    (*

    request failed due to failure of a previous request

    *)
  24. | `Upgrade_required
    (*

    client should switch to a different protocol

    *)
  25. | `Precondition_required
    (*

    origin server requires the request to be conditional

    *)
  26. | `Too_many_requests
    (*

    user has sent too many requests in a given amount of time

    *)
  27. | `Request_header_fields_too_large
    (*

    server is unwilling to process the request

    *)
  28. | `No_response
    (*

    server returns no information and closes the connection

    *)
  29. | `Retry_with
    (*

    request should be retried after performing action

    *)
  30. | `Blocked_by_windows_parental_controls
    (*

    Windows Parental Controls blocking access to webpage

    *)
  31. | `Wrong_exchange_server
    (*

    The server cannot reach the client's mailbox.

    *)
  32. | `Client_closed_request
    (*

    connection closed by client while HTTP server is processing

    *)
]

Client_error

include sig ... end
val client_error_status_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> client_error_status
val __client_error_status_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> client_error_status
val sexp_of_client_error_status : client_error_status -> Ppx_sexp_conv_lib.Sexp.t
type server_error_status = [
  1. | `Internal_server_error
    (*

    generic error message

    *)
  2. | `Not_implemented
    (*

    server does not recognise method or lacks ability to fulfill

    *)
  3. | `Bad_gateway
    (*

    server received an invalid response from upstream server

    *)
  4. | `Service_unavailable
    (*

    server is currently unavailable

    *)
  5. | `Gateway_timeout
    (*

    gateway did not receive response from upstream server

    *)
  6. | `Http_version_not_supported
    (*

    server does not support the HTTP protocol version

    *)
  7. | `Variant_also_negotiates
    (*

    content negotiation for the request results in a circular reference

    *)
  8. | `Insufficient_storage
    (*

    server is unable to store the representation

    *)
  9. | `Loop_detected
    (*

    server detected an infinite loop while processing the request

    *)
  10. | `Bandwidth_limit_exceeded
    (*

    bandwidth limit exceeded

    *)
  11. | `Not_extended
    (*

    further extensions to the request are required

    *)
  12. | `Network_authentication_required
    (*

    client needs to authenticate to gain network access

    *)
  13. | `Network_read_timeout_error
    (*

    network read timeout behind the proxy

    *)
  14. | `Network_connect_timeout_error
    (*

    network connect timeout behind the proxy

    *)
]

Server_error

include sig ... end
val server_error_status_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> server_error_status
val __server_error_status_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> server_error_status
val sexp_of_server_error_status : server_error_status -> Ppx_sexp_conv_lib.Sexp.t
include sig ... end
val status_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> status
val __status_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> status
val sexp_of_status : status -> Ppx_sexp_conv_lib.Sexp.t
type status_code = [
  1. | `Code of int
  2. | status
]
include sig ... end
val status_code_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> status_code
val __status_code_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> status_code
val sexp_of_status_code : status_code -> Ppx_sexp_conv_lib.Sexp.t
val string_of_version : version -> string

Convert a version to a string.

val version_of_string : string -> version

Convert a string to a version.

val compare_version : version -> version -> int

Comparison function for version values

val string_of_method : meth -> string

Convert a method to a string.

val method_of_string : string -> meth

Convert a string to a method.

val compare_method : meth -> meth -> int

Comparison function for method values

val status_of_code : int -> status_code

Generate status values from int codes.

val code_of_status : status_code -> int

Generate an int code from a status value.

val string_of_status : status_code -> string

Give a description of the given status value.

val reason_phrase_of_code : int -> string

Give a description of the given int code.

val is_informational : int -> bool

Is the given int code belong to the class of "informational" return code ?

val is_success : int -> bool

Is the given int code belong to the class of "success" return code ?

val is_redirection : int -> bool

Is the given int code belong to the class of "redirection" return code ?

val is_client_error : int -> bool

Is the given int code belong to the class of "client_error" return code ?

val is_server_error : int -> bool

Is the given int code belong to the class of "server_error" return code ?

val is_error : int -> bool

Return true for client and server error status codes.

OCaml

Innovation. Community. Security.