summaryrefslogtreecommitdiff
path: root/gemini
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--gemini/mimeType.ml37
-rw-r--r--gemini/mimeType.mli16
2 files changed, 53 insertions, 0 deletions
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