Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
e6e927c3
Commit
e6e927c3
authored
Apr 01, 2021
by
Kim Nguyễn
Browse files
Disable external loading of XHTML entities and make expat the default parser.
parent
935e396c
Changes
3
Hide whitespace changes
Inline
Side-by-side
backend/native/cduce_expat.real.ml
View file @
e6e927c3
...
...
@@ -28,7 +28,10 @@ let rec push p s =
let
p
=
Expat
.
external_entity_parser_create
p
ctx
None
in
push
p
s
);
try
if
Url
.
is_url
s
then
Expat
.
parse
p
(
Url
.
load_url
s
)
if
Url
.
is_url
s
then
begin
let
content
=
Url
.
load_url
s
in
Expat
.
parse
p
content
end
else
load_from_file
p
s
with
Expat
.
Expat_error
e
->
let
msg
=
...
...
@@ -46,7 +49,7 @@ let load_expat se ee txt s =
Expat
.
set_start_element_handler
p
se
;
Expat
.
set_end_element_handler
p
ee
;
Expat
.
set_character_data_handler
p
txt
;
ignore
(
Expat
.
set_param_entity_parsing
p
Expat
.
ALWAYS
);
ignore
(
Expat
.
set_param_entity_parsing
p
Expat
.
NEVER
);
push
p
s
let
use
()
=
...
...
backend/native/cduce_pxp.ml
View file @
e6e927c3
...
...
@@ -55,7 +55,7 @@ let load_pxp handlers uri =
try
let
mgr
=
create_entity_manager
pxp_config
(
src_of_uri
uri
)
in
process_entity
pxp_config
(
`Entry_document
[
`
Extend_dtd_fully
])
mgr
handlers
;
(
`Entry_document
[
`
Parse_xml_decl
])
mgr
handlers
;
with
exn
->
Value
.
failwith'
(
Pxp_types
.
string_of_exn
exn
)
...
...
lang/lib/cduce_config.ml
View file @
e6e927c3
...
...
@@ -2,7 +2,7 @@ let features = ref []
let
get_features
()
=
List
.
stable_sort
(
fun
(
p1
,
_
,
_
,
_
)
(
p2
,
_
,
_
,
_
)
->
compare
p
1
p
2
compare
p
2
p
1
)
!
features
let
init_all
()
=
List
.
iter
(
fun
(
_
,
_
,
_
,
f
)
->
f
()
)
(
List
.
rev
(
get_features
()
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment