Commit 4e9b1bc2 authored by Daniel Veillard's avatar Daniel Veillard

trying to fix #114277 about when file remapping and escaping should really

* parser.c xmlIO.c: trying to fix #114277 about when file
  remapping and escaping should really be attempted.
Daniel
parent a37aab84
Mon Jun 9 12:28:58 CEST 2003 Daniel Veillard <daniel@veillard.com>
* parser.c xmlIO.c: trying to fix #114277 about when file
remapping and escaping should really be attempted.
Mon Jun 9 11:06:09 CEST 2003 Daniel Veillard <daniel@veillard.com>
* doc/*: applied a patch from Gman for building docs
......
......@@ -10558,7 +10558,6 @@ xmlCreateFileParserCtxt(const char *filename)
{
xmlParserCtxtPtr ctxt;
xmlParserInputPtr inputStream;
char *canonicFilename;
char *directory = NULL;
ctxt = xmlNewParserCtxt();
......@@ -10569,16 +10568,8 @@ xmlCreateFileParserCtxt(const char *filename)
return(NULL);
}
canonicFilename = (char *) xmlCanonicPath((const xmlChar *) filename);
if (canonicFilename == NULL) {
if (xmlDefaultSAXHandler.error != NULL) {
xmlDefaultSAXHandler.error(NULL, "out of memory\n");
}
return(NULL);
}
inputStream = xmlLoadExternalEntity(canonicFilename, NULL, ctxt);
xmlFree(canonicFilename);
inputStream = xmlLoadExternalEntity(filename, NULL, ctxt);
if (inputStream == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
......
......@@ -532,20 +532,22 @@ xmlGzfileOpen_real (const char *filename) {
* xmlGzfileOpen:
* @filename: the URI for matching
*
* Wrapper around xmlGzfileOpen that try it with an unescaped
* version of @filename, if this fails fallback to @filename
* Wrapper around xmlGzfileOpen if the open fais, it will
* try to unescape @filename
*/
static void *
xmlGzfileOpen (const char *filename) {
char *unescaped;
void *retval;
unescaped = xmlURIUnescapeString(filename, 0, NULL);
if (unescaped != NULL) {
retval = xmlGzfileOpen_real(unescaped);
} else {
retval = xmlGzfileOpen_real(filename);
retval = xmlGzfileOpen_real(filename);
if (retval == NULL) {
unescaped = xmlURIUnescapeString(filename, 0, NULL);
if (unescaped != NULL) {
retval = xmlGzfileOpen_real(unescaped);
}
xmlFree(unescaped);
}
xmlFree(unescaped);
return retval;
}
......@@ -2487,7 +2489,6 @@ xmlParserGetDirectory(const char *filename) {
* *
****************************************************************/
#ifdef LIBXML_CATALOG_ENABLED
static int xmlSysIDExists(const char *URL) {
#ifdef HAVE_STAT
int ret;
......@@ -2517,7 +2518,6 @@ static int xmlSysIDExists(const char *URL) {
#endif
return(0);
}
#endif
/**
* xmlDefaultExternalEntityLoader:
......@@ -2669,6 +2669,22 @@ xmlGetExternalEntityLoader(void) {
xmlParserInputPtr
xmlLoadExternalEntity(const char *URL, const char *ID,
xmlParserCtxtPtr ctxt) {
if ((URL != NULL) && (xmlSysIDExists(URL) == 0)) {
char *canonicFilename;
xmlParserInputPtr ret;
canonicFilename = (char *) xmlCanonicPath((const xmlChar *) URL);
if (canonicFilename == NULL) {
if (xmlDefaultSAXHandler.error != NULL) {
xmlDefaultSAXHandler.error(NULL, "out of memory\n");
}
return(NULL);
}
ret = xmlCurrentExternalEntityLoader(canonicFilename, ID, ctxt);
xmlFree(canonicFilename);
return(ret);
}
return(xmlCurrentExternalEntityLoader(URL, ID, ctxt));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment