Commit 388236fc authored by Daniel Veillard's avatar Daniel Veillard

fixed an old bug raised by Bernhard Zwisch, the I/O layer should

* xmlIO.c: fixed an old bug raised by Bernhard Zwisch, the I/O
  layer should URI-Unescape before trying to open resources.
Daniel
parent 0438375d
Sun Jul 8 20:34:35 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* xmlIO.c: fixed an old bug raised by Bernhard Zwisch, the I/O
layer should URI-Unescape before trying to open resources.
Sun Jul 8 16:26:00 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr> Sun Jul 8 16:26:00 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* xpath.c: fix the name() bug for elements in the default * xpath.c: fix the name() bug for elements in the default
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/parserInternals.h> #include <libxml/parserInternals.h>
#include <libxml/xmlIO.h> #include <libxml/xmlIO.h>
#include <libxml/uri.h>
#include <libxml/nanohttp.h> #include <libxml/nanohttp.h>
#include <libxml/nanoftp.h> #include <libxml/nanoftp.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
...@@ -883,8 +884,9 @@ xmlParserInputBufferCreateFilename ...@@ -883,8 +884,9 @@ xmlParserInputBufferCreateFilename
#endif #endif
(const char *URI, xmlCharEncoding enc) { (const char *URI, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret; xmlParserInputBufferPtr ret;
int i; int i = 0;
void *context = NULL; void *context = NULL;
char *unescaped;
if (xmlInputCallbackInitialized == 0) if (xmlInputCallbackInitialized == 0)
xmlRegisterDefaultInputCallbacks(); xmlRegisterDefaultInputCallbacks();
...@@ -894,13 +896,33 @@ xmlParserInputBufferCreateFilename ...@@ -894,13 +896,33 @@ xmlParserInputBufferCreateFilename
/* /*
* Try to find one of the input accept method accepting taht scheme * Try to find one of the input accept method accepting taht scheme
* Go in reverse to give precedence to user defined handlers. * Go in reverse to give precedence to user defined handlers.
* try with an unescaped version of the URI
*/ */
for (i = xmlInputCallbackNr - 1;i >= 0;i--) { unescaped = xmlURIUnescapeString(URI, 0, NULL);
if ((xmlInputCallbackTable[i].matchcallback != NULL) && if (unescaped != NULL) {
(xmlInputCallbackTable[i].matchcallback(URI) != 0)) { for (i = xmlInputCallbackNr - 1;i >= 0;i--) {
context = xmlInputCallbackTable[i].opencallback(URI); if ((xmlInputCallbackTable[i].matchcallback != NULL) &&
if (context != NULL) (xmlInputCallbackTable[i].matchcallback(unescaped) != 0)) {
break; context = xmlInputCallbackTable[i].opencallback(unescaped);
if (context != NULL)
break;
}
}
xmlFree(unescaped);
}
/*
* If this failed try with a non-escaped URI this may be a strange
* filename
*/
if (context == NULL) {
for (i = xmlInputCallbackNr - 1;i >= 0;i--) {
if ((xmlInputCallbackTable[i].matchcallback != NULL) &&
(xmlInputCallbackTable[i].matchcallback(URI) != 0)) {
context = xmlInputCallbackTable[i].opencallback(URI);
if (context != NULL)
break;
}
} }
} }
if (context == NULL) { if (context == NULL) {
......
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