mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-24 00:58:53 +03:00
parser: Upgrade XML_IO_NETWORK_ATTEMPT to error
Fixes XML::LibXML test suite.
This commit is contained in:
@ -219,19 +219,20 @@ xmlCtxtErrIO(xmlParserCtxtPtr ctxt, int code, const char *uri)
|
|||||||
if (ctxt == NULL)
|
if (ctxt == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
|
||||||
* Only report a warning if a file could not be found. This should
|
|
||||||
* only be done for external entities, but the external entity loader
|
|
||||||
* of xsltproc can try multiple paths and assumes that ENOENT doesn't
|
|
||||||
* raise an error and aborts parsing.
|
|
||||||
*/
|
|
||||||
if (((code == XML_IO_ENOENT) ||
|
if (((code == XML_IO_ENOENT) ||
|
||||||
(code == XML_IO_NETWORK_ATTEMPT) ||
|
|
||||||
(code == XML_IO_UNKNOWN))) {
|
(code == XML_IO_UNKNOWN))) {
|
||||||
|
/*
|
||||||
|
* Only report a warning if a file could not be found. This should
|
||||||
|
* only be done for external entities, but the external entity loader
|
||||||
|
* of xsltproc can try multiple paths and assumes that ENOENT doesn't
|
||||||
|
* raise an error and aborts parsing.
|
||||||
|
*/
|
||||||
if (ctxt->validate == 0)
|
if (ctxt->validate == 0)
|
||||||
level = XML_ERR_WARNING;
|
level = XML_ERR_WARNING;
|
||||||
else
|
else
|
||||||
level = XML_ERR_ERROR;
|
level = XML_ERR_ERROR;
|
||||||
|
} else if (code == XML_IO_NETWORK_ATTEMPT) {
|
||||||
|
level = XML_ERR_ERROR;
|
||||||
} else {
|
} else {
|
||||||
level = XML_ERR_FATAL;
|
level = XML_ERR_FATAL;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ libxml2.registerInputCallback(my_input_cb)
|
|||||||
run_test(desc="Loading entity with custom callback",
|
run_test(desc="Loading entity with custom callback",
|
||||||
docpath=startURL, catalog=None,
|
docpath=startURL, catalog=None,
|
||||||
exp_status="loaded", exp_err=[
|
exp_status="loaded", exp_err=[
|
||||||
( 3, 'failed to load "http://example.com/dtds/sample.dtd": Attempt to load network entity\n'),
|
( 4, 'failed to load "http://example.com/dtds/sample.dtd": Attempt to load network entity\n'),
|
||||||
( 4, "Entity 'sample.entity' not defined\n")
|
( 4, "Entity 'sample.entity' not defined\n")
|
||||||
])
|
])
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user