patch from Stefano Zacchiroli to fix some URI/file escaping problems
* nanoftp.c nanohttp.c xmlIO.c: patch from Stefano Zacchiroli
to fix some URI/file escaping problems
Daniel
diff --git a/nanoftp.c b/nanoftp.c
index d3c1e28..a179deb 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -59,6 +59,7 @@
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
+#include <libxml/uri.h>
#include <libxml/nanoftp.h>
#include <libxml/globals.h>
@@ -496,6 +497,7 @@
void*
xmlNanoFTPNewCtxt(const char *URL) {
xmlNanoFTPCtxtPtr ret;
+ char *unescaped;
ret = (xmlNanoFTPCtxtPtr) xmlMalloc(sizeof(xmlNanoFTPCtxt));
if (ret == NULL) return(NULL);
@@ -508,8 +510,12 @@
ret->controlBufUsed = 0;
ret->controlFd = -1;
- if (URL != NULL)
+ unescaped = xmlURIUnescapeString(URL, 0, NULL);
+ if (unescaped != NULL)
+ xmlNanoFTPScanURL(ret, unescaped);
+ else if (URL != NULL)
xmlNanoFTPScanURL(ret, URL);
+ xmlFree(unescaped);
return(ret);
}