aboutsummaryrefslogtreecommitdiffstats
path: root/xmlIO.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2004-05-09 02:58:44 +0000
committerDaniel Veillard <veillard@src.gnome.org>2004-05-09 02:58:44 +0000
commit966a31e222f478b8ab3174617794808aa90f20c0 (patch)
tree7986f4e9018a9ab5eb5766d374a43c378624e155 /xmlIO.c
parentaecc0dc1f58f66765d68997bb85b5c4534404c67 (diff)
downloadandroid_external_libxml2-966a31e222f478b8ab3174617794808aa90f20c0.tar.gz
android_external_libxml2-966a31e222f478b8ab3174617794808aa90f20c0.tar.bz2
android_external_libxml2-966a31e222f478b8ab3174617794808aa90f20c0.zip
fixing some problems in URI unescaping and output buffer opening, this
* uri.c xmlIO.c: fixing some problems in URI unescaping and output buffer opening, this should fix #141864 Daniel
Diffstat (limited to 'xmlIO.c')
-rw-r--r--xmlIO.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/xmlIO.c b/xmlIO.c
index 970fa6e8..cb67fb83 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -2217,33 +2217,38 @@ xmlOutputBufferCreateFilename(const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression ATTRIBUTE_UNUSED) {
xmlOutputBufferPtr ret;
+ xmlURIPtr puri;
int i = 0;
void *context = NULL;
- char *unescaped;
-
- int is_http_uri = 0; /* Can't change if HTTP disabled */
+ char *unescaped = NULL;
+ int is_file_uri = 1;
if (xmlOutputCallbackInitialized == 0)
xmlRegisterDefaultOutputCallbacks();
if (URI == NULL) return(NULL);
-#ifdef LIBXML_HTTP_ENABLED
- /* Need to prevent HTTP URI's from falling into zlib short circuit */
-
- is_http_uri = xmlIOHTTPMatch( URI );
-#endif
-
+ puri = xmlParseURI(URI);
+ if (puri != NULL) {
+ if ((puri->scheme == NULL) ||
+ (xmlStrEqual(BAD_CAST puri->scheme, BAD_CAST "file")))
+ is_file_uri = 0;
+ /*
+ * try to limit the damages of the URI unescaping code.
+ */
+ if (puri->scheme != NULL)
+ unescaped = xmlURIUnescapeString(URI, 0, NULL);
+ xmlFreeURI(puri);
+ }
/*
* Try to find one of the output accept method accepting that scheme
* Go in reverse to give precedence to user defined handlers.
* try with an unescaped version of the URI
*/
- unescaped = xmlURIUnescapeString(URI, 0, NULL);
if (unescaped != NULL) {
#ifdef HAVE_ZLIB_H
- if ((compression > 0) && (compression <= 9) && (is_http_uri == 0)) {
+ if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) {
context = xmlGzfileOpenW(unescaped, compression);
if (context != NULL) {
ret = xmlAllocOutputBuffer(encoder);
@@ -2280,7 +2285,7 @@ xmlOutputBufferCreateFilename(const char *URI,
*/
if (context == NULL) {
#ifdef HAVE_ZLIB_H
- if ((compression > 0) && (compression <= 9) && (is_http_uri == 0)) {
+ if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) {
context = xmlGzfileOpenW(URI, compression);
if (context != NULL) {
ret = xmlAllocOutputBuffer(encoder);