exported default 'file:', 'http:' and 'ftp:' protocols input handlers and
* include/libxml/xmlIO.h win32/dsp/libxml2.def.src
win32/libxml2.def.src xmlIO.c: exported default
'file:', 'http:' and 'ftp:' protocols input handlers
and maked protocols comparisson case insensitive
diff --git a/xmlIO.c b/xmlIO.c
index f2421fe..c83e641 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -268,7 +268,7 @@
*
* Returns 1 if matches, 0 otherwise
*/
-static int
+int
xmlFileMatch (const char *filename ATTRIBUTE_UNUSED) {
return(1);
}
@@ -282,7 +282,7 @@
*
* Returns an I/O context or NULL in case of error
*/
-static void *
+void *
xmlFileOpen (const char *filename) {
const char *path = NULL;
FILE *fd;
@@ -292,9 +292,9 @@
return((void *) fd);
}
- if (!strncmp(filename, "file://localhost", 16))
+ if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost", 16))
path = &filename[16];
- else if (!strncmp(filename, "file:///", 8)) {
+ else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) && !defined(__CYGWIN__)
path = &filename[8];
#else
@@ -335,9 +335,9 @@
return((void *) fd);
}
- if (!strncmp(filename, "file://localhost", 16))
+ if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost", 16))
path = &filename[16];
- else if (!strncmp(filename, "file:///", 8)) {
+ else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) && !defined(__CYGWIN__)
path = &filename[8];
#else
@@ -363,7 +363,7 @@
*
* Returns the number of bytes written
*/
-static int
+int
xmlFileRead (void * context, char * buffer, int len) {
return(fread(&buffer[0], 1, len, (FILE *) context));
}
@@ -389,7 +389,7 @@
*
* Close an I/O channel
*/
-static int
+int
xmlFileClose (void * context) {
FILE *fil;
@@ -452,9 +452,9 @@
return((void *) fd);
}
- if (!strncmp(filename, "file://localhost", 16))
+ if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost", 16))
path = &filename[16];
- else if (!strncmp(filename, "file:///", 8)) {
+ else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) && !defined(__CYGWIN__)
path = &filename[8];
#else
@@ -494,9 +494,9 @@
return((void *) fd);
}
- if (!strncmp(filename, "file://localhost", 16))
+ if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost", 16))
path = &filename[16];
- else if (!strncmp(filename, "file:///", 8)) {
+ else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) && !defined(__CYGWIN__)
path = &filename[8];
#else
@@ -931,9 +931,9 @@
*
* Returns 1 if matches, 0 otherwise
*/
-static int
+int
xmlIOHTTPMatch (const char *filename) {
- if (!strncmp(filename, "http://", 7))
+ if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "http://", 7))
return(1);
return(0);
}
@@ -946,7 +946,7 @@
*
* Returns an I/O context or NULL in case of error
*/
-static void *
+void *
xmlIOHTTPOpen (const char *filename) {
return(xmlNanoHTTPOpen(filename, NULL));
}
@@ -1040,7 +1040,7 @@
*
* Returns the number of bytes written
*/
-static int
+int
xmlIOHTTPRead(void * context, char * buffer, int len) {
return(xmlNanoHTTPRead(context, &buffer[0], len));
}
@@ -1096,7 +1096,7 @@
*
* Close an HTTP I/O channel
*/
-static int
+int
xmlIOHTTPClose (void * context) {
xmlNanoHTTPClose(context);
return 0;
@@ -1275,9 +1275,9 @@
*
* Returns 1 if matches, 0 otherwise
*/
-static int
+int
xmlIOFTPMatch (const char *filename) {
- if (!strncmp(filename, "ftp://", 6))
+ if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "ftp://", 6))
return(1);
return(0);
}
@@ -1290,7 +1290,7 @@
*
* Returns an I/O context or NULL in case of error
*/
-static void *
+void *
xmlIOFTPOpen (const char *filename) {
return(xmlNanoFTPOpen(filename));
}
@@ -1305,7 +1305,7 @@
*
* Returns the number of bytes written
*/
-static int
+int
xmlIOFTPRead(void * context, char * buffer, int len) {
return(xmlNanoFTPRead(context, &buffer[0], len));
}
@@ -1316,7 +1316,7 @@
*
* Close an FTP I/O channel
*/
-static int
+int
xmlIOFTPClose (void * context) {
return ( xmlNanoFTPClose(context) );
}
@@ -2442,9 +2442,9 @@
if (URL == NULL)
return(0);
- if (!strncmp(URL, "file://localhost", 16))
+ if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file://localhost", 16))
path = &URL[16];
- else if (!strncmp(URL, "file:///", 8)) {
+ else if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) && !defined(__CYGWIN__)
path = &URL[8];
#else
@@ -2631,9 +2631,9 @@
if (URL == NULL)
return (0);
- if (!xmlStrncmp(BAD_CAST URL, BAD_CAST "file://localhost", 16))
+ if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file://localhost", 16))
path = &URL[16];
- else if (!xmlStrncmp(BAD_CAST URL, BAD_CAST "file:///", 8)) {
+ else if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file:///", 8)) {
#if defined (_WIN32) && !defined(__CYGWIN__)
path = &URL[8];
#else
@@ -2726,10 +2726,8 @@
resource = (xmlChar *) URL;
if (resource != NULL) {
- if ((!xmlStrncasecmp((const xmlChar *) resource,
- (const xmlChar *) "ftp://", 6)) ||
- (!xmlStrncasecmp((const xmlChar *) resource,
- (const xmlChar *) "http://", 7))) {
+ if ((!xmlStrncasecmp(BAD_CAST resource, BAD_CAST "ftp://", 6)) ||
+ (!xmlStrncasecmp(BAD_CAST resource, BAD_CAST "http://", 7))) {
xmlGenericError(xmlGenericErrorContext,
"Attempt to load network entity %s \n", resource);