summaryrefslogtreecommitdiff
path: root/gemini/geminiTransaction.mli
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@rak.ac>2020-06-06 10:38:37 -0400
committerRyan Kavanagh <rak@rak.ac>2020-06-07 11:39:58 -0400
commite4d7122dc3fe215fc73a6901be9b18d277387b3c (patch)
tree681c400b40d0f8b9c477d11eb4260fabac709ea0 /gemini/geminiTransaction.mli
parentAdded some TLS utilities (diff)
Clarify statuses and add preliminary transaction support
Diffstat (limited to '')
-rw-r--r--gemini/geminiTransaction.mli37
1 files changed, 26 insertions, 11 deletions
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