mirror of
https://github.com/GNOME/libxml2.git
synced 2025-02-17 18:19:32 +08:00
xmlOutputBufferCreateFilename() didn't unescaped URIs before doing the
* xmlIO.c: xmlOutputBufferCreateFilename() didn't unescaped URIs before doing the lookups (pointed by Mark Vakoc) Daniel
This commit is contained in:
parent
0ab5caba5b
commit
ecb6f5bda5
@ -1,3 +1,8 @@
|
||||
Wed Aug 15 10:46:07 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xmlIO.c: xmlOutputBufferCreateFilename() didn't unescaped
|
||||
URIs before doing the lookups (pointed by Mark Vakoc)
|
||||
|
||||
Tue Aug 14 18:37:23 CEST 2001 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xpath.c: serious changes on Result Value Trees and NodeSets
|
||||
|
64
xmlIO.c
64
xmlIO.c
@ -1663,8 +1663,9 @@ xmlOutputBufferCreateFilename(const char *URI,
|
||||
xmlCharEncodingHandlerPtr encoder,
|
||||
int compression) {
|
||||
xmlOutputBufferPtr ret;
|
||||
int i;
|
||||
int i = 0;
|
||||
void *context = NULL;
|
||||
char *unescaped;
|
||||
|
||||
int is_http_uri = 0; /* Can't change if HTTP disabled */
|
||||
|
||||
@ -1679,6 +1680,51 @@ xmlOutputBufferCreateFilename(const char *URI,
|
||||
is_http_uri = xmlIOHTTPMatch( URI );
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Try to find one of the output accept method accepting taht 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)) {
|
||||
context = xmlGzfileOpenW(unescaped, compression);
|
||||
if (context != NULL) {
|
||||
ret = xmlAllocOutputBuffer(encoder);
|
||||
if (ret != NULL) {
|
||||
ret->context = context;
|
||||
ret->writecallback = xmlGzfileWrite;
|
||||
ret->closecallback = xmlGzfileClose;
|
||||
}
|
||||
xmlFree(unescaped);
|
||||
return(ret);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = xmlOutputCallbackNr - 1;i >= 0;i--) {
|
||||
if ((xmlOutputCallbackTable[i].matchcallback != NULL) &&
|
||||
(xmlOutputCallbackTable[i].matchcallback(unescaped) != 0)) {
|
||||
#if defined(LIBXML_HTTP_ENABLED) && defined(HAVE_ZLIB_H)
|
||||
/* Need to pass compression parameter into HTTP open calls */
|
||||
if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch)
|
||||
context = xmlIOHTTPOpenW(unescaped, compression);
|
||||
else
|
||||
#endif
|
||||
context = xmlOutputCallbackTable[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) {
|
||||
#ifdef HAVE_ZLIB_H
|
||||
if ((compression > 0) && (compression <= 9) && (is_http_uri == 0)) {
|
||||
context = xmlGzfileOpenW(URI, compression);
|
||||
@ -1693,28 +1739,22 @@ xmlOutputBufferCreateFilename(const char *URI,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Try to find one of the output accept method accepting that scheme
|
||||
* Go in reverse to give precedence to user defined handlers.
|
||||
*/
|
||||
for (i = xmlOutputCallbackNr - 1;i >= 0;i--) {
|
||||
if ((xmlOutputCallbackTable[i].matchcallback != NULL) &&
|
||||
(xmlOutputCallbackTable[i].matchcallback(URI) != 0)) {
|
||||
|
||||
#if ( defined( LIBXML_HTTP_ENABLED ) && defined( HAVE_ZLIB_H ) )
|
||||
context = xmlOutputCallbackTable[i].opencallback(URI);
|
||||
#if defined(LIBXML_HTTP_ENABLED) && defined(HAVE_ZLIB_H)
|
||||
/* Need to pass compression parameter into HTTP open calls */
|
||||
|
||||
if ( xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch )
|
||||
context = xmlIOHTTPOpenW( URI, compression );
|
||||
if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch)
|
||||
context = xmlIOHTTPOpenW(URI, compression);
|
||||
else
|
||||
#endif
|
||||
context = xmlOutputCallbackTable[i].opencallback(URI);
|
||||
|
||||
if (context != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (context == NULL) {
|
||||
return(NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user