aboutsummaryrefslogtreecommitdiffstats
path: root/xmlIO.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-07-08 18:35:48 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-07-08 18:35:48 +0000
commit388236fc8b51d431663cdb9af1c8253714c568ed (patch)
tree4a24c532a1274b92c2bdf04e46fba6fa9fcbc9af /xmlIO.c
parent0438375d2e6be47d0179826271081ae64df94f8b (diff)
downloadandroid_external_libxml2-388236fc8b51d431663cdb9af1c8253714c568ed.tar.gz
android_external_libxml2-388236fc8b51d431663cdb9af1c8253714c568ed.tar.bz2
android_external_libxml2-388236fc8b51d431663cdb9af1c8253714c568ed.zip
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
Diffstat (limited to 'xmlIO.c')
-rw-r--r--xmlIO.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/xmlIO.c b/xmlIO.c
index fd2b6104..2922932f 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -62,6 +62,7 @@
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlIO.h>
+#include <libxml/uri.h>
#include <libxml/nanohttp.h>
#include <libxml/nanoftp.h>
#include <libxml/xmlerror.h>
@@ -883,8 +884,9 @@ xmlParserInputBufferCreateFilename
#endif
(const char *URI, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
- int i;
+ int i = 0;
void *context = NULL;
+ char *unescaped;
if (xmlInputCallbackInitialized == 0)
xmlRegisterDefaultInputCallbacks();
@@ -894,13 +896,33 @@ xmlParserInputBufferCreateFilename
/*
* Try to find one of the input accept method accepting taht scheme
* 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--) {
- if ((xmlInputCallbackTable[i].matchcallback != NULL) &&
- (xmlInputCallbackTable[i].matchcallback(URI) != 0)) {
- context = xmlInputCallbackTable[i].opencallback(URI);
- if (context != NULL)
- break;
+ unescaped = xmlURIUnescapeString(URI, 0, NULL);
+ if (unescaped != NULL) {
+ for (i = xmlInputCallbackNr - 1;i >= 0;i--) {
+ if ((xmlInputCallbackTable[i].matchcallback != NULL) &&
+ (xmlInputCallbackTable[i].matchcallback(unescaped) != 0)) {
+ 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) {