Gitweb links:

...log 
http://git.netsurf-browser.org/libdom.git/shortlog/389f74b11d3f6cd54c32ffcf423cee1c9b07f845
...commit 
http://git.netsurf-browser.org/libdom.git/commit/389f74b11d3f6cd54c32ffcf423cee1c9b07f845
...tree 
http://git.netsurf-browser.org/libdom.git/tree/389f74b11d3f6cd54c32ffcf423cee1c9b07f845

The branch, master has been updated
       via  389f74b11d3f6cd54c32ffcf423cee1c9b07f845 (commit)
      from  54c4309526e18a26a7b5b1fb4fdd5b7b7f1d304d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/libdom.git/commit/?id=389f74b11d3f6cd54c32ffcf423cee1c9b07f845
commit 389f74b11d3f6cd54c32ffcf423cee1c9b07f845
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Don't attempt to fetch external entity references blindly with fopen
    The system_id is a URI, either absolute or relative to 'base', it needs to 
be fetched using network calls, fopen won't work.
    I've put a half-working POC in chris/fetch-x-ent-ref but it needs fixing up 
and testing.
    Removing this non-working code fixes #2313 for now, but fetching of 
external entities will still need to be added.

diff --git a/bindings/xml/expat_xmlparser.c b/bindings/xml/expat_xmlparser.c
index e1c22ad..53c3093 100644
--- a/bindings/xml/expat_xmlparser.c
+++ b/bindings/xml/expat_xmlparser.c
@@ -292,44 +292,12 @@ expat_xmlparser_external_entity_ref_handler(XML_Parser 
parser,
                                            const XML_Char *system_id,
                                            const XML_Char *public_id)
 {
-       FILE *fh;
-       XML_Parser subparser;
-       unsigned char data[1024];
-       size_t len;
-       enum XML_Status status;
-
+       UNUSED(parser);
+       UNUSED(context);
        UNUSED(base);
+       UNUSED(system_id);
        UNUSED(public_id);
 
-       if (system_id == NULL)
-               return XML_STATUS_OK;
-
-       fh = fopen(system_id, "r");
-
-       if (fh == NULL)
-               return XML_STATUS_OK;
-
-       subparser = XML_ExternalEntityParserCreate(parser,
-                                                  context,
-                                                  NULL);
-
-       if (subparser == NULL) {
-               fclose(fh);
-               return XML_STATUS_OK;
-       }
-
-       /* Parse the file bit by bit */
-       while ((len = fread(data, 1, 1024, fh)) > 0) {
-               status = XML_Parse(subparser, (const char *)data, len, 0);
-               if (status != XML_STATUS_OK) {
-                       XML_ParserFree(subparser);
-                       fclose(fh);
-                       return XML_STATUS_OK;
-               }
-       }
-       XML_Parse(subparser, "", 0, 1);
-       XML_ParserFree(subparser);
-       fclose(fh);
        return XML_STATUS_OK;
 }
 


-----------------------------------------------------------------------

Summary of changes:
 bindings/xml/expat_xmlparser.c |   38 +++-----------------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

diff --git a/bindings/xml/expat_xmlparser.c b/bindings/xml/expat_xmlparser.c
index e1c22ad..53c3093 100644
--- a/bindings/xml/expat_xmlparser.c
+++ b/bindings/xml/expat_xmlparser.c
@@ -292,44 +292,12 @@ expat_xmlparser_external_entity_ref_handler(XML_Parser 
parser,
                                            const XML_Char *system_id,
                                            const XML_Char *public_id)
 {
-       FILE *fh;
-       XML_Parser subparser;
-       unsigned char data[1024];
-       size_t len;
-       enum XML_Status status;
-
+       UNUSED(parser);
+       UNUSED(context);
        UNUSED(base);
+       UNUSED(system_id);
        UNUSED(public_id);
 
-       if (system_id == NULL)
-               return XML_STATUS_OK;
-
-       fh = fopen(system_id, "r");
-
-       if (fh == NULL)
-               return XML_STATUS_OK;
-
-       subparser = XML_ExternalEntityParserCreate(parser,
-                                                  context,
-                                                  NULL);
-
-       if (subparser == NULL) {
-               fclose(fh);
-               return XML_STATUS_OK;
-       }
-
-       /* Parse the file bit by bit */
-       while ((len = fread(data, 1, 1024, fh)) > 0) {
-               status = XML_Parse(subparser, (const char *)data, len, 0);
-               if (status != XML_STATUS_OK) {
-                       XML_ParserFree(subparser);
-                       fclose(fh);
-                       return XML_STATUS_OK;
-               }
-       }
-       XML_Parse(subparser, "", 0, 1);
-       XML_ParserFree(subparser);
-       fclose(fh);
        return XML_STATUS_OK;
 }
 


-- 
Document Object Model library

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to