diff -urNp libxml2-2.7.7/include/libxml/nanoftp.h libxml2-2.7.7x/include/libxml/nanoftp.h
--- libxml2-2.7.7/include/libxml/nanoftp.h	2009-09-24 18:31:59.000000000 +0300
+++ libxml2-2.7.7x/include/libxml/nanoftp.h	2010-03-27 11:10:36.000000000 +0200
@@ -15,6 +15,13 @@
 
 #ifdef LIBXML_FTP_ENABLED
 
+#if defined(__MINGW32__) || defined(_WIN32_WCE)
+#include <winsock2.h>
+#else
+#define SOCKET int
+#define INVALID_SOCKET (-1)
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -114,7 +121,7 @@ XMLPUBFUN int XMLCALL	
 	xmlNanoFTPDele		(void *ctx,
 				 const char *file);
 
-XMLPUBFUN int XMLCALL	
+XMLPUBFUN SOCKET XMLCALL	
 	xmlNanoFTPGetConnection	(void *ctx);
 XMLPUBFUN int XMLCALL	
 	xmlNanoFTPCloseConnection(void *ctx);
@@ -123,7 +130,7 @@ XMLPUBFUN int XMLCALL	
 				 ftpListCallback callback,
 				 void *userData,
 				 const char *filename);
-XMLPUBFUN int XMLCALL	
+XMLPUBFUN SOCKET XMLCALL	
 	xmlNanoFTPGetSocket	(void *ctx,
 				 const char *filename);
 XMLPUBFUN int XMLCALL	
diff -urNp libxml2-2.7.7/nanoftp.c libxml2-2.7.7x/nanoftp.c
--- libxml2-2.7.7/nanoftp.c	2009-09-24 18:31:59.000000000 +0300
+++ libxml2-2.7.7x/nanoftp.c	2010-03-27 11:29:42.000000000 +0200
@@ -78,7 +78,9 @@
 
 
 #if defined(__MINGW32__) || defined(_WIN32_WCE)
+#ifndef _WINSOCKAPI_
 #define _WINSOCKAPI_
+#endif
 #include <wsockcompat.h>
 #include <winsock2.h>
 #undef XML_SOCKLEN_T
@@ -92,7 +94,6 @@
 #if !defined(__BEOS__) || defined(__HAIKU__)
 #define closesocket(s) close(s)
 #endif
-#define SOCKET int
 #endif
 
 #ifdef __BEOS__
@@ -484,7 +485,7 @@ xmlNanoFTPNewCtxt(const char *URL) {
     ret->returnValue = 0;
     ret->controlBufIndex = 0;
     ret->controlBufUsed = 0;
-    ret->controlFd = -1;
+    ret->controlFd = INVALID_SOCKET;
 
     unescaped = xmlURIUnescapeString(URL, 0, NULL);
     if (unescaped != NULL) {
@@ -511,8 +512,8 @@ xmlNanoFTPFreeCtxt(void * ctx) {
     if (ctxt->protocol != NULL) xmlFree(ctxt->protocol);
     if (ctxt->path != NULL) xmlFree(ctxt->path);
     ctxt->passive = 1;
-    if (ctxt->controlFd >= 0) closesocket(ctxt->controlFd);
-    ctxt->controlFd = -1;
+    if (ctxt->controlFd != INVALID_SOCKET) closesocket(ctxt->controlFd);
+    ctxt->controlFd = INVALID_SOCKET;
     ctxt->controlBufIndex = -1;
     ctxt->controlBufUsed = -1;
     xmlFree(ctxt);
@@ -567,7 +568,7 @@ xmlNanoFTPGetMore(void *ctx) {
     int len;
     int size;
 
-    if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
+    if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
 
     if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) {
 #ifdef DEBUG_FTP
@@ -619,8 +620,8 @@ xmlNanoFTPGetMore(void *ctx) {
     if ((len = recv(ctxt->controlFd, &ctxt->controlBuf[ctxt->controlBufIndex],
 		    size, 0)) < 0) {
 	__xmlIOErr(XML_FROM_FTP, 0, "recv failed");
-	closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-        ctxt->controlFd = -1;
+	closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+        ctxt->controlFd = INVALID_SOCKET;
         return(-1);
     }
 #ifdef DEBUG_FTP
@@ -648,7 +649,7 @@ xmlNanoFTPReadResponse(void *ctx) {
     int len;
     int res = -1, cur = -1;
 
-    if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
+    if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
 
 get_more:
     /*
@@ -737,7 +738,7 @@ xmlNanoFTPCheckResponse(void *ctx) {
     fd_set rfd;
     struct timeval tv;
 
-    if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
+    if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
     tv.tv_sec = 0;
     tv.tv_usec = 0;
     FD_ZERO(&rfd);
@@ -826,7 +827,7 @@ xmlNanoFTPQuit(void *ctx) {
     char buf[200];
     int len, res;
 
-    if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
+    if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
 
     snprintf(buf, sizeof(buf), "QUIT\r\n");
     len = strlen(buf);
@@ -951,7 +952,7 @@ xmlNanoFTPConnect(void *ctx) {
 	addrlen = sizeof (struct sockaddr_in);
     }
 
-    if (ctxt->controlFd < 0) {
+    if (ctxt->controlFd == INVALID_SOCKET) {
 	__xmlIOErr(XML_FROM_FTP, 0, "socket failed");
         return(-1);
     }
@@ -962,8 +963,8 @@ xmlNanoFTPConnect(void *ctx) {
     if (connect(ctxt->controlFd, (struct sockaddr *) &ctxt->ftpAddr,
 	    addrlen) < 0) {
 	__xmlIOErr(XML_FROM_FTP, 0, "Failed to create a connection");
-        closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-        ctxt->controlFd = -1;
+        closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+        ctxt->controlFd = INVALID_SOCKET;
 	return(-1);
     }
 
@@ -972,8 +973,8 @@ xmlNanoFTPConnect(void *ctx) {
      */
     res = xmlNanoFTPGetResponse(ctxt);
     if (res != 2) {
-        closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-        ctxt->controlFd = -1;
+        closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+        ctxt->controlFd = INVALID_SOCKET;
 	return(-1);
     }
 
@@ -1030,7 +1031,7 @@ xmlNanoFTPConnect(void *ctx) {
 	    if (res < 0) {
 		__xmlIOErr(XML_FROM_FTP, 0, "send failed");
 		closesocket(ctxt->controlFd);
-		ctxt->controlFd = -1;
+		ctxt->controlFd = INVALID_SOCKET;
 	        return(res);
 	    }
 	    res = xmlNanoFTPGetResponse(ctxt);
@@ -1052,13 +1053,13 @@ xmlNanoFTPConnect(void *ctx) {
 		    if (res < 0) {
 			__xmlIOErr(XML_FROM_FTP, 0, "send failed");
 			closesocket(ctxt->controlFd);
-			ctxt->controlFd = -1;
+			ctxt->controlFd = INVALID_SOCKET;
 			return(res);
 		    }
 		    res = xmlNanoFTPGetResponse(ctxt);
 		    if (res > 3) {
 			closesocket(ctxt->controlFd);
-			ctxt->controlFd = -1;
+			ctxt->controlFd = INVALID_SOCKET;
 			return(-1);
 		    }
 		    break;
@@ -1069,7 +1070,7 @@ xmlNanoFTPConnect(void *ctx) {
 		case -1:
 		default:
 		    closesocket(ctxt->controlFd);
-		    ctxt->controlFd = -1;
+		    ctxt->controlFd = INVALID_SOCKET;
 		    return(-1);
 	    }
 	}
@@ -1092,8 +1093,8 @@ xmlNanoFTPConnect(void *ctx) {
 		res = send(ctxt->controlFd, buf, len, 0);
 		if (res < 0) {
 		    __xmlIOErr(XML_FROM_FTP, 0, "send failed");
-		    closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-		    ctxt->controlFd = -1;
+		    closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+		    ctxt->controlFd = INVALID_SOCKET;
 		    return(res);
 		}
 		res = xmlNanoFTPGetResponse(ctxt);
@@ -1103,8 +1104,8 @@ xmlNanoFTPConnect(void *ctx) {
 		    break;
 		}    
 		if (proxyType == 1) {
-		    closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-		    ctxt->controlFd = -1;
+		    closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+		    ctxt->controlFd = INVALID_SOCKET;
 		    return(-1);
 		}
 	    case 2:
@@ -1123,8 +1124,8 @@ xmlNanoFTPConnect(void *ctx) {
 		res = send(ctxt->controlFd, buf, len, 0);
 		if (res < 0) {
 		    __xmlIOErr(XML_FROM_FTP, 0, "send failed");
-		    closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-		    ctxt->controlFd = -1;
+		    closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+		    ctxt->controlFd = INVALID_SOCKET;
 		    return(res);
 		}
 		res = xmlNanoFTPGetResponse(ctxt);
@@ -1145,8 +1146,8 @@ xmlNanoFTPConnect(void *ctx) {
 		res = send(ctxt->controlFd, buf, len, 0);
 		if (res < 0) {
 		    __xmlIOErr(XML_FROM_FTP, 0, "send failed");
-		    closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-		    ctxt->controlFd = -1;
+		    closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+		    ctxt->controlFd = INVALID_SOCKET;
 		    return(res);
 		}
 		res = xmlNanoFTPGetResponse(ctxt);
@@ -1156,8 +1157,8 @@ xmlNanoFTPConnect(void *ctx) {
 		    return(0);
 		}
 		if (proxyType == 2) {
-		    closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-		    ctxt->controlFd = -1;
+		    closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+		    ctxt->controlFd = INVALID_SOCKET;
 		    return(-1);
 		}
 	    case 3:
@@ -1166,8 +1167,8 @@ xmlNanoFTPConnect(void *ctx) {
 		 * send the code or at least the sequence in use.
 		 */
 	    default:
-		closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-		ctxt->controlFd = -1;
+		closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+		ctxt->controlFd = INVALID_SOCKET;
 		return(-1);
 	}
     }
@@ -1176,8 +1177,8 @@ xmlNanoFTPConnect(void *ctx) {
      */
     res = xmlNanoFTPSendUser(ctxt);
     if (res < 0) {
-        closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-        ctxt->controlFd = -1;
+        closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+        ctxt->controlFd = INVALID_SOCKET;
 	return(-1);
     }
     res = xmlNanoFTPGetResponse(ctxt);
@@ -1191,14 +1192,14 @@ xmlNanoFTPConnect(void *ctx) {
 	case 5:
         case -1:
 	default:
-	    closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-	    ctxt->controlFd = -1;
+	    closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+	    ctxt->controlFd = INVALID_SOCKET;
 	    return(-1);
     }
     res = xmlNanoFTPSendPasswd(ctxt);
     if (res < 0) {
-        closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-        ctxt->controlFd = -1;
+        closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+        ctxt->controlFd = INVALID_SOCKET;
 	return(-1);
     }
     res = xmlNanoFTPGetResponse(ctxt);
@@ -1213,8 +1214,8 @@ xmlNanoFTPConnect(void *ctx) {
 	case 5:
         case -1:
 	default:
-	    closesocket(ctxt->controlFd); ctxt->controlFd = -1;
-	    ctxt->controlFd = -1;
+	    closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
+	    ctxt->controlFd = INVALID_SOCKET;
 	    return(-1);
     }
 
@@ -1270,7 +1271,7 @@ xmlNanoFTPCwd(void *ctx, const char *dir
     int len;
     int res;
 
-    if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
+    if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
     if (directory == NULL) return 0;
 
     /*
@@ -1319,7 +1320,7 @@ xmlNanoFTPDele(void *ctx, const char *fi
     int len;
     int res;
 
-    if ((ctxt == NULL) || (ctxt->controlFd < 0) || (file == NULL)) return(-1);
+    if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET) || (file == NULL)) return(-1);
     if (file == NULL) return (0);
 
     /*
@@ -1362,7 +1363,7 @@ xmlNanoFTPDele(void *ctx, const char *fi
  * Returns -1 incase of error, 0 otherwise
  */
 
-int
+SOCKET
 xmlNanoFTPGetConnection(void *ctx) {
     xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
     char buf[200], *cur;
@@ -1377,7 +1378,7 @@ xmlNanoFTPGetConnection(void *ctx) {
 #endif
     XML_SOCKLEN_T dataAddrLen;
 
-    if (ctxt == NULL) return(-1);
+    if (ctxt == NULL) return INVALID_SOCKET;
 
     memset (&dataAddr, 0, sizeof(dataAddr));
 #ifdef SUPPORT_IP6
@@ -1393,9 +1394,9 @@ xmlNanoFTPGetConnection(void *ctx) {
 	dataAddrLen = sizeof (struct sockaddr_in);
     }
 
-    if (ctxt->dataFd < 0) {
+    if (ctxt->dataFd == INVALID_SOCKET) {
 	__xmlIOErr(XML_FROM_FTP, 0, "socket failed");
-	return (-1);
+	return INVALID_SOCKET;
     }
 
     if (ctxt->passive) {
@@ -1412,19 +1413,19 @@ xmlNanoFTPGetConnection(void *ctx) {
 	res = send(ctxt->controlFd, buf, len, 0);
 	if (res < 0) {
 	    __xmlIOErr(XML_FROM_FTP, 0, "send failed");
-	    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	    return(res);
+	    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	    return INVALID_SOCKET;
 	}
         res = xmlNanoFTPReadResponse(ctx);
 	if (res != 2) {
 	    if (res == 5) {
-	        closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-		return(-1);
+	        closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+		return INVALID_SOCKET;
 	    } else {
 		/*
 		 * retry with an active connection
 		 */
-	        closesocket(ctxt->dataFd); ctxt->dataFd = -1;
+	        closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
 	        ctxt->passive = 0;
 	    }
 	}
@@ -1435,10 +1436,10 @@ xmlNanoFTPGetConnection(void *ctx) {
 	    if (sscanf (cur, "%u", &temp[0]) != 1) {
 		__xmlIOErr(XML_FROM_FTP, XML_FTP_EPSV_ANSWER,
 			"Invalid answer to EPSV\n");
-		if (ctxt->dataFd != -1) {
-		    closesocket (ctxt->dataFd); ctxt->dataFd = -1;
+		if (ctxt->dataFd != INVALID_SOCKET) {
+		    closesocket (ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
 		}
-		return (-1);
+		return INVALID_SOCKET;
 	    }
 	    memcpy (&((struct sockaddr_in6 *)&dataAddr)->sin6_addr, &((struct sockaddr_in6 *)&ctxt->ftpAddr)->sin6_addr, sizeof(struct in6_addr));
 	    ((struct sockaddr_in6 *)&dataAddr)->sin6_port = htons (temp[0]);
@@ -1450,10 +1451,10 @@ xmlNanoFTPGetConnection(void *ctx) {
 		&temp[3], &temp[4], &temp[5]) != 6) {
 		__xmlIOErr(XML_FROM_FTP, XML_FTP_PASV_ANSWER,
 			"Invalid answer to PASV\n");
-		if (ctxt->dataFd != -1) {
-		    closesocket (ctxt->dataFd); ctxt->dataFd = -1;
+		if (ctxt->dataFd != INVALID_SOCKET) {
+		    closesocket (ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
 		}
-		return (-1);
+		return INVALID_SOCKET;
 	    }
 	    for (i=0; i<6; i++) ad[i] = (unsigned char) (temp[i] & 0xff);
 	    memcpy (&((struct sockaddr_in *)&dataAddr)->sin_addr, &ad[0], 4);
@@ -1462,8 +1463,8 @@ xmlNanoFTPGetConnection(void *ctx) {
 
 	if (connect(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) {
 	    __xmlIOErr(XML_FROM_FTP, 0, "Failed to create a data connection");
-	    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	    return (-1);
+	    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	    return INVALID_SOCKET;
 	}
     } else {
         getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen);
@@ -1476,15 +1477,15 @@ xmlNanoFTPGetConnection(void *ctx) {
 
 	if (bind(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) {
 	    __xmlIOErr(XML_FROM_FTP, 0, "bind failed");
-	    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	    return (-1);
+	    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	    return INVALID_SOCKET;
 	}
         getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen);
 
 	if (listen(ctxt->dataFd, 1) < 0) {
 	    __xmlIOErr(XML_FROM_FTP, 0, "listen failed");
-	    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	    return (-1);
+	    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	    return INVALID_SOCKET;
 	}
 #ifdef SUPPORT_IP6
 	if ((ctxt->ftpAddr).ss_family == AF_INET6) {
@@ -1513,13 +1514,13 @@ xmlNanoFTPGetConnection(void *ctx) {
 	res = send(ctxt->controlFd, buf, len, 0);
 	if (res < 0) {
 	    __xmlIOErr(XML_FROM_FTP, 0, "send failed");
-	    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	    return(res);
+	    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	    return INVALID_SOCKET;
 	}
         res = xmlNanoFTPGetResponse(ctxt);
 	if (res != 2) {
-	    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	    return(-1);
+	    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	    return INVALID_SOCKET;
         }
     }
     return(ctxt->dataFd);
@@ -1542,9 +1543,9 @@ xmlNanoFTPCloseConnection(void *ctx) {
     fd_set rfd, efd;
     struct timeval tv;
 
-    if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
+    if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
 
-    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
+    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
     tv.tv_sec = 15;
     tv.tv_usec = 0;
     FD_ZERO(&rfd);
@@ -1556,7 +1557,7 @@ xmlNanoFTPCloseConnection(void *ctx) {
 #ifdef DEBUG_FTP
 	perror("select");
 #endif
-	closesocket(ctxt->controlFd); ctxt->controlFd = -1;
+	closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
 	return(-1);
     }
     if (res == 0) {
@@ -1564,11 +1565,11 @@ xmlNanoFTPCloseConnection(void *ctx) {
 	xmlGenericError(xmlGenericErrorContext,
 		"xmlNanoFTPCloseConnection: timeout\n");
 #endif
-	closesocket(ctxt->controlFd); ctxt->controlFd = -1;
+	closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
     } else {
 	res = xmlNanoFTPGetResponse(ctxt);
 	if (res != 2) {
-	    closesocket(ctxt->controlFd); ctxt->controlFd = -1;
+	    closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
 	    return(-1);
 	}
     }
@@ -1729,7 +1730,7 @@ xmlNanoFTPList(void *ctx, ftpListCallbac
         if (xmlNanoFTPCwd(ctxt, ctxt->path) < 1)
 	    return(-1);
 	ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
-	if (ctxt->dataFd == -1)
+	if (ctxt->dataFd == INVALID_SOCKET)
 	    return(-1);
 	snprintf(buf, sizeof(buf), "LIST -L\r\n");
     } else {
@@ -1738,7 +1739,7 @@ xmlNanoFTPList(void *ctx, ftpListCallbac
 		return(-1);
 	}
 	ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
-	if (ctxt->dataFd == -1)
+	if (ctxt->dataFd == INVALID_SOCKET)
 	    return(-1);
 	snprintf(buf, sizeof(buf), "LIST -L %s\r\n", filename);
     }
@@ -1750,12 +1751,12 @@ xmlNanoFTPList(void *ctx, ftpListCallbac
     res = send(ctxt->controlFd, buf, len, 0);
     if (res < 0) {
 	__xmlIOErr(XML_FROM_FTP, 0, "send failed");
-	closesocket(ctxt->dataFd); ctxt->dataFd = -1;
+	closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
 	return(res);
     }
     res = xmlNanoFTPReadResponse(ctxt);
     if (res != 1) {
-	closesocket(ctxt->dataFd); ctxt->dataFd = -1;
+	closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
 	return(-res);
     }
 
@@ -1771,18 +1772,18 @@ xmlNanoFTPList(void *ctx, ftpListCallbac
 #ifdef DEBUG_FTP
 	    perror("select");
 #endif
-	    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
+	    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
 	    return(-1);
 	}
 	if (res == 0) {
 	    res = xmlNanoFTPCheckResponse(ctxt);
 	    if (res < 0) {
-		closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-		ctxt->dataFd = -1;
+		closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+		ctxt->dataFd = INVALID_SOCKET;
 		return(-1);
 	    }
 	    if (res == 2) {
-		closesocket(ctxt->dataFd); ctxt->dataFd = -1;
+		closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
 		return(0);
 	    }
 
@@ -1791,8 +1792,8 @@ xmlNanoFTPList(void *ctx, ftpListCallbac
 
 	if ((len = recv(ctxt->dataFd, &buf[indx], sizeof(buf) - (indx + 1), 0)) < 0) {
 	    __xmlIOErr(XML_FROM_FTP, 0, "recv");
-	    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	    ctxt->dataFd = -1;
+	    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	    ctxt->dataFd = INVALID_SOCKET;
 	    return(-1);
 	}
 #ifdef DEBUG_FTP
@@ -1824,18 +1825,18 @@ xmlNanoFTPList(void *ctx, ftpListCallbac
  */
 
 
-int
+SOCKET
 xmlNanoFTPGetSocket(void *ctx, const char *filename) {
     xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
     char buf[300];
     int res, len;
     if (ctx == NULL)
-	return(-1);
+	return INVALID_SOCKET;
     if ((filename == NULL) && (ctxt->path == NULL))
-	return(-1);
+	return INVALID_SOCKET;
     ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
-    if (ctxt->dataFd == -1)
-	return(-1);
+    if (ctxt->dataFd == INVALID_SOCKET)
+	return INVALID_SOCKET;
 
     snprintf(buf, sizeof(buf), "TYPE I\r\n");
     len = strlen(buf);
@@ -1845,13 +1846,13 @@ xmlNanoFTPGetSocket(void *ctx, const cha
     res = send(ctxt->controlFd, buf, len, 0);
     if (res < 0) {
 	__xmlIOErr(XML_FROM_FTP, 0, "send failed");
-	closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	return(res);
+	closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	return INVALID_SOCKET;
     }
     res = xmlNanoFTPReadResponse(ctxt);
     if (res != 2) {
-	closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	return(-res);
+	closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	return INVALID_SOCKET;
     }
     if (filename == NULL)
 	snprintf(buf, sizeof(buf), "RETR %s\r\n", ctxt->path);
@@ -1865,13 +1866,13 @@ xmlNanoFTPGetSocket(void *ctx, const cha
     res = send(ctxt->controlFd, buf, len, 0);
     if (res < 0) {
 	__xmlIOErr(XML_FROM_FTP, 0, "send failed");
-	closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	return(res);
+	closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	return INVALID_SOCKET;
     }
     res = xmlNanoFTPReadResponse(ctxt);
     if (res != 1) {
-	closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-	return(-res);
+	closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+	return INVALID_SOCKET;
     }
     return(ctxt->dataFd);
 }
@@ -1903,7 +1904,7 @@ xmlNanoFTPGet(void *ctx, ftpDataCallback
 	return(-1);
     if (callback == NULL)
 	return(-1);
-    if (xmlNanoFTPGetSocket(ctxt, filename) < 0)
+    if (xmlNanoFTPGetSocket(ctxt, filename) == INVALID_SOCKET)
 	return(-1);
 
     do {
@@ -1916,18 +1917,18 @@ xmlNanoFTPGet(void *ctx, ftpDataCallback
 #ifdef DEBUG_FTP
 	    perror("select");
 #endif
-	    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
+	    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
 	    return(-1);
 	}
 	if (res == 0) {
 	    res = xmlNanoFTPCheckResponse(ctxt);
 	    if (res < 0) {
-		closesocket(ctxt->dataFd); ctxt->dataFd = -1;
-		ctxt->dataFd = -1;
+		closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
+		ctxt->dataFd = INVALID_SOCKET;
 		return(-1);
 	    }
 	    if (res == 2) {
-		closesocket(ctxt->dataFd); ctxt->dataFd = -1;
+		closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
 		return(0);
 	    }
 
@@ -1936,7 +1937,7 @@ xmlNanoFTPGet(void *ctx, ftpDataCallback
 	if ((len = recv(ctxt->dataFd, buf, sizeof(buf), 0)) < 0) {
 	    __xmlIOErr(XML_FROM_FTP, 0, "recv failed");
 	    callback(userData, buf, len);
-	    closesocket(ctxt->dataFd); ctxt->dataFd = -1;
+	    closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
 	    return(-1);
 	}
 	callback(userData, buf, len);
@@ -1962,7 +1963,7 @@ xmlNanoFTPRead(void *ctx, void *dest, in
     xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
 
     if (ctx == NULL) return(-1);
-    if (ctxt->dataFd < 0) return(0);
+    if (ctxt->dataFd == INVALID_SOCKET) return(0);
     if (dest == NULL) return(-1);
     if (len <= 0) return(0);
 
@@ -1990,7 +1991,7 @@ xmlNanoFTPRead(void *ctx, void *dest, in
 void*
 xmlNanoFTPOpen(const char *URL) {
     xmlNanoFTPCtxtPtr ctxt;
-    int sock;
+    SOCKET sock;
 
     xmlNanoFTPInit();
     if (URL == NULL) return(NULL);
@@ -2003,7 +2004,7 @@ xmlNanoFTPOpen(const char *URL) {
 	return(NULL);
     }
     sock = xmlNanoFTPGetSocket(ctxt, ctxt->path);
-    if (sock < 0) {
+    if (sock == INVALID_SOCKET) {
 	xmlNanoFTPFreeCtxt(ctxt);
 	return(NULL);
     }
@@ -2026,14 +2027,14 @@ xmlNanoFTPClose(void *ctx) {
     if (ctxt == NULL)
 	return(-1);
 
-    if (ctxt->dataFd >= 0) {
+    if (ctxt->dataFd != INVALID_SOCKET) {
 	closesocket(ctxt->dataFd);
-	ctxt->dataFd = -1;
+	ctxt->dataFd = INVALID_SOCKET;
     }
-    if (ctxt->controlFd >= 0) {
+    if (ctxt->controlFd != INVALID_SOCKET) {
 	xmlNanoFTPQuit(ctxt);
 	closesocket(ctxt->controlFd);
-	ctxt->controlFd = -1;
+	ctxt->controlFd = INVALID_SOCKET;
     }
     xmlNanoFTPFreeCtxt(ctxt);
     return(0);
diff -urNp libxml2-2.7.7/nanohttp.c libxml2-2.7.7x/nanohttp.c
--- libxml2-2.7.7/nanohttp.c	2009-10-19 14:55:48.000000000 +0300
+++ libxml2-2.7.7x/nanohttp.c	2010-03-27 11:13:32.000000000 +0200
@@ -75,18 +75,18 @@
 #ifdef VMS
 #include <stropts>
 #define XML_SOCKLEN_T unsigned int
-#define SOCKET int
 #endif
 
 #if defined(__MINGW32__) || defined(_WIN32_WCE)
+#ifndef _WINSOCKAPI_
 #define _WINSOCKAPI_
+#endif
 #include <wsockcompat.h>
 #include <winsock2.h>
 #undef XML_SOCKLEN_T
 #define XML_SOCKLEN_T unsigned int
 #endif
 
-
 #include <libxml/globals.h>
 #include <libxml/xmlerror.h>
 #include <libxml/xmlmemory.h>
@@ -103,6 +103,7 @@
 #define closesocket(s) close(s)
 #endif
 #define SOCKET int
+#define INVALID_SOCKET (-1)
 #endif
 
 #ifdef __BEOS__
@@ -114,9 +115,6 @@
 #ifndef XML_SOCKLEN_T
 #define XML_SOCKLEN_T unsigned int
 #endif
-#ifndef SOCKET
-#define SOCKET int
-#endif
 
 #ifdef STANDALONE
 #define DEBUG_HTTP
@@ -196,10 +194,10 @@ static int socket_errno(void) {
 #ifdef SUPPORT_IP6
 static
 int have_ipv6(void) {
-    int s;
+    SOCKET s;
 
     s = socket (AF_INET6, SOCK_STREAM, 0);
-    if (s != -1) {
+    if (s != INVALID_SOCKET) {
 	close (s);
 	return (1);
     }
@@ -393,7 +391,7 @@ xmlNanoHTTPNewCtxt(const char *URL) {
     memset(ret, 0, sizeof(xmlNanoHTTPCtxt));
     ret->port = 80;
     ret->returnValue = 0;
-    ret->fd = -1;
+    ret->fd = INVALID_SOCKET;
     ret->ContentLength = -1;
 
     xmlNanoHTTPScanURL(ret, URL);
@@ -430,8 +428,8 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr c
 #endif
 
     ctxt->state = XML_NANO_HTTP_NONE;
-    if (ctxt->fd >= 0) closesocket(ctxt->fd);
-    ctxt->fd = -1;
+    if (ctxt->fd != INVALID_SOCKET) closesocket(ctxt->fd);
+    ctxt->fd = INVALID_SOCKET;
     xmlFree(ctxt);
 }
 
@@ -842,7 +840,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr
  * Returns -1 in case of failure, the file descriptor number otherwise
  */
 
-static int
+static SOCKET
 xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
 {
 #ifndef HAVE_POLL_H
@@ -870,12 +868,12 @@ xmlNanoHTTPConnectAttempt(struct sockadd
         s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
         addrlen = sizeof(struct sockaddr_in);
     }
-    if (s == -1) {
+    if (s == INVALID_SOCKET) {
 #ifdef DEBUG_HTTP
         perror("socket");
 #endif
         __xmlIOErr(XML_FROM_HTTP, 0, "socket failed\n");
-        return (-1);
+        return INVALID_SOCKET;
     }
 #ifdef _WINSOCKAPI_
     {
@@ -916,7 +914,7 @@ xmlNanoHTTPConnectAttempt(struct sockadd
 #endif
         __xmlIOErr(XML_FROM_HTTP, 0, "error setting non-blocking IO\n");
         closesocket(s);
-        return (-1);
+        return INVALID_SOCKET;
     }
 #endif /* !__BEOS__ */
 #endif /* !VMS */
@@ -931,7 +929,7 @@ xmlNanoHTTPConnectAttempt(struct sockadd
                 __xmlIOErr(XML_FROM_HTTP, 0,
                            "error connecting to HTTP server");
                 closesocket(s);
-                return (-1);
+                return INVALID_SOCKET;
         }
     }
 #ifndef HAVE_POLL_H
@@ -944,7 +942,7 @@ xmlNanoHTTPConnectAttempt(struct sockadd
 #endif
 #ifndef _WINSOCKAPI_
     if (s > FD_SETSIZE)
-        return -1;
+        return INVALID_SOCKET;
 #endif
     FD_ZERO(&wfd);
     FD_SET(s, &wfd);
@@ -972,12 +970,12 @@ xmlNanoHTTPConnectAttempt(struct sockadd
             /* Time out */
             __xmlIOErr(XML_FROM_HTTP, 0, "Connect attempt timed out");
             closesocket(s);
-            return (-1);
+            return INVALID_SOCKET;
         case -1:
             /* Ermm.. ?? */
             __xmlIOErr(XML_FROM_HTTP, 0, "Connect failed");
             closesocket(s);
-            return (-1);
+            return INVALID_SOCKET;
     }
 
 #ifndef HAVE_POLL_H
@@ -998,7 +996,7 @@ xmlNanoHTTPConnectAttempt(struct sockadd
             0) {
             /* Solaris error code */
             __xmlIOErr(XML_FROM_HTTP, 0, "getsockopt failed\n");
-            return (-1);
+            return INVALID_SOCKET;
         }
 #endif
         if (status) {
@@ -1006,13 +1004,13 @@ xmlNanoHTTPConnectAttempt(struct sockadd
                        "Error connecting to remote host");
             closesocket(s);
             errno = status;
-            return (-1);
+            return INVALID_SOCKET;
         }
     } else {
         /* pbm */
         __xmlIOErr(XML_FROM_HTTP, 0, "select failed\n");
         closesocket(s);
-        return (-1);
+        return INVALID_SOCKET;
     }
 
     return (s);
@@ -1029,7 +1027,7 @@ xmlNanoHTTPConnectAttempt(struct sockadd
  * Returns -1 in case of failure, the file descriptor number otherwise
  */
 
-static int
+static SOCKET
 xmlNanoHTTPConnectHost(const char *host, int port)
 {
     struct hostent *h;
@@ -1042,7 +1040,7 @@ xmlNanoHTTPConnectHost(const char *host,
     struct sockaddr_in6 sockin6;
 #endif
     int i;
-    int s;
+    SOCKET s;
 
     memset (&sockin, 0, sizeof(sockin));
 #ifdef SUPPORT_IP6
@@ -1073,7 +1071,7 @@ xmlNanoHTTPConnectHost(const char *host,
 	status = getaddrinfo (host, NULL, &hints, &result);
 	if (status) {
 	    __xmlIOErr(XML_FROM_HTTP, 0, "getaddrinfo failed\n");
-	    return (-1);
+	    return INVALID_SOCKET;
 	}
 
 	for (res = result; res; res = res->ai_next) {
@@ -1081,7 +1079,7 @@ xmlNanoHTTPConnectHost(const char *host,
 		if (res->ai_addrlen > sizeof(sockin)) {
 		    __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
 		    freeaddrinfo (result);
-		    return (-1);
+		    return INVALID_SOCKET;
 		}
 		memcpy (&sockin, res->ai_addr, res->ai_addrlen);
 		sockin.sin_port = htons (port);
@@ -1091,7 +1089,7 @@ xmlNanoHTTPConnectHost(const char *host,
 		if (res->ai_addrlen > sizeof(sockin6)) {
 		    __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
 		    freeaddrinfo (result);
-		    return (-1);
+		    return INVALID_SOCKET;
 		}
 		memcpy (&sockin6, res->ai_addr, res->ai_addrlen);
 		sockin6.sin6_port = htons (port);
@@ -1101,7 +1099,7 @@ xmlNanoHTTPConnectHost(const char *host,
 		continue;              /* for */
 
 	    s = xmlNanoHTTPConnectAttempt (addr);
-	    if (s != -1) {
+	    if (s != INVALID_SOCKET) {
 		freeaddrinfo (result);
 		return (s);
 	    }
@@ -1155,7 +1153,7 @@ xmlNanoHTTPConnectHost(const char *host,
 #else
 	    __xmlIOErr(XML_FROM_HTTP, 0, "Failed to resolve host");
 #endif
-	    return (-1);
+	    return INVALID_SOCKET;
 	}
 
 	for (i = 0; h->h_addr_list[i]; i++) {
@@ -1163,7 +1161,7 @@ xmlNanoHTTPConnectHost(const char *host,
 		/* A records (IPv4) */
 		if ((unsigned int) h->h_length > sizeof(ia)) {
 		    __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
-		    return (-1);
+		    return INVALID_SOCKET;
 		}
 		memcpy (&ia, h->h_addr_list[i], h->h_length);
 		sockin.sin_family = h->h_addrtype;
@@ -1175,7 +1173,7 @@ xmlNanoHTTPConnectHost(const char *host,
 		/* AAAA records (IPv6) */
 		if ((unsigned int) h->h_length > sizeof(ia6)) {
 		    __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
-		    return (-1);
+		    return INVALID_SOCKET;
 		}
 		memcpy (&ia6, h->h_addr_list[i], h->h_length);
 		sockin6.sin6_family = h->h_addrtype;
@@ -1187,7 +1185,7 @@ xmlNanoHTTPConnectHost(const char *host,
 		break;              /* for */
 
 	    s = xmlNanoHTTPConnectAttempt (addr);
-	    if (s != -1)
+	    if (s != INVALID_SOCKET)
 		return (s);
 	}
     }
@@ -1198,7 +1196,7 @@ xmlNanoHTTPConnectHost(const char *host,
                     "xmlNanoHTTPConnectHost:  unable to connect to '%s'.\n",
                     host);
 #endif
-    return (-1);
+    return INVALID_SOCKET;
 }
 
 
@@ -1342,7 +1340,8 @@ xmlNanoHTTPMethodRedir(const char *URL, 
 		  const char *headers, int ilen ) {
     xmlNanoHTTPCtxtPtr ctxt;
     char *bp, *p;
-    int blen, ret;
+    int blen;
+    SOCKET ret;
     int nbRedirects = 0;
     char *redirURL = NULL;
 #ifdef DEBUG_HTTP
@@ -1386,7 +1385,7 @@ retry:
 	blen = strlen(ctxt->hostname);
 	ret = xmlNanoHTTPConnectHost(ctxt->hostname, ctxt->port);
     }
-    if (ret < 0) {
+    if (ret == INVALID_SOCKET) {
         xmlNanoHTTPFreeCtxt(ctxt);
 	if (redirURL != NULL) xmlFree(redirURL);
         return(NULL);
diff -urNp libxml2-2.7.7/testapi.c libxml2-2.7.7x/testapi.c
--- libxml2-2.7.7/testapi.c	2009-09-24 18:32:00.000000000 +0300
+++ libxml2-2.7.7x/testapi.c	2010-03-27 10:34:05.000000000 +0200
@@ -11641,7 +11641,7 @@ test_xmlNanoFTPGetConnection(void) {
 
 #if defined(LIBXML_FTP_ENABLED)
     int mem_base;
-    int ret_val;
+    SOCKET ret_val;
     void * ctx; /* an FTP context */
     int n_ctx;
 
@@ -11709,7 +11709,7 @@ test_xmlNanoFTPGetSocket(void) {
 
 #if defined(LIBXML_FTP_ENABLED)
     int mem_base;
-    int ret_val;
+    SOCKET ret_val;
     void * ctx; /* an FTP context */
     int n_ctx;
     const char * filename; /* the file to retrieve (or NULL if path is in context). */
diff -urNp libxml2-2.7.7/doc/devhelp/libxml2-nanoftp.html libxml2-2.7.7x/doc/devhelp/libxml2-nanoftp.html
--- libxml2-2.7.7/doc/devhelp/libxml2-nanoftp.html	2010-03-15 17:18:54.000000000 +0200
+++ libxml2-2.7.7x/doc/devhelp/libxml2-nanoftp.html	2010-03-27 11:16:13.000000000 +0200
@@ -62,7 +62,7 @@ void *	<a href="#xmlNanoFTPConnectTo">xm
 int	<a href="#xmlNanoFTPList">xmlNanoFTPList</a>			(void * ctx, <br/>					 <a href="libxml2-nanoftp.html#ftpListCallback">ftpListCallback</a> callback, <br/>					 void * userData, <br/>					 const char * filename);
 void *	<a href="#xmlNanoFTPOpen">xmlNanoFTPOpen</a>			(const char * URL);
 int	<a href="#xmlNanoFTPConnect">xmlNanoFTPConnect</a>		(void * ctx);
-int	<a href="#xmlNanoFTPGetSocket">xmlNanoFTPGetSocket</a>		(void * ctx, <br/>					 const char * filename);
+SOCKET	<a href="#xmlNanoFTPGetSocket">xmlNanoFTPGetSocket</a>		(void * ctx, <br/>					 const char * filename);
 int	<a href="#xmlNanoFTPGet">xmlNanoFTPGet</a>			(void * ctx, <br/>					 <a href="libxml2-nanoftp.html#ftpDataCallback">ftpDataCallback</a> callback, <br/>					 void * userData, <br/>					 const char * filename);
 int	<a href="#xmlNanoFTPRead">xmlNanoFTPRead</a>			(void * ctx, <br/>					 void * dest, <br/>					 int len);
 void	<a href="#xmlNanoFTPFreeCtxt">xmlNanoFTPFreeCtxt</a>		(void * ctx);
diff -urNp libxml2-2.7.7/doc/html/libxml-nanoftp.html libxml2-2.7.7x/doc/html/libxml-nanoftp.html
--- libxml2-2.7.7/doc/html/libxml-nanoftp.html	2010-03-15 17:18:52.000000000 +0200
+++ libxml2-2.7.7x/doc/html/libxml-nanoftp.html	2010-03-27 11:16:00.000000000 +0200
@@ -28,7 +28,7 @@ void	<a href="#ftpListCallback">ftpListC
 <pre class="programlisting">int	<a href="#xmlNanoFTPGet">xmlNanoFTPGet</a>			(void * ctx, <br />					 <a href="libxml-nanoftp.html#ftpDataCallback">ftpDataCallback</a> callback, <br />					 void * userData, <br />					 const char * filename)</pre>
 <pre class="programlisting">int	<a href="#xmlNanoFTPGetConnection">xmlNanoFTPGetConnection</a>		(void * ctx)</pre>
 <pre class="programlisting">int	<a href="#xmlNanoFTPGetResponse">xmlNanoFTPGetResponse</a>		(void * ctx)</pre>
-<pre class="programlisting">int	<a href="#xmlNanoFTPGetSocket">xmlNanoFTPGetSocket</a>		(void * ctx, <br />					 const char * filename)</pre>
+<pre class="programlisting">SOCKET	<a href="#xmlNanoFTPGetSocket">xmlNanoFTPGetSocket</a>		(void * ctx, <br />					 const char * filename)</pre>
 <pre class="programlisting">void	<a href="#xmlNanoFTPInit">xmlNanoFTPInit</a>			(void)</pre>
 <pre class="programlisting">int	<a href="#xmlNanoFTPList">xmlNanoFTPList</a>			(void * ctx, <br />					 <a href="libxml-nanoftp.html#ftpListCallback">ftpListCallback</a> callback, <br />					 void * userData, <br />					 const char * filename)</pre>
 <pre class="programlisting">void *	<a href="#xmlNanoFTPNewCtxt">xmlNanoFTPNewCtxt</a>		(const char * URL)</pre>
@@ -69,7 +69,7 @@ void	ftpListCallback			(void * userData,
 </pre><p>Try to open a data connection to the server. Currently only passive mode is supported.</p>
 <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>an FTP context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 incase of error, 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlNanoFTPGetResponse" id="xmlNanoFTPGetResponse"></a>Function: xmlNanoFTPGetResponse</h3><pre class="programlisting">int	xmlNanoFTPGetResponse		(void * ctx)<br />
 </pre><p>Get the response from the FTP server after a command.</p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>an FTP context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the code number</td></tr></tbody></table></div><h3><a name="xmlNanoFTPGetSocket" id="xmlNanoFTPGetSocket"></a>Function: xmlNanoFTPGetSocket</h3><pre class="programlisting">int	xmlNanoFTPGetSocket		(void * ctx, <br />					 const char * filename)<br />
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>an FTP context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the code number</td></tr></tbody></table></div><h3><a name="xmlNanoFTPGetSocket" id="xmlNanoFTPGetSocket"></a>Function: xmlNanoFTPGetSocket</h3><pre class="programlisting">SOCKET	xmlNanoFTPGetSocket		(void * ctx, <br />					 const char * filename)<br />
 </pre><p>Initiate fetch of the given file from the server.</p>
 <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>an FTP context</td></tr><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the file to retrieve (or NULL if path is in context).</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the socket for the data connection, or &lt;0 in case of error</td></tr></tbody></table></div><h3><a name="xmlNanoFTPInit" id="xmlNanoFTPInit"></a>Function: xmlNanoFTPInit</h3><pre class="programlisting">void	xmlNanoFTPInit			(void)<br />
 </pre><p>Initialize the FTP protocol layer. Currently it just checks for proxy informations, and get the hostname</p>
