summaryrefslogtreecommitdiff
path: root/gemini/geminiTransaction.mli
blob: d103afed22eb788952cffe0609678f6e9d38bebd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module type GEMINI_TRANSACTION =
sig
  type request

  module T : TlsUtils.TLS_UTILS

  module M : MimeType.MIME_TYPE

  type mime_type = M.t

  type response =
    | INPUT
    | SENSITIVE_INPUT
    | SUCCESS of mime_type * string
    | SUCCESS_EOCSS of mime_type * string
    | REDIR_TEMP of string
    | REDIR_PERM of string
    | TEMP_FAIL
    | SERVER_UNAVAILABLE
    | CGI_ERROR
    | PROXY_ERROR
    | SLOW_DOWN of int
    | PERM_FAIL
    | NOT_FOUND
    | GONE
    | PROXY_REQ_REFUSED
    | BAD_REQ
    | CLIENT_CERT_REQUIRED
    | TRANSIENT_CERT_REQUESTED
    | AUTHORISED_CERT_REQUIRED
    | CERT_NOT_ACCEPTED
    | FUTURE_CERT_REJECTED
    | EXPIRED_CERT_REJECTED

  type session_error =
    | TOO_MANY_REDIRECTS
    | X_DOMAIN_REDIR of Uri.t * Uri.t
    | UNKNOWN_RESPONSE of string
    | MISC of string

  val make_request : ?authenticator:T.authenticator
    -> ?max_redirects:int -> string -> (request, string) Base.Result.t

  val update_request : ?authenticator:T.authenticator
    -> ?max_redirects:int -> ?url:string
    -> request -> (request, string) Base.Result.t

  val response_of_string : string -> (response, string) Base.Result.t

  val int_of_response : response -> int

  val name_of_response : response -> string

  val header_of_response : response -> string

  val transaction : request -> (response, string) Base.Result.t Lwt.t

  val session : request -> (response, session_error) Base.Result.t Lwt.t
end

module GeminiTransaction (M : MimeType.MIME_TYPE) (T : TlsUtils.TLS_UTILS)
  : GEMINI_TRANSACTION with module M = M and module T = T