Switched www/ocsigenserver to use ocaml-xml-light parser

This is a patch from upstream, applied before release as the new version
of tyxml already removed the parser from distribution.
This commit is contained in:
jaapb 2018-11-29 10:54:14 +00:00
parent 37042c4cdb
commit 750780ae3c
27 changed files with 1089 additions and 26 deletions

View file

@ -1,10 +1,10 @@
# $NetBSD: Makefile,v 1.33 2018/11/12 16:10:29 jaapb Exp $
# $NetBSD: Makefile,v 1.34 2018/11/29 10:54:14 jaapb Exp $
#
VERSION= 2.9
GITHUB_PROJECT= ocsigenserver
PKGNAME= ocsigen-${VERSION}
PKGREVISION= 3
PKGREVISION= 4
DISTNAME= ${GITHUB_PROJECT}-${VERSION}
CATEGORIES= www
MASTER_SITES= ${MASTER_SITE_GITHUB:=ocsigen/}
@ -81,4 +81,5 @@ post-extract:
.include "../../security/ocaml-cryptokit/buildlink3.mk"
.include "../../security/ocaml-ssl/buildlink3.mk"
.include "../../textproc/ocaml-tyxml/buildlink3.mk"
.include "../../textproc/ocaml-xml-light/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,19 +1,37 @@
$NetBSD: distinfo,v 1.11 2018/04/13 13:15:00 jaapb Exp $
$NetBSD: distinfo,v 1.12 2018/11/29 10:54:14 jaapb Exp $
SHA1 (ocsigenserver-2.9.tar.gz) = 1b4d50c9b6fff3ab78c8aef3ebbde1f8ddcc594e
RMD160 (ocsigenserver-2.9.tar.gz) = f5114a7bda3327e279f57f40336a7c23e19b66ce
SHA512 (ocsigenserver-2.9.tar.gz) = b3c5a86785feac18bac677ebb3736705f5d015a8692d2811bf22009dc319636e8b7bbb54dfd0223b2040a8f8bdef5ca3336d903b5ecd7eb260e8c0d48946ee46
Size (ocsigenserver-2.9.tar.gz) = 1265175 bytes
SHA1 (patch-Makefile) = 637a45aacd7c8afaeb73be624eb7732b21e78b4d
SHA1 (patch-Makefile.options) = 6b59e2d20cc0a47c56a9b11cba56cd70d7dc9beb
SHA1 (patch-configure) = 9b1c5c373e36169eb1b86daba0f9214845513082
SHA1 (patch-Makefile.options) = 3e88ca4a0d04e01a4cb61e88aaec1b013ff0de5e
SHA1 (patch-configure) = ed7a047081dfd233b95d4c25cb5832cb65bbcb11
SHA1 (patch-src_baselib_Makefile) = e2fd5e5bd933d4ec844713c8f574efd5fa8426cf
SHA1 (patch-src_baselib_ocsigen__stream.ml) = 6907fd8f7e0295f5147a0f2322cb1bec28f73953
SHA1 (patch-src_extensions_Makefile) = 5f3af59550f5b576e39323b7cd1252ee70fd282b
SHA1 (patch-src_extensions_cgimod.ml) = 6f5093a1a93a5797ce47c33b9704e45f8aa6c2c5
SHA1 (patch-src_extensions_ocsipersist-pgsql_Makefile) = 223b8f652ccd4144fbe3c0f67c6fdd3cdf6fa0aa
SHA1 (patch-src_extensions_ocsipersist-sqlite_Makefile) = 916733e0732ec58f502aeee5769fde1ed7060a9f
SHA1 (patch-src_extensions_Makefile) = 1dc200d1bd7a55424830acc5e79140e5e996c762
SHA1 (patch-src_extensions_accesscontrol.ml) = a02101ea97747bb139f72413eb4f4a9ee738692e
SHA1 (patch-src_extensions_accesscontrol.mli) = 19a67e7e43a9411616d8893d2886e4f048a107d8
SHA1 (patch-src_extensions_authbasic.ml) = 8179c77352d52965d17c98d0ea3454cb3ff6e090
SHA1 (patch-src_extensions_authbasic.mli) = 718c05392e48579a72b251a5966933b39bb7eff2
SHA1 (patch-src_extensions_cgimod.ml) = ba572df1ab27f3e090bc1a1e032c1430113995ed
SHA1 (patch-src_extensions_deflatemod.ml) = 16a4bb7a048930053120636f474297ff3c78d471
SHA1 (patch-src_extensions_extendconfiguration.ml) = beb1a298427ea0d4c19326f29503eee7bd6b3dcb
SHA1 (patch-src_extensions_extensiontemplate.ml) = 805bf033a8fc7a1ecd3532411b2defdb82eeaad4
SHA1 (patch-src_extensions_ocsipersist-dbm_Makefile) = 2b73b0fa5594bc0542393e005d2979737a28d9bc
SHA1 (patch-src_extensions_ocsipersist-dbm_ocsipersist.ml) = f747c7e54f23cf29fabbe972e6f5e43c952ce1d1
SHA1 (patch-src_extensions_ocsipersist-pgsql_Makefile) = e3fa0e4691aa098826b93e67503a9116b28e5efb
SHA1 (patch-src_extensions_ocsipersist-pgsql_ocsipersist.ml) = 3984d34c71965a2e0d02bf5da547b437911d7f38
SHA1 (patch-src_extensions_ocsipersist-sqlite_Makefile) = 30bf60665d816ddb5cf1320ae5fdb51d7a50cb86
SHA1 (patch-src_extensions_ocsipersist-sqlite_ocsipersist.ml) = 8a227e10de4fd5cec0f2f1b8b8aa88578d69056e
SHA1 (patch-src_extensions_revproxy.ml) = e834ef862baed57310e3fe710905904298a3ac1d
SHA1 (patch-src_extensions_rewritemod.ml) = cac9b8d6fa815bc2098de9eb5c6346c8d4a795f4
SHA1 (patch-src_extensions_userconf.ml) = 8d62d77f760ee1027794698f88fc4e4da2de3eeb
SHA1 (patch-src_http_Makefile) = 1bcfe69470fe53a8fc9b197fd95d21889646909d
SHA1 (patch-src_http_ocsigen__http__com.mli) = f1760bf423e8aae763992e57c13408aa01c6316f
SHA1 (patch-src_server_Makefile) = 0f315fb0533d3d0b8f8cf1f3a61e11b013571b05
SHA1 (patch-src_server_ocsigen__server.ml) = 17b9fc720d01e27a49576864a9d91c87deda85e3
SHA1 (patch-src_server_ocsigen__extensions.ml) = 7da60f1c1fc2c2370eac93829380cb108f40b2db
SHA1 (patch-src_server_ocsigen__extensions.mli) = c2c426d96446292dd850b23b7feb9d93d1b5590a
SHA1 (patch-src_server_ocsigen__parseconfig.ml) = b4a088c5cd3addb70dc4fa9a023878056fc9d1d1
SHA1 (patch-src_server_ocsigen__parseconfig.mli) = 2b4b091a91efa1bf99e861c82d7d971845947bf9
SHA1 (patch-src_server_ocsigen__server.ml) = 93c4dac4be34e68c65cf0814eb58954abcc31b1b

View file

@ -1,6 +1,7 @@
$NetBSD: patch-Makefile.options,v 1.4 2018/04/13 13:15:00 jaapb Exp $
$NetBSD: patch-Makefile.options,v 1.5 2018/11/29 10:54:14 jaapb Exp $
Support for preemptive threads is in lwt.unix now
Replace tyxml.parser with xml-light (patch from upstream)
--- Makefile.options.orig 2018-02-01 12:55:17.000000000 +0000
+++ Makefile.options
@@ -25,7 +25,7 @@ endif
@ -12,3 +13,12 @@ Support for preemptive threads is in lwt.unix now
endif
BASE_PACKAGE := lwt ipaddr bytes
@@ -39,7 +39,7 @@ SERVER_PACKAGE := lwt_ssl \
findlib \
cryptokit \
tyxml \
- tyxml.parser \
+ xml-light \
dynlink \
INITPACKAGE := \"$(shell ${OCAMLFIND} query -p-format -recursive \

View file

@ -1,6 +1,7 @@
$NetBSD: patch-configure,v 1.2 2018/04/13 13:15:00 jaapb Exp $
$NetBSD: patch-configure,v 1.3 2018/11/29 10:54:14 jaapb Exp $
Support for preemptive threads is in lwt.unix now
Replace tyxml.parser with xml-light (patch from upstream)
--- configure.orig 2018-02-01 12:55:17.000000000 +0000
+++ configure
@@ -412,7 +412,7 @@ check_library lwt "See: http://ocsigen.o
@ -12,7 +13,15 @@ Support for preemptive threads is in lwt.unix now
check_library netstring \
"See ocamlnet: http://projects.camlcity.org/projects/ocamlnet.html"
@@ -464,10 +464,10 @@ fi
@@ -425,6 +425,7 @@ check_library pcre "See: http://ocaml.in
check_library cryptokit "See: http://pauillac.inria.fr/~xleroy/software.html#cryptokit"
check_library tyxml "See: http://ocsigen.org/tyxml/"
+check_library xml-light "See: https://github.com/ncannasse/xml-light"
# Check PostgreSQL
case "$with_pgsql" in
@@ -464,10 +465,10 @@ fi
# Check Lwt.preemptive
if [ "$with_preempt" -gt 0 ]; then

View file

@ -1,6 +1,7 @@
$NetBSD: patch-src_extensions_Makefile,v 1.4 2018/04/13 13:15:00 jaapb Exp $
$NetBSD: patch-src_extensions_Makefile,v 1.5 2018/11/29 10:54:14 jaapb Exp $
The lwt_log package has been separated from lwt
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/Makefile.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/Makefile
@@ -8,7 +8,8 @@ PACKAGE := \
@ -8,7 +9,7 @@ The lwt_log package has been separated from lwt
netstring \
netstring-pcre \
- tyxml.parser
+ tyxml.parser \
+ xml-light \
+ lwt_log
LIBS := -I ../baselib -I ../http -I ../server ${addprefix -package ,${PACKAGE}}

View file

@ -0,0 +1,259 @@
$NetBSD: patch-src_extensions_accesscontrol.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/accesscontrol.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/accesscontrol.ml
@@ -32,7 +32,6 @@ open Ocsigen_lib
open Printf
open Lwt
open Ocsigen_extensions
-open Simplexmlparser
open Ocsigen_http_frame
@@ -43,7 +42,7 @@ let section = Lwt_log.Section.make "ocsi
let rec parse_condition = function
- | Element ("ip", ["value", s], []) ->
+ | Xml.Element ("ip", ["value", s], []) ->
let prefix =
try
Ipaddr.Prefix.of_string_exn s
@@ -67,9 +66,9 @@ let rec parse_condition = function
"IP: %a does not match %s"
(fun () -> Ocsigen_request_info.remote_ip) ri s;
r)
- | Element ("ip" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("ip" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("port", ["value", s], []) ->
+ | Xml.Element ("port", ["value", s], []) ->
let port =
try
int_of_string s
@@ -87,9 +86,9 @@ let rec parse_condition = function
(fun () ri -> string_of_int (Ocsigen_request_info.server_port ri))
ri port;
r)
- | Element ("port" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("port" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("ssl", [], []) ->
+ | Xml.Element ("ssl", [], []) ->
(fun ri ->
let r = Ocsigen_request_info.ssl ri in
if r then
@@ -97,9 +96,9 @@ let rec parse_condition = function
else
Lwt_log.ign_info ~section "SSL: not accepted";
r)
- | Element ("ssl" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("ssl" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("header", ["name", name; "regexp", reg], []) ->
+ | Xml.Element ("header", ["name", name; "regexp", reg], []) ->
let regexp =
try
Netstring_pcre.regexp ("^"^reg^"$")
@@ -126,9 +125,9 @@ let rec parse_condition = function
if not r
then Lwt_log.ign_info_f "HEADER: header %s does not match %S" name reg;
r)
- | Element ("header" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("header" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("method", ["value", s], []) ->
+ | Xml.Element ("method", ["value", s], []) ->
let meth =
try
Framepp.method_of_string s
@@ -146,9 +145,9 @@ let rec parse_condition = function
"METHOD: %a does not match %s"
(fun () ri -> Framepp.string_of_method (Ocsigen_request_info.meth ri)) ri s;
r)
- | Element ("method" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("method" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("protocol", ["value", s], []) ->
+ | Xml.Element ("protocol", ["value", s], []) ->
let pr =
try
Framepp.proto_of_string s
@@ -166,9 +165,9 @@ let rec parse_condition = function
"PROTOCOL: %a does not match %s"
(fun () ri -> Framepp.string_of_proto (Ocsigen_request_info.protocol ri)) ri s;
r)
- | Element ("protocol" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("protocol" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("path", ["regexp", s], []) ->
+ | Xml.Element ("path", ["regexp", s], []) ->
let regexp =
try
Netstring_pcre.regexp ("^"^s^"$")
@@ -189,22 +188,22 @@ let rec parse_condition = function
"PATH: \"%a\" does not match %S"
(fun () ri -> Ocsigen_request_info.sub_path_string ri) ri s;
r)
- | Element ("path" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("path" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("and", [], sub) ->
+ | Xml.Element ("and", [], sub) ->
let sub = List.map parse_condition sub in
(fun ri -> List.for_all (fun cond -> cond ri) sub)
- | Element ("and" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("and" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("or", [], sub) ->
+ | Xml.Element ("or", [], sub) ->
let sub = List.map parse_condition sub in
(fun ri -> List.exists (fun cond -> cond ri) sub)
- | Element ("or" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("or" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("not", [], [sub]) ->
+ | Xml.Element ("not", [], [sub]) ->
let sub = parse_condition sub in
(fun ri -> not (sub ri))
- | Element ("not" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("not" as s, _, _) -> badconfig "Bad syntax for tag %s" s
| _ ->
badconfig "Bad syntax for condition"
@@ -217,17 +216,17 @@ let comma_space_regexp = Netstring_pcre.
let parse_config parse_fun = function
- | Element ("if", [], sub) ->
+ | Xml.Element ("if", [], sub) ->
let (condition, sub) = match sub with
| cond::q -> (parse_condition cond, q)
| _ -> badconfig "Bad condition in <if>"
in
let (ithen, sub) = match sub with
- | Element("then", [], ithen)::q -> (parse_fun ithen, q)
+ | Xml.Element("then", [], ithen)::q -> (parse_fun ithen, q)
| _ -> badconfig "Bad <then> branch in <if>"
in
let (ielse, sub) = match sub with
- | Element ("else", [], ielse)::([] as q) -> (parse_fun ielse, q)
+ | Xml.Element ("else", [], ielse)::([] as q) -> (parse_fun ielse, q)
| [] -> (parse_fun [], [])
| _ -> badconfig "Bad <else> branch in <if>"
in
@@ -243,17 +242,17 @@ let parse_config parse_fun = function
Lwt_log.ign_info ~section "COND: going into <else> branch, if any";
Ocsigen_extensions.Ext_sub_result ielse
end))
- | Element ("if" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("if" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("notfound", [], []) ->
+ | Xml.Element ("notfound", [], []) ->
(fun rs ->
Lwt_log.ign_info ~section "NOT_FOUND: taking in charge 404";
Lwt.return (Ocsigen_extensions.Ext_stop_all
(Ocsigen_cookies.Cookies.empty, 404)))
- | Element ("notfound" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("notfound" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("nextsite", [], []) ->
+ | Xml.Element ("nextsite", [], []) ->
(function
| Ocsigen_extensions.Req_found (_, r) ->
Lwt.return (Ocsigen_extensions.Ext_found_stop
@@ -262,7 +261,7 @@ let parse_config parse_fun = function
Lwt.return (Ocsigen_extensions.Ext_stop_site
(Ocsigen_cookies.Cookies.empty, 404)))
- | Element ("nexthost", [], []) ->
+ | Xml.Element ("nexthost", [], []) ->
(function
| Ocsigen_extensions.Req_found (_, r) ->
Lwt.return (Ocsigen_extensions.Ext_found_stop
@@ -270,9 +269,9 @@ let parse_config parse_fun = function
| Ocsigen_extensions.Req_not_found (err, ri) ->
Lwt.return (Ocsigen_extensions.Ext_stop_host
(Ocsigen_cookies.Cookies.empty, 404)))
- | Element ("nextsite" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("nextsite" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("stop", [], []) ->
+ | Xml.Element ("stop", [], []) ->
(function
| Ocsigen_extensions.Req_found (_, r) ->
Lwt.return (Ocsigen_extensions.Ext_found_stop
@@ -280,25 +279,25 @@ let parse_config parse_fun = function
| Ocsigen_extensions.Req_not_found (err, ri) ->
Lwt.return (Ocsigen_extensions.Ext_stop_all
(Ocsigen_cookies.Cookies.empty, 404)))
- | Element ("stop" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("stop" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("forbidden", [], []) ->
+ | Xml.Element ("forbidden", [], []) ->
(fun rs ->
Lwt_log.ign_info ~section "FORBIDDEN: taking in charge 403";
Lwt.return (Ocsigen_extensions.Ext_stop_all
(Ocsigen_cookies.Cookies.empty, 403)))
- | Element ("forbidden" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("forbidden" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("iffound", [], sub) ->
+ | Xml.Element ("iffound", [], sub) ->
let ext = parse_fun sub in
(function
| Ocsigen_extensions.Req_found (_, _) ->
Lwt.return (Ext_sub_result ext)
| Ocsigen_extensions.Req_not_found (err, ri) ->
Lwt.return (Ocsigen_extensions.Ext_next err))
- | Element ("iffound" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("iffound" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("ifnotfound", [], sub) ->
+ | Xml.Element ("ifnotfound", [], sub) ->
let ext = parse_fun sub in
(function
| Ocsigen_extensions.Req_found (_, r) ->
@@ -306,7 +305,7 @@ let parse_config parse_fun = function
(fun () -> Lwt.return r))
| Ocsigen_extensions.Req_not_found (err, ri) ->
Lwt.return (Ext_sub_result ext))
- | Element ("ifnotfound", [("code", s)], sub) ->
+ | Xml.Element ("ifnotfound", [("code", s)], sub) ->
let ext = parse_fun sub in
let r = Netstring_pcre.regexp ("^"^s^"$") in
(function
@@ -318,9 +317,9 @@ let parse_config parse_fun = function
Lwt.return (Ext_sub_result ext)
else
Lwt.return (Ocsigen_extensions.Ext_next err))
- | Element ("ifnotfound" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("ifnotfound" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("allow-forward-for", param, _) ->
+ | Xml.Element ("allow-forward-for", param, _) ->
let apply request code =
Lwt_log.ign_info ~section "Allowed proxy";
let request =
@@ -372,7 +371,7 @@ let parse_config parse_fun = function
apply request (Ocsigen_http_frame.Result.code resp)
| Ocsigen_extensions.Req_not_found (code, request) -> apply request code)
- | Element ("allow-forward-proto", _, _) ->
+ | Xml.Element ("allow-forward-proto", _, _) ->
let apply request code =
Lwt_log.ign_info ~section "Allowed proxy for ssl";
let request =
@@ -406,7 +405,7 @@ let parse_config parse_fun = function
| Ocsigen_extensions.Req_found (request, resp) ->
apply request (Ocsigen_http_frame.Result.code resp)
| Ocsigen_extensions.Req_not_found (code, request) -> apply request code)
- | Element (t, _, _) -> raise (Bad_config_tag_for_extension t)
+ | Xml.Element (t, _, _) -> raise (Bad_config_tag_for_extension t)
| _ -> badconfig "(accesscontrol extension) Bad data"

View file

@ -0,0 +1,11 @@
$NetBSD: patch-src_extensions_accesscontrol.mli,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/accesscontrol.mli.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/accesscontrol.mli
@@ -20,4 +20,4 @@
val parse_condition :
- Simplexmlparser.xml -> Ocsigen_extensions.request_info -> bool
+ Xml.xml -> Ocsigen_extensions.request_info -> bool

View file

@ -0,0 +1,23 @@
$NetBSD: patch-src_extensions_authbasic.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/authbasic.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/authbasic.ml
@@ -55,7 +55,7 @@ let register_basic_authentication_method
(* Basic authentication with a predefined login/password (example) *)
let _ =
- let open Simplexmlparser in
+ let open Xml in
register_basic_authentication_method
(function
| Element ("plain", ["login", login; "password", password], _) ->
@@ -133,7 +133,7 @@ let parse_config element =
]
~other_elements:(fun name attrs content ->
rest_ref :=
- Simplexmlparser.Element (name, attrs, content) :: !rest_ref)
+ Xml.Element (name, attrs, content) :: !rest_ref)
()]
element
);

View file

@ -0,0 +1,23 @@
$NetBSD: patch-src_extensions_authbasic.mli,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/authbasic.mli.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/authbasic.mli
@@ -34,7 +34,7 @@
val register_basic_authentication_method :
- (Simplexmlparser.xml -> string -> string -> bool Lwt.t) -> unit
+ (Xml.xml -> string -> string -> bool Lwt.t) -> unit
(** This function registers an authentication plugin: it adds a new
parser to the list of available authentication schemes.
@@ -55,7 +55,7 @@ val register_basic_authentication_method
val get_basic_authentication_method :
- Simplexmlparser.xml -> string -> string -> bool Lwt.t
+ Xml.xml -> string -> string -> bool Lwt.t
(** This function combines all the parsers registered with
[register_basic_authentication_method]. It might be useful for
other extensions. Not for the casual user. *)

View file

@ -1,10 +1,19 @@
$NetBSD: patch-src_extensions_cgimod.ml,v 1.1 2018/04/13 13:15:00 jaapb Exp $
$NetBSD: patch-src_extensions_cgimod.ml,v 1.2 2018/11/29 10:54:14 jaapb Exp $
Write correct request URI
Lwt_chan no longer exists in Lwt 4, replaced by Lwt_io
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/cgimod.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/cgimod.ml
@@ -271,7 +271,8 @@ let array_environment filename re doc_ro
@@ -28,7 +28,6 @@ open Ocsigen_lib
open Lwt
open Ocsigen_extensions
-open Simplexmlparser
open Ocsigen_http_frame
open Ocsigen_http_com
open Ocsigen_senders
@@ -271,7 +270,8 @@ let array_environment filename re doc_ro
(* Neither in the CGI's spec nor in the HTTP headers but used, e.g., by PHP *)
Printf.sprintf "REMOTE_PORT=%d" (Ocsigen_request_info.remote_port ri);
@ -14,7 +23,7 @@ Lwt_chan no longer exists in Lwt 4, replaced by Lwt_io
(* FIXME: URI instead of URL ? *)
Printf.sprintf "SCRIPT_FILENAME=%s" filename ] ;
additionnal_headers
@@ -368,7 +369,7 @@ let recupere_cgi head re doc_root filena
@@ -368,7 +368,7 @@ let recupere_cgi head re doc_root filena
Lwt_timeout.start timeout;
(* A thread giving POST data to the CGI script: *)
@ -23,7 +32,7 @@ Lwt_chan no longer exists in Lwt 4, replaced by Lwt_io
ignore
(catch
(fun () ->
@@ -376,7 +377,7 @@ let recupere_cgi head re doc_root filena
@@ -376,7 +376,7 @@ let recupere_cgi head re doc_root filena
| None -> Lwt_unix.close post_in
| Some content_post ->
Ocsigen_http_com.write_stream post_in_ch content_post >>= fun () ->
@ -32,7 +41,7 @@ Lwt_chan no longer exists in Lwt 4, replaced by Lwt_io
Lwt_unix.close post_in
))
(*XXX Check possible errors! *)
@@ -391,9 +392,9 @@ let recupere_cgi head re doc_root filena
@@ -391,9 +391,9 @@ let recupere_cgi head re doc_root filena
(* A thread listening the error output of the CGI script
and writing them in warnings.log *)
@ -44,3 +53,30 @@ Lwt_chan no longer exists in Lwt 4, replaced by Lwt_io
Lwt_log.ign_warning ~section err;
get_errors ()
in ignore
@@ -456,7 +456,7 @@ let get_content str =
(*****************************************************************************)
let rec parse_global_config = function
| [] -> ()
- | (Element ("cgitimeout", [("value", s)], []))::[] ->
+ | (Xml.Element ("cgitimeout", [("value", s)], []))::[] ->
cgitimeout := int_of_string s
| _ -> raise (Error_in_config_file
("Unexpected content inside cgimod config"))
@@ -573,7 +573,7 @@ let gen reg = function
let rec set_env = function
| [] -> []
- | (Element("setenv", [("var",vr);("val",vl)], []))::l ->
+ | (Xml.Element("setenv", [("var",vr);("val",vl)], []))::l ->
if List.mem vr environment
then (Lwt_log.ign_info_f ~section "Variable no set %s" vr;
set_env l)
@@ -581,7 +581,7 @@ let rec set_env = function
| _ :: l -> raise (Error_in_config_file "Bad config tag for <cgi>")
let parse_config _ path _ _ = function
- | Element ("cgi", atts, l) ->
+ | Xml.Element ("cgi", atts, l) ->
let good_root r =
Regexp.quote (string_conform2 r)
in

View file

@ -0,0 +1,38 @@
$NetBSD: patch-src_extensions_deflatemod.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/deflatemod.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/deflatemod.ml
@@ -26,7 +26,6 @@
open Ocsigen_lib
open Lwt
open Ocsigen_extensions
-open Simplexmlparser
open Ocsigen_headers
let section = Lwt_log.Section.make "ocsigen:ext:deflate"
@@ -303,13 +302,13 @@ let filter choice_list = function
let rec parse_global_config = function
| [] -> ()
- | (Element ("compress", [("level", l)], []))::ll ->
+ | (Xml.Element ("compress", [("level", l)], []))::ll ->
let l = try int_of_string l
with Failure _ -> raise (Error_in_config_file
"Compress level should be an integer between 0 and 9") in
compress_level := if (l <= 9 && l >= 0) then l else 6 ;
parse_global_config ll
- | (Element ("buffer", [("size", s)], []))::ll ->
+ | (Xml.Element ("buffer", [("size", s)], []))::ll ->
let s = (try int_of_string s
with Failure _ -> raise (Error_in_config_file
"Buffer size should be a positive integer")) in
@@ -317,7 +316,7 @@ let rec parse_global_config = function
parse_global_config ll
(* TODO: Pas de filtre global pour l'instant
* le nom de balise contenttype est mauvais, au passage
- | (Element ("contenttype", [("compress", b)], choices))::ll ->
+ | (Xml.Element ("contenttype", [("compress", b)], choices))::ll ->
let l = (try parse_filter choices
with Not_found -> raise (Error_in_config_file
"Can't parse mime-type content")) in

View file

@ -0,0 +1,161 @@
$NetBSD: patch-src_extensions_extendconfiguration.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/extendconfiguration.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/extendconfiguration.ml
@@ -19,7 +19,6 @@
*)
open Lwt
open Ocsigen_extensions
-open Simplexmlparser
open Ocsigen_charset_mime
@@ -50,11 +49,11 @@ let gather_do_not_serve_files tag =
do_not_serve_extensions = extensions
}
- | Element ("regexp", ["regexp", f], []) :: q ->
+ | Xml.Element ("regexp", ["regexp", f], []) :: q ->
aux (f :: regexps, files, extensions) q
- | Element ("file", ["file", f], []) :: q ->
+ | Xml.Element ("file", ["file", f], []) :: q ->
aux (regexps, f :: files, extensions) q
- | Element ("extension", ["ext", f], []) :: q ->
+ | Xml.Element ("extension", ["ext", f], []) :: q ->
aux (regexps, files, f :: extensions) q
| _ :: q -> bad_config ("invalid options in tag " ^ tag)
@@ -78,14 +77,14 @@ let check_regexp_list =
let update_config usermode = function
- | Element ("listdirs", ["value", "true"], []) ->
+ | Xml.Element ("listdirs", ["value", "true"], []) ->
gen (fun config -> { config with list_directory_content = true })
- | Element ("listdirs", ["value", "false"], []) ->
+ | Xml.Element ("listdirs", ["value", "false"], []) ->
gen (fun config -> { config with list_directory_content = false })
- | Element ("listdirs" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("listdirs" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("followsymlinks", ["value", s], []) ->
+ | Xml.Element ("followsymlinks", ["value", s], []) ->
let v = match s with
| "never" -> DoNotFollowSymlinks
| "always" ->
@@ -100,17 +99,17 @@ let update_config usermode = function
bad_config ("Wrong value \""^s^"\" for option \"followsymlinks\"")
in
gen (fun config -> { config with follow_symlinks = v })
- | Element ("followsymlinks" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("followsymlinks" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("charset", attrs, exts) ->
+ | Xml.Element ("charset", attrs, exts) ->
let rec aux charset_assoc = function
| [] -> charset_assoc
- | Element ("extension", ["ext", extension; "value", charset], []) :: q ->
+ | Xml.Element ("extension", ["ext", extension; "value", charset], []) :: q ->
aux (update_charset_ext charset_assoc extension charset) q
- | Element ("file", ["file", file; "value", charset], []) :: q ->
+ | Xml.Element ("file", ["file", file; "value", charset], []) :: q ->
aux (update_charset_file charset_assoc file charset) q
- | Element ("regexp", ["regexp", regexp; "value", charset], []) :: q ->
+ | Xml.Element ("regexp", ["regexp", regexp; "value", charset], []) :: q ->
(try
let r = Netstring_pcre.regexp regexp in
aux (update_charset_regexp charset_assoc r charset) q
@@ -129,14 +128,14 @@ let update_config usermode = function
{ config with charset_assoc = aux config.charset_assoc exts })
- | Element ("contenttype", attrs, exts) ->
+ | Xml.Element ("contenttype", attrs, exts) ->
let rec aux mime_assoc = function
| [] -> mime_assoc
- | Element ("extension", ["ext", extension; "value", mime], []) :: q ->
+ | Xml.Element ("extension", ["ext", extension; "value", mime], []) :: q ->
aux (update_mime_ext mime_assoc extension mime) q
- | Element ("file", ["file", file; "value", mime], []) :: q ->
+ | Xml.Element ("file", ["file", file; "value", mime], []) :: q ->
aux (update_mime_file mime_assoc file mime) q
- | Element ("regexp", ["regexp", regexp; "value", mime], []) :: q ->
+ | Xml.Element ("regexp", ["regexp", regexp; "value", mime], []) :: q ->
(try
let r = Netstring_pcre.regexp regexp in
aux (update_mime_regexp mime_assoc r mime) q
@@ -155,10 +154,10 @@ let update_config usermode = function
{ config with mime_assoc = aux config.mime_assoc exts })
- | Element ("defaultindex", [], l) ->
+ | Xml.Element ("defaultindex", [], l) ->
let rec aux indexes = function
| [] -> List.rev indexes
- | Element ("index", [], [PCData f]) :: q ->
+ | Xml.Element ("index", [], [PCData f]) :: q ->
aux (f :: indexes) q
| _ :: q -> bad_config "subtags must be of the form \
<index>...</index> \
@@ -166,9 +165,9 @@ let update_config usermode = function
in
gen (fun config ->
{ config with default_directory_index = aux [] l })
- | Element ("defaultindex" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("defaultindex" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("hidefile", [], l) ->
+ | Xml.Element ("hidefile", [], l) ->
let do_not_serve = gather_do_not_serve_files "hidefile" l in
(try
check_regexp_list do_not_serve.do_not_serve_regexps;
@@ -177,9 +176,9 @@ let update_config usermode = function
join_do_not_serve do_not_serve config.do_not_serve_404 })
with Bad_regexp r ->
badconfig "Invalid regexp %s in %s" r "hidefile")
- | Element ("hidefile" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("hidefile" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("forbidfile", [], l) ->
+ | Xml.Element ("forbidfile", [], l) ->
let do_not_serve = gather_do_not_serve_files "forbidfile" l in
(try
check_regexp_list do_not_serve.do_not_serve_regexps;
@@ -188,28 +187,28 @@ let update_config usermode = function
join_do_not_serve do_not_serve config.do_not_serve_403 })
with Bad_regexp r ->
badconfig "Invalid regexp %s in %s" r "forbidfile")
- | Element ("forbidfile" as s, _, _) -> badconfig "Bad syntax for tag %s" s
+ | Xml.Element ("forbidfile" as s, _, _) -> badconfig "Bad syntax for tag %s" s
- | Element ("uploaddir", [], [PCData s]) ->
+ | Xml.Element ("uploaddir", [], [PCData s]) ->
if s = "" then
gen (fun config -> { config with uploaddir = None })
else
gen (fun config -> { config with uploaddir = Some s })
- | Element ("uploaddir" as s, _, _) ->
+ | Xml.Element ("uploaddir" as s, _, _) ->
badconfig "Bad syntax for tag %s" s
- | Element ("maxuploadfilesize" as tag, [], [PCData s]) ->
+ | Xml.Element ("maxuploadfilesize" as tag, [], [PCData s]) ->
let s =
try Ocsigen_parseconfig.parse_size_tag "uploaddir" s
with Ocsigen_config.Config_file_error _ ->
badconfig "Bad syntax for tag %s" tag
in
gen (fun config -> { config with maxuploadfilesize = s })
- | Element ("maxuploadfilesize" as s, _, _) ->
+ | Xml.Element ("maxuploadfilesize" as s, _, _) ->
badconfig "Bad syntax for tag %s" s
- | Element (t, _, _) -> raise (Bad_config_tag_for_extension t)
+ | Xml.Element (t, _, _) -> raise (Bad_config_tag_for_extension t)
| _ ->
raise (Error_in_config_file "Unexpected data in config file")

View file

@ -0,0 +1,42 @@
$NetBSD: patch-src_extensions_extensiontemplate.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/extensiontemplate.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/extensiontemplate.ml
@@ -41,7 +41,6 @@
open Lwt
open Ocsigen_extensions
-open Simplexmlparser
@@ -58,7 +57,7 @@ open Simplexmlparser
let rec parse_global_config = function
| [] -> ()
- | (Element ("myoption", [("myattr", s)], []))::ll -> ()
+ | (Xml.Element ("myoption", [("myattr", s)], []))::ll -> ()
| _ -> raise (Error_in_config_file
("Unexpected content inside extensiontemplate config"))
@@ -126,8 +125,8 @@ let gen = function
*)
let parse_config path _ parse_site = function
- | Element ("extensiontemplate", atts, []) -> gen
- | Element (t, _, _) -> raise (Bad_config_tag_for_extension t)
+ | Xml.Element ("extensiontemplate", atts, []) -> gen
+ | Xml.Element (t, _, _) -> raise (Bad_config_tag_for_extension t)
| _ ->
raise (Error_in_config_file "Unexpected data in config file")
@@ -173,7 +172,7 @@ let exn_handler = raise
{- raise [Bad_config_tag_for_extension] if it does not recognize that tag}
{- return something of type [extension] (filter or page generator)}}
*)
-let site_creator
+let site_creator
(hostpattern : Ocsigen_extensions.virtual_hosts)
(config_info : Ocsigen_extensions.config_info)
= parse_config

View file

@ -0,0 +1,14 @@
$NetBSD: patch-src_extensions_ocsipersist-dbm_Makefile,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/ocsipersist-dbm/Makefile.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/ocsipersist-dbm/Makefile
@@ -2,7 +2,7 @@ include ../../../Makefile.config
PACKAGE := ${LWT_PREEMPTIVE_PACKAGE} \
lwt.unix \
- tyxml.parser \
+ xml-light \
dbm \
LIBS := -I ../../baselib -I ../../http -I ../../server \

View file

@ -0,0 +1,36 @@
$NetBSD: patch-src_extensions_ocsipersist-dbm_ocsipersist.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/ocsipersist-dbm/ocsipersist.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/ocsipersist-dbm/ocsipersist.ml
@@ -38,26 +38,25 @@ let socketname = "socket"
(*****************************************************************************)
(** Internal functions: storage directory *)
-open Simplexmlparser
(** getting the directory from config file *)
let rec parse_global_config (store, ocsidbm, delayloading as d) = function
| [] -> d
- | Element ("delayloading", [("val", ("true" | "1"))], []) :: ll ->
+ | Xml.Element ("delayloading", [("val", ("true" | "1"))], []) :: ll ->
parse_global_config (store, ocsidbm, true) ll
- | Element ("store", [("dir", s)], []) :: ll ->
+ | Xml.Element ("store", [("dir", s)], []) :: ll ->
if store = None then
parse_global_config ((Some s), ocsidbm, delayloading) ll
else
Ocsigen_extensions.badconfig "Ocsipersist: Duplicate <store> tag"
- | Element ("ocsidbm", [("name", s)], []) :: ll ->
+ | Xml.Element ("ocsidbm", [("name", s)], []) :: ll ->
if ocsidbm = None then
parse_global_config (store, (Some s), delayloading) ll
else
Ocsigen_extensions.badconfig "Ocsipersist: Duplicate <ocsidbm> tag"
- | (Element (s,_,_))::ll -> Ocsigen_extensions.badconfig "Bad tag %s" s
+ | (Xml.Element (s,_,_))::ll -> Ocsigen_extensions.badconfig "Bad tag %s" s
| _ -> Ocsigen_extensions.badconfig
"Unexpected content inside Ocsipersist config"

View file

@ -1,13 +1,14 @@
$NetBSD: patch-src_extensions_ocsipersist-pgsql_Makefile,v 1.2 2018/04/13 13:15:00 jaapb Exp $
$NetBSD: patch-src_extensions_ocsipersist-pgsql_Makefile,v 1.3 2018/11/29 10:54:14 jaapb Exp $
The lwt_log package has been separated from lwt
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/ocsipersist-pgsql/Makefile.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/ocsipersist-pgsql/Makefile
@@ -1,6 +1,6 @@
include ../../../Makefile.config
-PACKAGE := tyxml.parser pgocaml lwt
+PACKAGE := tyxml.parser pgocaml lwt lwt_log
+PACKAGE := xml-light pgocaml lwt lwt_log
LIBS := -I ../../baselib -I ../../http -I ../../server \
${addprefix -package ,${PACKAGE}}

View file

@ -0,0 +1,18 @@
$NetBSD: patch-src_extensions_ocsipersist-pgsql_ocsipersist.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/ocsipersist-pgsql/ocsipersist.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/ocsipersist-pgsql/ocsipersist.ml
@@ -275,11 +275,9 @@ let fold_table = fold_step
let iter_block a b = failwith "Ocsipersist.iter_block: not implemented"
-
-open Simplexmlparser
let parse_global_config = function
| [] -> ()
- | [Element ("database", attrs, [])] -> let parse_attr = function
+ | [Xml.Element ("database", attrs, [])] -> let parse_attr = function
| ("host", h) -> host := Some h
| ("port", p) -> begin
try port := Some (int_of_string p)

View file

@ -1,14 +1,16 @@
$NetBSD: patch-src_extensions_ocsipersist-sqlite_Makefile,v 1.1 2018/04/13 13:15:00 jaapb Exp $
$NetBSD: patch-src_extensions_ocsipersist-sqlite_Makefile,v 1.2 2018/11/29 10:54:14 jaapb Exp $
The lwt_log package has been separated from lwt
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/ocsipersist-sqlite/Makefile.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/ocsipersist-sqlite/Makefile
@@ -1,8 +1,9 @@
include ../../../Makefile.config
-PACKAGE := lwt.preemptive \
- tyxml.parser \
+PACKAGE := lwt.unix \
tyxml.parser \
+ xml-light \
sqlite3 \
+ lwt_log

View file

@ -0,0 +1,18 @@
$NetBSD: patch-src_extensions_ocsipersist-sqlite_ocsipersist.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/ocsipersist-sqlite/ocsipersist.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/ocsipersist-sqlite/ocsipersist.ml
@@ -36,11 +36,10 @@ exception Ocsipersist_error
(*****************************************************************************)
-open Simplexmlparser
(** getting the directory from config file *)
let rec parse_global_config = function
| [] -> None
- | (Element ("database", [("file", s)], []))::[] -> Some s
+ | (Xml.Element ("database", [("file", s)], []))::[] -> Some s
| _ -> raise (Ocsigen_extensions.Error_in_config_file
("Unexpected content inside Ocsipersist config"))

View file

@ -0,0 +1,13 @@
$NetBSD: patch-src_extensions_revproxy.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/revproxy.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/revproxy.ml
@@ -42,7 +42,6 @@ open Ocsigen_lib
open Lwt
open Ocsigen_extensions
-open Simplexmlparser
let section = Lwt_log.Section.make "ocsigen:ext:revproxy"

View file

@ -0,0 +1,13 @@
$NetBSD: patch-src_extensions_rewritemod.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/rewritemod.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/rewritemod.ml
@@ -44,7 +44,6 @@
open Lwt
open Ocsigen_extensions
-open Simplexmlparser
let section = Lwt_log.Section.make "ocsigen:ext:rewritemod"

View file

@ -0,0 +1,24 @@
$NetBSD: patch-src_extensions_userconf.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/extensions/userconf.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/extensions/userconf.ml
@@ -98,11 +98,15 @@ let subresult new_req user_parse_site co
let conf_to_xml conf =
- try Simplexmlparser.xmlparser_file conf
+ try [Xml.parse_file conf]
with
| Sys_error _ -> raise NoConfFile
- | Simplexmlparser.Xml_parser_error s ->
- raise (Ocsigen_extensions.Error_in_config_file s)
+ | Xml.Error (s, loc) ->
+ let begin_char, end_char = Xml.range loc and line = Xml.line loc in
+ raise (Ocsigen_extensions.Error_in_config_file
+ (Printf.sprintf "%s, line %d, characters %d-%d"
+ (Xml.error_msg s)
+ line begin_char end_char))
let gen hostpattern sitepath (regexp, conf, url, prefix, localpath) = function

View file

@ -0,0 +1,104 @@
$NetBSD: patch-src_server_ocsigen__extensions.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/server/ocsigen_extensions.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/server/ocsigen_extensions.ml
@@ -291,13 +291,13 @@ and extension2 =
type extension = request_state -> answer Lwt.t
-type parse_fun = Simplexmlparser.xml list -> extension2
+type parse_fun = Xml.xml list -> extension2
type parse_host =
Parse_host of
(Url.path ->
- parse_host -> parse_fun -> Simplexmlparser.xml -> extension)
+ parse_host -> parse_fun -> Xml.xml -> extension)
let (hosts : (virtual_hosts * config_info * extension2) list ref) =
ref []
@@ -357,7 +357,7 @@ let new_url_of_directory_request request
(*****************************************************************************)
(* To give parameters to extensions: *)
-let dynlinkconfig = ref ([] : Simplexmlparser.xml list)
+let dynlinkconfig = ref ([] : Xml.xml list)
let set_config s = dynlinkconfig := s
let get_config () = !dynlinkconfig
@@ -458,7 +458,7 @@ let rec default_parse_config
prevpath
(Parse_host parse_host)
(parse_fun : parse_fun) = function
- | Simplexmlparser.Element ("site", atts, l) ->
+ | Xml.Element ("site", atts, l) ->
let rec parse_site_attrs (enc,dir) = function
| [] -> (match dir with
| None ->
@@ -550,7 +550,7 @@ let rec default_parse_config
Lwt.return (Ext_found_continue_with' (r, ri))
| Req_not_found (err, ri) ->
Lwt.return (Ext_sub_result ext))
- | Simplexmlparser.Element (tag,_,_) ->
+ | Xml.Element (tag,_,_) ->
raise (Bad_config_tag_for_extension tag)
| _ -> raise (Ocsigen_config.Config_file_error
("Unexpected content inside <host>"))
@@ -613,7 +613,7 @@ type parse_config = virtual_hosts -> con
and parse_config_user = userconf_info -> parse_config
and parse_config_aux =
Url.path -> parse_host ->
- (parse_fun -> Simplexmlparser.xml ->
+ (parse_fun -> Xml.xml ->
extension
)
@@ -621,11 +621,11 @@ and parse_config_aux =
let user_extension_void_fun_site : parse_config_user =
fun _ _ _ _ _ _ -> function
- | Simplexmlparser.Element (t, _, _) -> raise (Bad_config_tag_for_extension t)
+ | Xml.Element (t, _, _) -> raise (Bad_config_tag_for_extension t)
| _ -> raise (Error_in_config_file "Unexpected data in config file")
let extension_void_fun_site : parse_config = fun _ _ _ _ _ -> function
- | Simplexmlparser.Element (t, _, _) -> raise (Bad_config_tag_for_extension t)
+ | Xml.Element (t, _, _) -> raise (Bad_config_tag_for_extension t)
| _ -> raise (Error_in_config_file "Unexpected data in config file")
@@ -748,7 +748,7 @@ module Configuration = struct
elements : element list;
attributes : attribute list;
pcdata : (string -> unit) option;
- other_elements : (string -> (string * string) list -> Simplexmlparser.xml list -> unit) option;
+ other_elements : (string -> (string * string) list -> Xml.xml list -> unit) option;
other_attributes : (string -> string -> unit) option;
}
and element = string * element'
@@ -792,7 +792,7 @@ module Configuration = struct
let check_element_occurrence ~in_tag elements = function
| name, { obligatory = true } ->
let corresponding_element = function
- | Simplexmlparser.Element (name', _, _) -> name = name'
+ | Xml.Element (name', _, _) -> name = name'
| _ -> false
in
if not (List.exists corresponding_element elements) then
@@ -815,12 +815,12 @@ module Configuration = struct
let rec process_element ~in_tag ~elements:spec_elements
?pcdata:spec_pcdata ?other_elements:spec_other_elements =
function
- | Simplexmlparser.PCData str ->
+ | Xml.PCData str ->
let spec_pcdata =
Option.get (fun () -> ignore_blank_pcdata ~in_tag) spec_pcdata
in
spec_pcdata str
- | Simplexmlparser.Element (name, attributes, elements) ->
+ | Xml.Element (name, attributes, elements) ->
try
let spec = List.assoc name spec_elements in
List.iter

View file

@ -0,0 +1,72 @@
$NetBSD: patch-src_server_ocsigen__extensions.mli,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/server/ocsigen_extensions.mli.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/server/ocsigen_extensions.mli
@@ -262,7 +262,7 @@ type extension = request_state -> answer
the extension may want to modify the result (filters).
*)
-type parse_fun = Simplexmlparser.xml list -> extension2
+type parse_fun = Xml.xml list -> extension2
(** Type of the functions parsing the content of a <host> tag *)
type parse_host
@@ -305,7 +305,7 @@ and parse_config_user =
userconf_info -> parse_config
and parse_config_aux =
Url.path -> parse_host ->
- (parse_fun -> Simplexmlparser.xml ->
+ (parse_fun -> Xml.xml ->
extension
)
@@ -355,7 +355,7 @@ val register_extension :
?user_fun_site:parse_config_user ->
?begin_init:(unit -> unit) ->
?end_init:(unit -> unit) ->
- ?init_fun:(Simplexmlparser.xml list -> unit) ->
+ ?init_fun:(Xml.xml list -> unit) ->
?exn_handler:(exn -> string) ->
?respect_pipeline:bool ->
unit -> unit
@@ -388,7 +388,7 @@ module Configuration : sig
?elements:element list ->
?attributes:attribute list ->
?pcdata:(string -> unit) ->
- ?other_elements:(string -> (string * string) list -> Simplexmlparser.xml list -> unit) ->
+ ?other_elements:(string -> (string * string) list -> Xml.xml list -> unit) ->
?other_attributes:(string -> string -> unit) ->
unit -> element
@@ -416,17 +416,17 @@ module Configuration : sig
in_tag:string ->
elements:element list ->
?pcdata:(string -> unit) ->
- ?other_elements:(string -> (string * string) list -> Simplexmlparser.xml list -> unit) ->
- Simplexmlparser.xml -> unit
+ ?other_elements:(string -> (string * string) list -> Xml.xml list -> unit) ->
+ Xml.xml -> unit
(** Application of [process_element] on a list of XML elements. *)
val process_elements :
in_tag:string ->
elements:element list ->
?pcdata:(string -> unit) ->
- ?other_elements:(string -> (string * string) list -> Simplexmlparser.xml list -> unit) ->
+ ?other_elements:(string -> (string * string) list -> Xml.xml list -> unit) ->
?init:(unit -> unit) ->
- Simplexmlparser.xml list -> unit
+ Xml.xml list -> unit
(** The specification for ignoring blank PCDATA ('\n', '\r', ' ', '\t') and failing
otherwise (a reasonable default). *)
@@ -524,7 +524,7 @@ val get_numberofreloads : unit -> int
val get_init_exn_handler : unit -> exn -> string
-val set_config : Simplexmlparser.xml list -> unit
+val set_config : Xml.xml list -> unit
val client_of_connection : Ocsigen_http_com.connection -> client

View file

@ -0,0 +1,51 @@
$NetBSD: patch-src_server_ocsigen__parseconfig.ml,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/server/ocsigen_parseconfig.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/server/ocsigen_parseconfig.ml
@@ -24,7 +24,7 @@
open Ocsigen_lib
open Ocsigen_socket
-open Simplexmlparser
+open Xml
open Ocsigen_config
let section = Lwt_log.Section.make "ocsigen:config"
@@ -184,10 +184,7 @@ let parse_string_tag tag s =
let rec parser_config =
- let rec verify_empty = function
- | [] -> ()
- | _ -> raise (Config_file_error "Don't know what to do with trailing data")
- in let rec parse_servers n = function
+ let rec parse_servers n = function
| [] -> (match n with
| [] -> raise (Config_file_error ("<server> tag expected"))
| _ -> n)
@@ -203,14 +200,13 @@ let rec parser_config =
(* nouveau at the end *)
| _ -> raise (Config_file_error ("syntax error inside <ocsigen>"))
in function
- | (Element ("ocsigen", [], l))::ll ->
- verify_empty ll;
+ | (Element ("ocsigen", [], l)) ->
parse_servers [] l
| _ -> raise (Config_file_error "<ocsigen> tag expected")
let parse_ext file =
- parser_config (Simplexmlparser.xmlparser_file file)
+ parser_config (Xml.parse_file file)
let preloadfile config () = Ocsigen_extensions.set_config config
@@ -785,6 +781,6 @@ let parse_config ?file () =
| None -> Ocsigen_config.get_config_file ()
| Some f -> f
in
- parser_config (Simplexmlparser.xmlparser_file file)
+ parser_config (Xml.parse_file file)
(******************************************************************)

View file

@ -0,0 +1,48 @@
$NetBSD: patch-src_server_ocsigen__parseconfig.mli,v 1.1 2018/11/29 10:54:14 jaapb Exp $
Replace tyxml.parser with xml-light (patch from upstream)
--- src/server/ocsigen_parseconfig.mli.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/server/ocsigen_parseconfig.mli
@@ -36,13 +36,13 @@ val parse_size_tag : string -> string ->
(** Parse a string (PCDATA) as XML content.
Raises [Failure "Ocsigen_parseconfig.parse_string"] in case of error.
*)
-val parse_string : Simplexmlparser.xml list -> string
+val parse_string : Xml.xml list -> string
(** [parse_string_tag tag s] parses a string (same syntax as [parse_string]).
In case of error, raises [Ocsigen_config.Config_file_error m] where [m]
is an error message explaining that a string was expected in tag [<tag>].
*)
-val parse_string_tag : string -> Simplexmlparser.xml list -> string
+val parse_string_tag : string -> Xml.xml list -> string
(** Parses the [hostfilter] field of the configuration file, which
@@ -52,9 +52,8 @@ val parse_host_field: string option -> O
(**/**)
-val parser_config : Simplexmlparser.xml list ->
- Simplexmlparser.xml list list
-val parse_server : bool -> Simplexmlparser.xml list -> unit
+val parser_config : Xml.xml -> Xml.xml list list
+val parse_server : bool -> Xml.xml list -> unit
type ssl_info = {
ssl_certificate : string option;
@@ -76,7 +75,7 @@ type ssl_info = {
}
*)
val extract_info :
- Simplexmlparser.xml list ->
+ Xml.xml list ->
(string option * string option) *
(ssl_info option *
(Ocsigen_socket.socket_type * int) list *
@@ -86,4 +85,4 @@ val extract_info :
val parse_config :
?file:string ->
unit ->
- Simplexmlparser.xml list list
+ Xml.xml list list

View file

@ -1,9 +1,26 @@
$NetBSD: patch-src_server_ocsigen__server.ml,v 1.1 2018/04/13 13:15:00 jaapb Exp $
$NetBSD: patch-src_server_ocsigen__server.ml,v 1.2 2018/11/29 10:54:14 jaapb Exp $
Lwt_chan no longer exists in Lwt 4, replaced by Lwt_io
Replace tyxml.parser with xml-light (patch from upstream)
--- src/server/ocsigen_server.ml.orig 2018-02-01 12:55:17.000000000 +0000
+++ src/server/ocsigen_server.ml
@@ -1317,13 +1317,13 @@ let start_server () =
@@ -1029,9 +1029,12 @@ let errmsg = function
| Ocsigen_extensions.Error_in_config_file msg ->
(("Fatal - Error in configuration file: "^msg),
50)
- | Simplexmlparser.Xml_parser_error s ->
- (("Fatal - Error in configuration file: "^s),
- 51)
+ | Xml.Error (s, loc) ->
+ let begin_char, end_char = Xml.range loc and line = Xml.line loc in
+ raise (Ocsigen_extensions.Error_in_config_file
+ (Printf.sprintf "%s, line %d, characters %d-%d"
+ (Xml.error_msg s)
+ line begin_char end_char))
| Ocsigen_loader.Dynlink_error (s, exn) ->
(("Fatal - While loading "^s^": "^(Printexc.to_string exn)),
52)
@@ -1317,13 +1320,13 @@ let start_server () =
Ocsigen_extensions.end_initialisation ();