summaryrefslogblamecommitdiff
path: root/gemini/geminiTransaction.mli
blob: ecd73499d42375861ec61e1a18c26c335bd2fb4b (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                

              

                               

                               

                      

               
                          
                   

                          



                        
                      











                              











                                                                      
 
                                       
 
                                         
 
                                                                     
 
                                                                 

   

                                                                          
module type GEMINI_TRANSACTION =
sig
  type request

  module T : TlsUtils.TLS_UTILS

  module M : MimeType.MIME_TYPE

  type mime_type = M.t

  type status =
    | INPUT
    | SUCCESS of mime_type
    | SUCCESS_EOCSS
    | 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 response = status * 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 status_of_string : string -> (status, string) Base.Result.t

  val int_of_status : status -> int

  val name_of_status : status -> string

  val string_of_status : status -> string

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

  val session : request -> (response, string) 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