summaryrefslogblamecommitdiff
path: root/gemini/geminiTransaction.mli
blob: d103afed22eb788952cffe0609678f6e9d38bebd (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 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