summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2016-11-20 20:06:05 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2016-11-20 20:06:05 +0000
commit25f17fdecaa895478a9b2e3e59b044ac5a0e3c4d (patch)
treea5291d0e037ac96ea54e2a2e4db4636fb48b6306
parente59d7422cc1ce3f4446bb520995017f1ebad19e4 (diff)
downloadlibdom-25f17fdecaa895478a9b2e3e59b044ac5a0e3c4d.tar.gz
libdom-25f17fdecaa895478a9b2e3e59b044ac5a0e3c4d.tar.bz2
Ignore http and https addresses when fetching entity refs
The fopen() causes a requester on AmigaOS which I'm bored of hearing about. See also bug 2313
-rw-r--r--bindings/xml/expat_xmlparser.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/bindings/xml/expat_xmlparser.c b/bindings/xml/expat_xmlparser.c
index e5bc2e6..a63ccf1 100644
--- a/bindings/xml/expat_xmlparser.c
+++ b/bindings/xml/expat_xmlparser.c
@@ -319,6 +319,19 @@ expat_xmlparser_external_entity_ref_handler(XML_Parser parser,
if (system_id == NULL)
return XML_STATUS_OK;
+ /* If the ID is a network URI, return (see bug 2313 and below) */
+ if ((strncmp(system_id, "http://", 7) == 0) ||
+ (strncmp(system_id, "https://", 8) == 0)) {
+ return XML_STATUS_OK;
+ }
+
+ /*\todo This needs fixing. Our system_id, if not
+ * absolute, needs to be made absolute relative to
+ * base before being opened. It should also be
+ * passed back to the client to be opened, as network
+ * addresses need special handling and local files
+ * should also have the file:// scheme, so fopen is
+ * not necessarily going to work. */
fh = fopen(system_id, "r");
if (fh == NULL)