From 5e45ecb0350d044b741db6d07397bd9840afd1be Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Thu, 5 Jan 2023 21:56:17 +0100 Subject: [PATCH] Dependency on ocaml_http replaced by ocaml_http_stubs stubs - the stubs always fail with an assert false - the code is still live in Matita, but currently unused in practice - ocaml_http depends on ocamlnet, that is way too hard to port completely to ocaml 5.0.0. A better path to restore the lost functionalities is to reimplement ocaml_http_stubs on modern libraries (e.g. lwt-cohttp) --- matita/components/ocaml_http_stubs/README | 7 +++++++ matita/components/ocaml_http_stubs/dune | 12 ++++++++++++ .../components/ocaml_http_stubs/http_daemon.ml | 5 +++++ .../components/ocaml_http_stubs/http_daemon.mli | 13 +++++++++++++ .../components/ocaml_http_stubs/http_types.mli | 6 ++++++ .../ocaml_http_stubs/http_user_agent.ml | 7 +++++++ .../ocaml_http_stubs/http_user_agent.mli | 16 ++++++++++++++++ matita/dune-project | 5 +++-- matita/matita.opam | 2 -- 9 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 matita/components/ocaml_http_stubs/README create mode 100644 matita/components/ocaml_http_stubs/dune create mode 100644 matita/components/ocaml_http_stubs/http_daemon.ml create mode 100644 matita/components/ocaml_http_stubs/http_daemon.mli create mode 100644 matita/components/ocaml_http_stubs/http_types.mli create mode 100644 matita/components/ocaml_http_stubs/http_user_agent.ml create mode 100644 matita/components/ocaml_http_stubs/http_user_agent.mli diff --git a/matita/components/ocaml_http_stubs/README b/matita/components/ocaml_http_stubs/README new file mode 100644 index 000000000..7c9b60453 --- /dev/null +++ b/matita/components/ocaml_http_stubs/README @@ -0,0 +1,7 @@ +This is a stub library for Zacchiroli's ocaml-http library. +All the stubs, if called, just abort the program. +The interface files are a minimal, proper subset of the ones of ocaml-http +that only list the values used by matita. + +ocaml-http is copyrighted under the GNU Library General Public License as +published by the Free Software Foundation, version 2. diff --git a/matita/components/ocaml_http_stubs/dune b/matita/components/ocaml_http_stubs/dune new file mode 100644 index 000000000..34c1e99a4 --- /dev/null +++ b/matita/components/ocaml_http_stubs/dune @@ -0,0 +1,12 @@ +(library + (name http) + ;(libraries) + ;(modules (:standard \ componentsConf)) + (modules_without_implementation http_types) + (wrapped false)) +(env + (_ + (flags (:standard -w -27)))) +;(env + ;(_ + ;(flags (:standard -w @A-52-4-34-37-45-9-44-48-6-32-20-58-7-57-3-68-69-70-50)))) diff --git a/matita/components/ocaml_http_stubs/http_daemon.ml b/matita/components/ocaml_http_stubs/http_daemon.ml new file mode 100644 index 000000000..9e046cd7d --- /dev/null +++ b/matita/components/ocaml_http_stubs/http_daemon.ml @@ -0,0 +1,5 @@ +let send_basic_headers ?version ~code _ = assert false + +let send_headers ~headers _ = assert false + +let send_CRLF _ = assert false diff --git a/matita/components/ocaml_http_stubs/http_daemon.mli b/matita/components/ocaml_http_stubs/http_daemon.mli new file mode 100644 index 000000000..e30f3982b --- /dev/null +++ b/matita/components/ocaml_http_stubs/http_daemon.mli @@ -0,0 +1,13 @@ +(* The interface of this stub file is taken from the equally named module + of the ocaml-http library *) + +val send_basic_headers: + ?version: Http_types.version -> code:Http_types.status_code -> + out_channel -> + unit + +val send_headers: + headers:(string * string) list -> out_channel -> unit + +val send_CRLF: + out_channel -> unit diff --git a/matita/components/ocaml_http_stubs/http_types.mli b/matita/components/ocaml_http_stubs/http_types.mli new file mode 100644 index 000000000..356d2d9fc --- /dev/null +++ b/matita/components/ocaml_http_stubs/http_types.mli @@ -0,0 +1,6 @@ +(* The interface of this stub file is taken from the equally named module + of the ocaml-http library *) + +type version +type status +type status_code = [ `Code of int | `Status of status ] diff --git a/matita/components/ocaml_http_stubs/http_user_agent.ml b/matita/components/ocaml_http_stubs/http_user_agent.ml new file mode 100644 index 000000000..90c6deed4 --- /dev/null +++ b/matita/components/ocaml_http_stubs/http_user_agent.ml @@ -0,0 +1,7 @@ +exception Http_error of (int * string) + +let get ?head_callback _ = assert false + +let get_iter ?head_callback _ _ = assert false + +let head _ = assert false diff --git a/matita/components/ocaml_http_stubs/http_user_agent.mli b/matita/components/ocaml_http_stubs/http_user_agent.mli new file mode 100644 index 000000000..af818b113 --- /dev/null +++ b/matita/components/ocaml_http_stubs/http_user_agent.mli @@ -0,0 +1,16 @@ +(* The interface of this stub file is taken from the equally named module + of the ocaml-http library *) + +exception Http_error of (int * string) + +val get: + ?head_callback:(Http_types.status -> (string * string) list -> unit) -> + string -> + string + +val get_iter: + ?head_callback:(Http_types.status -> (string * string) list -> unit) -> + (bytes -> unit) -> string -> + unit + +val head: string -> string diff --git a/matita/dune-project b/matita/dune-project index 1efcd6a16..160e70a8a 100644 --- a/matita/dune-project +++ b/matita/dune-project @@ -33,8 +33,9 @@ (ulex-camlp5 (>= 1.3)) (ocaml-expat (>= 1.1.0)) (pcre (>= 7.5.0)) - (ocamlnet (>= 4.1.9.git)) ; used only by ocaml-http - (ocaml-http (>= 0.1.6)) + ;(ocamlnet (>= 4.1.9.git)) ; used only by ocaml-http + ;(ocaml-http (>= 0.1.6)) ; no longer really used, replaced by failing stubs + ; in components/ocaml_http_stubs (camlzip (>= 1.11)) (lablgtk3-sourceview3 (>= 3.1.3)) dune-build-info diff --git a/matita/matita.opam b/matita/matita.opam index a16eb59e9..37cccbb14 100644 --- a/matita/matita.opam +++ b/matita/matita.opam @@ -19,8 +19,6 @@ depends: [ "ulex-camlp5" {>= "1.3"} "ocaml-expat" {>= "1.1.0"} "pcre" {>= "7.5.0"} - "ocamlnet" {>= "4.1.9.git"} - "ocaml-http" {>= "0.1.6"} "camlzip" {>= "1.11"} "lablgtk3-sourceview3" {>= "3.1.3"} "dune-build-info" -- 2.39.2