From e4d7122dc3fe215fc73a6901be9b18d277387b3c Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Sat, 6 Jun 2020 10:38:37 -0400 Subject: Clarify statuses and add preliminary transaction support --- gemini/geminiTransaction.mli | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'gemini/geminiTransaction.mli') diff --git a/gemini/geminiTransaction.mli b/gemini/geminiTransaction.mli index b31d9e0..ecd7349 100644 --- a/gemini/geminiTransaction.mli +++ b/gemini/geminiTransaction.mli @@ -2,19 +2,23 @@ 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 + | SUCCESS of mime_type | SUCCESS_EOCSS - | REDIR_TEMP - | REDIR_PERM + | REDIR_TEMP of string + | REDIR_PERM of string | TEMP_FAIL | SERVER_UNAVAILABLE | CGI_ERROR | PROXY_ERROR - | SLOW_DOWN + | SLOW_DOWN of int | PERM_FAIL | NOT_FOUND | GONE @@ -26,17 +30,28 @@ sig | CERT_NOT_ACCEPTED | FUTURE_CERT_REJECTED | EXPIRED_CERT_REJECTED - | UNDEFINED of int - type mime_type = M.t + 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 - type response = status * mime_type * string + val name_of_status : status -> string - val make_request : url:string -> request + val string_of_status : status -> string - val int_to_status : int -> status + val transaction : request -> (response, string) Base.Result.t Lwt.t - val transaction : request -> (response, string) result Lwt.t + val session : request -> (response, string) Base.Result.t Lwt.t end -module GeminiTransaction (M : MimeType.MIME_TYPE) : GEMINI_TRANSACTION with module M = M +module GeminiTransaction (M : MimeType.MIME_TYPE) (T : TlsUtils.TLS_UTILS) + : GEMINI_TRANSACTION with module M = M and module T = T -- cgit v1.2.3