1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-23 17:33:50 +03:00

parser: Upgrade XML_IO_NETWORK_ATTEMPT to error

Fixes XML::LibXML test suite.
This commit is contained in:
Nick Wellnhofer 2024-07-04 15:15:17 +02:00
parent f86d17c163
commit ec0881099b
2 changed files with 9 additions and 8 deletions

View File

@ -219,19 +219,20 @@ xmlCtxtErrIO(xmlParserCtxtPtr ctxt, int code, const char *uri)
if (ctxt == NULL)
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) ||
(code == XML_IO_NETWORK_ATTEMPT) ||
(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)
level = XML_ERR_WARNING;
else
level = XML_ERR_ERROR;
} else if (code == XML_IO_NETWORK_ATTEMPT) {
level = XML_ERR_ERROR;
} else {
level = XML_ERR_FATAL;
}

View File

@ -99,7 +99,7 @@ libxml2.registerInputCallback(my_input_cb)
run_test(desc="Loading entity with custom callback",
docpath=startURL, catalog=None,
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")
])