From: Stefano Zacchiroli Date: Wed, 25 Dec 2002 15:15:25 +0000 (+0000) Subject: - added string_of_method and method_of_string functions X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=60b92fe3e560a9ec860183ab58d9b3142e999d59;p=helm.git - added string_of_method and method_of_string functions - removed http_version constant (already in Http_constants module) - opend Http_types in .mli --- diff --git a/helm/DEVEL/ocaml-http/http_common.ml b/helm/DEVEL/ocaml-http/http_common.ml index ed595590d..23beaf9ae 100644 --- a/helm/DEVEL/ocaml-http/http_common.ml +++ b/helm/DEVEL/ocaml-http/http_common.ml @@ -39,6 +39,15 @@ let version_of_string = function | "HTTP/1.1" -> `HTTP_1_1 | invalid_version -> raise (Invalid_HTTP_version invalid_version) +let string_of_method = function + | `GET -> "GET" + | `POST -> "POST" + +let method_of_string = function + | "GET" -> `GET + | "POST" -> `POST + | invalid_method -> raise (Invalid_HTTP_method invalid_method) + let status_of_code = function | 100 -> `Informational `Continue | 101 -> `Informational `Switching_protocols diff --git a/helm/DEVEL/ocaml-http/http_common.mli b/helm/DEVEL/ocaml-http/http_common.mli index af76440cf..aceeb2842 100644 --- a/helm/DEVEL/ocaml-http/http_common.mli +++ b/helm/DEVEL/ocaml-http/http_common.mli @@ -21,20 +21,25 @@ (** Common functionalities *) +open Http_types;; + (** whether debugging messages are enabled or not, can be changed at runtime *) val debug: bool ref (** print a string on stderr only if debugging is enabled *) val debug_print: string -> unit -val http_version: Http_types.version +val http_version: version val server_string: string -val string_of_version: Http_types.version -> string -val version_of_string: string -> Http_types.version +val string_of_version: version -> string +val version_of_string: string -> version + +val string_of_method: meth -> string +val method_of_string: string -> meth -val status_of_code: int -> Http_types.status -val code_of_status: [< Http_types.status] -> int +val status_of_code: int -> status +val code_of_status: [< status] -> int val is_informational: int -> bool val is_success: int -> bool