From 8b5b6b12c07a0a4520349a270839696bb9ff11d2 Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Sun, 31 May 2020 22:30:55 -0400 Subject: mimetype stub --- gemini/mimeType.ml | 37 +++++++++++++++++++++++++++++++++++++ gemini/mimeType.mli | 16 ++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 gemini/mimeType.ml create mode 100644 gemini/mimeType.mli diff --git a/gemini/mimeType.ml b/gemini/mimeType.ml new file mode 100644 index 0000000..0559168 --- /dev/null +++ b/gemini/mimeType.ml @@ -0,0 +1,37 @@ +module type MIME_TYPE = +sig + type t + + exception ParseError of string + + val from_string : string -> t + + val to_type : t -> string + + val to_subtype : t -> string + + val to_parameter : t -> (string * string) option +end + +module MimeType : MIME_TYPE = +struct + + type t = + { mime_type : string; + mime_subtype : string; + mime_param : (string * string) option; + } + + exception ParseError of string + + let from_string _ = { mime_type = "text"; + mime_subtype = "plain"; + mime_param = None } + + let to_type m = m.mime_type + + let to_subtype m = m.mime_subtype + + let to_parameter m = m.mime_param + +end diff --git a/gemini/mimeType.mli b/gemini/mimeType.mli new file mode 100644 index 0000000..6075ef9 --- /dev/null +++ b/gemini/mimeType.mli @@ -0,0 +1,16 @@ +module type MIME_TYPE = +sig + type t + + exception ParseError of string + + val from_string : string -> t + + val to_type : t -> string + + val to_subtype : t -> string + + val to_parameter : t -> (string * string) option +end + +module MimeType : MIME_TYPE -- cgit v1.2.3