Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

614087 Fix Socket API usage to allow Windows64 compilation

In Windows 64 a socket is no more represented by an int,
this breaks the nanoftp API and nanoftp/nanohttp, the patch
changes this and fix the API for Win64
Regenerated the XML and documentation as a result too.
  • Loading branch information...
commit f99d222316e1219aa8b95220f6918e6c7018e174 1 parent ce5f9a7
@sezero sezero authored veillard committed
View
4 doc/APIconstructors.html
@@ -7,7 +7,9 @@
H2 {font-family: Verdana,Arial,Helvetica}
H3 {font-family: Verdana,Arial,Helvetica}
A:link, A:visited, A:active { text-decoration: underline }
-</style><title>List of constructors for libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XML C parser and toolkit of Gnome</h1><h2>List of constructors for libxml2</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Developer Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html" style="font-weight:bold">Main Menu</a></li><li><a href="html/index.html" style="font-weight:bold">Reference Manual</a></li><li><a href="examples/index.html" style="font-weight:bold">Code Examples</a></li><li><a href="guidelines.html">XML Guidelines</a></li><li><a href="tutorial/index.html">Tutorial</a></li><li><a href="xmlreader.html">The Reader Interface</a></li><li><a href="ChangeLog.html">ChangeLog</a></li><li><a href="XSLT.html">XSLT</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="architecture.html">libxml2 architecture</a></li><li><a href="tree.html">The tree output</a></li><li><a href="interface.html">The SAX interface</a></li><li><a href="xmlmem.html">Memory Management</a></li><li><a href="xmlio.html">I/O Interfaces</a></li><li><a href="library.html">The parser interfaces</a></li><li><a href="entities.html">Entities or no entities</a></li><li><a href="namespaces.html">Namespaces</a></li><li><a href="upgrade.html">Upgrading 1.x code</a></li><li><a href="threads.html">Thread safety</a></li><li><a href="DOM.html">DOM Principles</a></li><li><a href="example.html">A real example</a></li><li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://opencsw.org/packages/libxml2">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://codespeak.net/lxml/">lxml Python bindings</a></li><li><a href="http://cpan.uwinnipeg.ca/dist/XML-LibXML">Perl bindings</a></li><li><a href="http://libxmlplusplus.sourceforge.net/">C++ bindings</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4">PHP bindings</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://libxml.rubyforge.org/">Ruby bindings</a></li><li><a href="http://tclxml.sourceforge.net/">Tcl bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><h2>Type const htmlElemDesc *:</h2><p><a href="html/libxml-HTMLparser.html#htmlTagLookup">htmlTagLookup</a><br />
+</style><title>List of constructors for libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XML C parser and toolkit of Gnome</h1><h2>List of constructors for libxml2</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Developer Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html" style="font-weight:bold">Main Menu</a></li><li><a href="html/index.html" style="font-weight:bold">Reference Manual</a></li><li><a href="examples/index.html" style="font-weight:bold">Code Examples</a></li><li><a href="guidelines.html">XML Guidelines</a></li><li><a href="tutorial/index.html">Tutorial</a></li><li><a href="xmlreader.html">The Reader Interface</a></li><li><a href="ChangeLog.html">ChangeLog</a></li><li><a href="XSLT.html">XSLT</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="architecture.html">libxml2 architecture</a></li><li><a href="tree.html">The tree output</a></li><li><a href="interface.html">The SAX interface</a></li><li><a href="xmlmem.html">Memory Management</a></li><li><a href="xmlio.html">I/O Interfaces</a></li><li><a href="library.html">The parser interfaces</a></li><li><a href="entities.html">Entities or no entities</a></li><li><a href="namespaces.html">Namespaces</a></li><li><a href="upgrade.html">Upgrading 1.x code</a></li><li><a href="threads.html">Thread safety</a></li><li><a href="DOM.html">DOM Principles</a></li><li><a href="example.html">A real example</a></li><li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://opencsw.org/packages/libxml2">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://codespeak.net/lxml/">lxml Python bindings</a></li><li><a href="http://cpan.uwinnipeg.ca/dist/XML-LibXML">Perl bindings</a></li><li><a href="http://libxmlplusplus.sourceforge.net/">C++ bindings</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4">PHP bindings</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://libxml.rubyforge.org/">Ruby bindings</a></li><li><a href="http://tclxml.sourceforge.net/">Tcl bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><h2>Type SOCKET:</h2><p><a href="html/libxml-nanoftp.html#xmlNanoFTPGetConnection">xmlNanoFTPGetConnection</a><br />
+<a href="html/libxml-nanoftp.html#xmlNanoFTPGetSocket">xmlNanoFTPGetSocket</a><br />
+</p><h2>Type const htmlElemDesc *:</h2><p><a href="html/libxml-HTMLparser.html#htmlTagLookup">htmlTagLookup</a><br />
</p><h2>Type const htmlEntityDesc *:</h2><p><a href="html/libxml-HTMLparser.html#htmlEntityLookup">htmlEntityLookup</a><br />
<a href="html/libxml-HTMLparser.html#htmlEntityValueLookup">htmlEntityValueLookup</a><br />
<a href="html/libxml-HTMLparser.html#htmlParseEntityRef">htmlParseEntityRef</a><br />
View
5 doc/APIfiles.html
@@ -542,7 +542,9 @@
<a href="html/libxml-list.html#xmlListSort">xmlListSort</a><br />
<a href="html/libxml-list.html#xmlListWalk">xmlListWalk</a><br />
<a href="html/libxml-list.html#xmlListWalker">xmlListWalker</a><br />
-</p><h2><a name="nanoftp" id="nanoftp">Module nanoftp</a>:</h2><p><a href="html/libxml-nanoftp.html#ftpDataCallback">ftpDataCallback</a><br />
+</p><h2><a name="nanoftp" id="nanoftp">Module nanoftp</a>:</h2><p><a href="html/libxml-nanoftp.html#INVALID_SOCKET">INVALID_SOCKET</a><br />
+<a href="html/libxml-nanoftp.html#SOCKET">SOCKET</a><br />
+<a href="html/libxml-nanoftp.html#ftpDataCallback">ftpDataCallback</a><br />
<a href="html/libxml-nanoftp.html#ftpListCallback">ftpListCallback</a><br />
<a href="html/libxml-nanoftp.html#xmlNanoFTPCheckResponse">xmlNanoFTPCheckResponse</a><br />
<a href="html/libxml-nanoftp.html#xmlNanoFTPCleanup">xmlNanoFTPCleanup</a><br />
@@ -2818,6 +2820,7 @@
<a href="html/libxml-xmlsave.html#XML_SAVE_NO_DECL">XML_SAVE_NO_DECL</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a><br />
+<a href="html/libxml-xmlsave.html#XML_SAVE_WSNONSIG">XML_SAVE_WSNONSIG</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_XHTML">XML_SAVE_XHTML</a><br />
<a href="html/libxml-xmlsave.html#xmlSaveClose">xmlSaveClose</a><br />
<a href="html/libxml-xmlsave.html#xmlSaveCtxt">xmlSaveCtxt</a><br />
View
3  doc/APIsymbols.html
@@ -40,6 +40,7 @@
<a href="html/libxml-HTMLtree.html#HTML_TEXT_NODE">HTML_TEXT_NODE</a><br />
<a href="html/libxml-HTMLparser.html#HTML_VALID">HTML_VALID</a><br />
</p><h2>Letter I:</h2><p><a href="html/libxml-parserInternals.html#INPUT_CHUNK">INPUT_CHUNK</a><br />
+<a href="html/libxml-nanoftp.html#INVALID_SOCKET">INVALID_SOCKET</a><br />
<a href="html/libxml-parserInternals.html#IS_ASCII_DIGIT">IS_ASCII_DIGIT</a><br />
<a href="html/libxml-parserInternals.html#IS_ASCII_LETTER">IS_ASCII_LETTER</a><br />
<a href="html/libxml-parserInternals.html#IS_BASECHAR">IS_BASECHAR</a><br />
@@ -102,6 +103,7 @@
</p><h2>Letter M:</h2><p><a href="html/libxml-parserInternals.html#MOVETO_ENDTAG">MOVETO_ENDTAG</a><br />
<a href="html/libxml-parserInternals.html#MOVETO_STARTTAG">MOVETO_STARTTAG</a><br />
</p><h2>Letter S:</h2><p><a href="html/libxml-parserInternals.html#SKIP_EOL">SKIP_EOL</a><br />
+<a href="html/libxml-nanoftp.html#SOCKET">SOCKET</a><br />
</p><h2>Letter U:</h2><p><a href="html/libxml-HTMLparser.html#UTF8ToHtml">UTF8ToHtml</a><br />
<a href="html/libxml-encoding.html#UTF8Toisolat1">UTF8Toisolat1</a><br />
</p><h2>Letter W:</h2><p><a href="html/libxml-xmlversion.html#WITHOUT_TRIO">WITHOUT_TRIO</a><br />
@@ -807,6 +809,7 @@
<a href="html/libxml-xmlsave.html#XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a><br />
<a href="html/libxml-xmlerror.html#XML_SAVE_UNKNOWN_ENCODING">XML_SAVE_UNKNOWN_ENCODING</a><br />
+<a href="html/libxml-xmlsave.html#XML_SAVE_WSNONSIG">XML_SAVE_WSNONSIG</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_XHTML">XML_SAVE_XHTML</a><br />
<a href="html/libxml-parser.html#XML_SAX2_MAGIC">XML_SAX2_MAGIC</a><br />
<a href="html/libxml-xmlerror.html#XML_SCHEMAP_AG_PROPS_CORRECT">XML_SCHEMAP_AG_PROPS_CORRECT</a><br />
View
20 doc/devhelp/libxml2-nanoftp.html
@@ -43,13 +43,15 @@
<p>Author(s): Daniel Veillard </p>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
- <pre class="synopsis">int <a href="#xmlNanoFTPQuit">xmlNanoFTPQuit</a> (void * ctx);
+ <pre class="synopsis">#define <a href="#INVALID_SOCKET">INVALID_SOCKET</a>;
+#define <a href="#SOCKET">SOCKET</a>;
+int <a href="#xmlNanoFTPQuit">xmlNanoFTPQuit</a> (void * ctx);
int <a href="#xmlNanoFTPClose">xmlNanoFTPClose</a> (void * ctx);
typedef void <a href="#ftpListCallback">ftpListCallback</a> (void * userData, <br/> const char * filename, <br/> const char * attrib, <br/> const char * owner, <br/> const char * group, <br/> unsigned long size, <br/> int links, <br/> int year, <br/> const char * month, <br/> int day, <br/> int hour, <br/> int minute);
int <a href="#xmlNanoFTPCloseConnection">xmlNanoFTPCloseConnection</a> (void * ctx);
void <a href="#xmlNanoFTPProxy">xmlNanoFTPProxy</a> (const char * host, <br/> int port, <br/> const char * user, <br/> const char * passwd, <br/> int type);
int <a href="#xmlNanoFTPUpdateURL">xmlNanoFTPUpdateURL</a> (void * ctx, <br/> const char * URL);
-int <a href="#xmlNanoFTPGetConnection">xmlNanoFTPGetConnection</a> (void * ctx);
+<a href="libxml2-nanoftp.html#SOCKET">SOCKET</a> <a href="#xmlNanoFTPGetConnection">xmlNanoFTPGetConnection</a> (void * ctx);
int <a href="#xmlNanoFTPDele">xmlNanoFTPDele</a> (void * ctx, <br/> const char * file);
void * <a href="#xmlNanoFTPNewCtxt">xmlNanoFTPNewCtxt</a> (const char * URL);
int <a href="#xmlNanoFTPCheckResponse">xmlNanoFTPCheckResponse</a> (void * ctx);
@@ -62,7 +64,7 @@
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);
+<a href="libxml2-nanoftp.html#SOCKET">SOCKET</a> <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);
@@ -75,6 +77,14 @@
<div class="refsect1" lang="en">
<h2>Details</h2>
<div class="refsect2" lang="en">
+ <div class="refsect2" lang="en"><h3><a name="INVALID_SOCKET">Macro </a>INVALID_SOCKET</h3><pre class="programlisting">#define <a href="#INVALID_SOCKET">INVALID_SOCKET</a>;
+</pre><p/>
+</div>
+ <hr/>
+ <div class="refsect2" lang="en"><h3><a name="SOCKET">Macro </a>SOCKET</h3><pre class="programlisting">#define <a href="#SOCKET">SOCKET</a>;
+</pre><p/>
+</div>
+ <hr/>
<div class="refsect2" lang="en"><h3><a name="ftpDataCallback"/>Function type ftpDataCallback</h3><pre class="programlisting">void ftpDataCallback (void * userData, <br/> const char * data, <br/> int len)<br/>
</pre><p>A callback for the <a href="libxml2-nanoftp.html#xmlNanoFTPGet">xmlNanoFTPGet</a> command.</p>
<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>userData</tt></i>:</span></td><td>the user provided context</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>the data received</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>its size in bytes</td></tr></tbody></table></div></div>
@@ -123,7 +133,7 @@
</pre><p>Fetch the given file from the server. All data are passed back in the callbacks. The last callback has a size of 0 block.</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>callback</tt></i>:</span></td><td>the user callback</td></tr><tr><td><span class="term"><i><tt>userData</tt></i>:</span></td><td>the user callback data</td></tr><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the file to retrieve</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></div>
<hr/>
- <div class="refsect2" lang="en"><h3><a name="xmlNanoFTPGetConnection"/>xmlNanoFTPGetConnection ()</h3><pre class="programlisting">int xmlNanoFTPGetConnection (void * ctx)<br/>
+ <div class="refsect2" lang="en"><h3><a name="xmlNanoFTPGetConnection"/>xmlNanoFTPGetConnection ()</h3><pre class="programlisting"><a href="libxml2-nanoftp.html#SOCKET">SOCKET</a> xmlNanoFTPGetConnection (void * ctx)<br/>
</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></div>
<hr/>
@@ -131,7 +141,7 @@
</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></div>
<hr/>
- <div class="refsect2" lang="en"><h3><a name="xmlNanoFTPGetSocket"/>xmlNanoFTPGetSocket ()</h3><pre class="programlisting">int xmlNanoFTPGetSocket (void * ctx, <br/> const char * filename)<br/>
+ <div class="refsect2" lang="en"><h3><a name="xmlNanoFTPGetSocket"/>xmlNanoFTPGetSocket ()</h3><pre class="programlisting"><a href="libxml2-nanoftp.html#SOCKET">SOCKET</a> 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></div>
<hr/>
View
3  doc/devhelp/libxml2-xmlsave.html
@@ -81,7 +81,8 @@
<a name="XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a> = 8 /* disable XHTML1 specific rules */
<a name="XML_SAVE_XHTML">XML_SAVE_XHTML</a> = 16 /* force XHTML1 specific rules */
<a name="XML_SAVE_AS_XML">XML_SAVE_AS_XML</a> = 32 /* force XML serialization on HTML doc */
- <a name="XML_SAVE_AS_HTML">XML_SAVE_AS_HTML</a> = 64 /* force HTML serialization on XML doc */
+ <a name="XML_SAVE_AS_HTML">XML_SAVE_AS_HTML</a> = 64 /* force HTML serialization on XML doc */
+ <a name="XML_SAVE_WSNONSIG">XML_SAVE_WSNONSIG</a> = 128 /* format with non-significant whitespace */
};
</pre><p/>
</div>
View
3  doc/devhelp/libxml2.devhelp
@@ -71,6 +71,7 @@
<function name="HTML_PRESERVE_NODE" link="libxml2-HTMLtree.html#HTML_PRESERVE_NODE"/>
<function name="HTML_TEXT_NODE" link="libxml2-HTMLtree.html#HTML_TEXT_NODE"/>
<function name="INPUT_CHUNK" link="libxml2-parserInternals.html#INPUT_CHUNK"/>
+ <function name="INVALID_SOCKET" link="libxml2-nanoftp.html#INVALID_SOCKET"/>
<function name="IS_ASCII_DIGIT" link="libxml2-parserInternals.html#IS_ASCII_DIGIT"/>
<function name="IS_ASCII_LETTER" link="libxml2-parserInternals.html#IS_ASCII_LETTER"/>
<function name="IS_BASECHAR" link="libxml2-parserInternals.html#IS_BASECHAR"/>
@@ -133,6 +134,7 @@
<function name="MOVETO_ENDTAG" link="libxml2-parserInternals.html#MOVETO_ENDTAG"/>
<function name="MOVETO_STARTTAG" link="libxml2-parserInternals.html#MOVETO_STARTTAG"/>
<function name="SKIP_EOL" link="libxml2-parserInternals.html#SKIP_EOL"/>
+ <function name="SOCKET" link="libxml2-nanoftp.html#SOCKET"/>
<function name="WITHOUT_TRIO" link="libxml2-xmlversion.html#WITHOUT_TRIO"/>
<function name="WITH_TRIO" link="libxml2-xmlversion.html#WITH_TRIO"/>
<function name="XINCLUDE_FALLBACK" link="libxml2-xinclude.html#XINCLUDE_FALLBACK"/>
@@ -988,6 +990,7 @@
<function name="XML_SAVE_NO_EMPTY" link="libxml2-xmlsave.html#XML_SAVE_NO_EMPTY"/>
<function name="XML_SAVE_NO_XHTML" link="libxml2-xmlsave.html#XML_SAVE_NO_XHTML"/>
<function name="XML_SAVE_UNKNOWN_ENCODING" link="libxml2-xmlerror.html#XML_SAVE_UNKNOWN_ENCODING"/>
+ <function name="XML_SAVE_WSNONSIG" link="libxml2-xmlsave.html#XML_SAVE_WSNONSIG"/>
<function name="XML_SAVE_XHTML" link="libxml2-xmlsave.html#XML_SAVE_XHTML"/>
<function name="XML_SCHEMAP_AG_PROPS_CORRECT" link="libxml2-xmlerror.html#XML_SCHEMAP_AG_PROPS_CORRECT"/>
<function name="XML_SCHEMAP_ATTRFORMDEFAULT_VALUE" link="libxml2-xmlerror.html#XML_SCHEMAP_ATTRFORMDEFAULT_VALUE"/>
View
12 doc/html/libxml-nanoftp.html
@@ -10,7 +10,7 @@
</style><style type="text/css">
div.deprecated pre.programlisting {border-style: double;border-color:red}
pre.programlisting {border-style: double;background: #EECFA1}
- </style><title>Module nanoftp from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="../epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="../gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="../w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="../redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="../Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1></h1><h2>Module nanoftp from libxml2</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a style="font-weight:bold" href="../index.html">Main Menu</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="../examples/index.html">Code Examples</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="libxml-parser.html">Parser API</a></li><li><a href="libxml-tree.html">Tree API</a></li><li><a href="libxml-xmlreader.html">Reader API</a></li><li><a href="../guidelines.html">XML Guidelines</a></li><li><a href="../ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="../APIchunk0.html">Alphabetic</a></li><li><a href="../APIconstructors.html">Constructors</a></li><li><a href="../APIfunctions.html">Functions/Types</a></li><li><a href="../APIfiles.html">Modules</a></li><li><a href="../APIsymbols.html">Symbols</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://opencsw.org/packages/libxml2">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://codespeak.net/lxml/">lxml Python bindings</a></li><li><a href="http://cpan.uwinnipeg.ca/dist/XML-LibXML">Perl bindings</a></li><li><a href="http://libxmlplusplus.sourceforge.net/">C++ bindings</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4">PHP bindings</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://libxml.rubyforge.org/">Ruby bindings</a></li><li><a href="http://tclxml.sourceforge.net/">Tcl bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-list.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxml-list.html">list</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="../index.html">The XML C parser and toolkit of Gnome</a></th><th align="right"><a href="libxml-nanohttp.html">nanohttp</a></th><td><a accesskey="n" href="libxml-nanohttp.html"><img src="right.png" width="24" height="24" border="0" alt="Next" /></a></td></tr></table><p>minimal FTP implementation allowing to fetch resources like external subset. </p><h2>Table of Contents</h2><pre class="programlisting">Function type: <a href="#ftpDataCallback">ftpDataCallback</a>
+ </style><title>Module nanoftp from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="../epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="../gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="../w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="../redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="../Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1></h1><h2>Module nanoftp from libxml2</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a style="font-weight:bold" href="../index.html">Main Menu</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="../examples/index.html">Code Examples</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="libxml-parser.html">Parser API</a></li><li><a href="libxml-tree.html">Tree API</a></li><li><a href="libxml-xmlreader.html">Reader API</a></li><li><a href="../guidelines.html">XML Guidelines</a></li><li><a href="../ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="../APIchunk0.html">Alphabetic</a></li><li><a href="../APIconstructors.html">Constructors</a></li><li><a href="../APIfunctions.html">Functions/Types</a></li><li><a href="../APIfiles.html">Modules</a></li><li><a href="../APIsymbols.html">Symbols</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://opencsw.org/packages/libxml2">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://codespeak.net/lxml/">lxml Python bindings</a></li><li><a href="http://cpan.uwinnipeg.ca/dist/XML-LibXML">Perl bindings</a></li><li><a href="http://libxmlplusplus.sourceforge.net/">C++ bindings</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4">PHP bindings</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://libxml.rubyforge.org/">Ruby bindings</a></li><li><a href="http://tclxml.sourceforge.net/">Tcl bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-list.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxml-list.html">list</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="../index.html">The XML C parser and toolkit of Gnome</a></th><th align="right"><a href="libxml-nanohttp.html">nanohttp</a></th><td><a accesskey="n" href="libxml-nanohttp.html"><img src="right.png" width="24" height="24" border="0" alt="Next" /></a></td></tr></table><p>minimal FTP implementation allowing to fetch resources like external subset. </p><h2>Table of Contents</h2><pre class="programlisting">#define <a href="#INVALID_SOCKET">INVALID_SOCKET</a></pre><pre class="programlisting">#define <a href="#SOCKET">SOCKET</a></pre><pre class="programlisting">Function type: <a href="#ftpDataCallback">ftpDataCallback</a>
void <a href="#ftpDataCallback">ftpDataCallback</a> (void * userData, <br /> const char * data, <br /> int len)
</pre>
<pre class="programlisting">Function type: <a href="#ftpListCallback">ftpListCallback</a>
@@ -26,9 +26,9 @@
<pre class="programlisting">int <a href="#xmlNanoFTPDele">xmlNanoFTPDele</a> (void * ctx, <br /> const char * file)</pre>
<pre class="programlisting">void <a href="#xmlNanoFTPFreeCtxt">xmlNanoFTPFreeCtxt</a> (void * ctx)</pre>
<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"><a href="libxml-nanoftp.html#SOCKET">SOCKET</a> <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"><a href="libxml-nanoftp.html#SOCKET">SOCKET</a> <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>
@@ -39,6 +39,8 @@
<pre class="programlisting">void <a href="#xmlNanoFTPScanProxy">xmlNanoFTPScanProxy</a> (const char * URL)</pre>
<pre class="programlisting">int <a href="#xmlNanoFTPUpdateURL">xmlNanoFTPUpdateURL</a> (void * ctx, <br /> const char * URL)</pre>
<h2>Description</h2>
+<h3><a name="INVALID_SOCKET" id="INVALID_SOCKET"></a>Macro: INVALID_SOCKET</h3><pre>#define INVALID_SOCKET</pre><p></p>
+<h3><a name="SOCKET" id="SOCKET"></a>Macro: SOCKET</h3><pre>#define SOCKET</pre><p></p>
<h3><a name="ftpDataCallback" id="ftpDataCallback"></a>Function type: ftpDataCallback</h3><pre class="programlisting">Function type: ftpDataCallback
void ftpDataCallback (void * userData, <br /> const char * data, <br /> int len)
</pre><p>A callback for the <a href="libxml-nanoftp.html#xmlNanoFTPGet">xmlNanoFTPGet</a> command.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>userData</tt></i>:</span></td><td>the user provided context</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>the data received</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>its size in bytes</td></tr></tbody></table></div><br />
@@ -65,11 +67,11 @@
</pre><p>Frees the context after closing the connection.</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></tbody></table></div><h3><a name="xmlNanoFTPGet" id="xmlNanoFTPGet"></a>Function: xmlNanoFTPGet</h3><pre class="programlisting">int xmlNanoFTPGet (void * ctx, <br /> <a href="libxml-nanoftp.html#ftpDataCallback">ftpDataCallback</a> callback, <br /> void * userData, <br /> const char * filename)<br />
</pre><p>Fetch the given file from the server. All data are passed back in the callbacks. The last callback has a size of 0 block.</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>callback</tt></i>:</span></td><td>the user callback</td></tr><tr><td><span class="term"><i><tt>userData</tt></i>:</span></td><td>the user callback data</td></tr><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the file to retrieve</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="xmlNanoFTPGetConnection" id="xmlNanoFTPGetConnection"></a>Function: xmlNanoFTPGetConnection</h3><pre class="programlisting">int xmlNanoFTPGetConnection (void * ctx)<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>callback</tt></i>:</span></td><td>the user callback</td></tr><tr><td><span class="term"><i><tt>userData</tt></i>:</span></td><td>the user callback data</td></tr><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the file to retrieve</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="xmlNanoFTPGetConnection" id="xmlNanoFTPGetConnection"></a>Function: xmlNanoFTPGetConnection</h3><pre class="programlisting"><a href="libxml-nanoftp.html#SOCKET">SOCKET</a> xmlNanoFTPGetConnection (void * ctx)<br />
</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"><a href="libxml-nanoftp.html#SOCKET">SOCKET</a> 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>
View
1  doc/html/libxml-xmlsave.html
@@ -35,6 +35,7 @@
<a name="XML_SAVE_XHTML" id="XML_SAVE_XHTML">XML_SAVE_XHTML</a> = 16 : force XHTML1 specific rules
<a name="XML_SAVE_AS_XML" id="XML_SAVE_AS_XML">XML_SAVE_AS_XML</a> = 32 : force XML serialization on HTML doc
<a name="XML_SAVE_AS_HTML" id="XML_SAVE_AS_HTML">XML_SAVE_AS_HTML</a> = 64 : force HTML serialization on XML doc
+ <a name="XML_SAVE_WSNONSIG" id="XML_SAVE_WSNONSIG">XML_SAVE_WSNONSIG</a> = 128 : format with non-significant whitespace
}
</pre><h3><a name="xmlSaveClose" id="xmlSaveClose"></a>Function: xmlSaveClose</h3><pre class="programlisting">int xmlSaveClose (<a href="libxml-xmlsave.html#xmlSaveCtxtPtr">xmlSaveCtxtPtr</a> ctxt)<br />
</pre><p>Close a document saving context, i.e. make sure that all bytes have been output and free the associated data.</p>
View
14 doc/libxml2-api.xml
@@ -617,6 +617,8 @@
<summary>minimal FTP implementation</summary>
<description>minimal FTP implementation allowing to fetch resources like external subset. </description>
<author>Daniel Veillard </author>
+ <exports symbol='INVALID_SOCKET' type='macro'/>
+ <exports symbol='SOCKET' type='macro'/>
<exports symbol='xmlNanoFTPQuit' type='function'/>
<exports symbol='xmlNanoFTPClose' type='function'/>
<exports symbol='ftpListCallback' type='function'/>
@@ -3004,6 +3006,7 @@
<exports symbol='XML_SAVE_NO_DECL' type='enum'/>
<exports symbol='XML_SAVE_AS_HTML' type='enum'/>
<exports symbol='XML_SAVE_FORMAT' type='enum'/>
+ <exports symbol='XML_SAVE_WSNONSIG' type='enum'/>
<exports symbol='xmlSaveOption' type='typedef'/>
<exports symbol='xmlSaveCtxt' type='typedef'/>
<exports symbol='xmlSaveCtxtPtr' type='typedef'/>
@@ -3836,6 +3839,8 @@
<macro name='INPUT_CHUNK' file='parserInternals'>
<info>The parser tries to always have that amount of input ready. One of the point is providing context when reporting errors.</info>
</macro>
+ <macro name='INVALID_SOCKET' file='nanoftp'>
+ </macro>
<macro name='IS_ASCII_DIGIT' file='parserInternals'>
<info>Macro to check [0-9]</info>
<arg name='c' info='an xmlChar value'/>
@@ -4043,6 +4048,8 @@
<info>Skips the end of line chars.</info>
<arg name='p' info='and UTF8 string pointer'/>
</macro>
+ <macro name='SOCKET' file='nanoftp'>
+ </macro>
<macro name='WITHOUT_TRIO' file='xmlversion'>
<info>defined if the trio support should not be configured in</info>
</macro>
@@ -5270,7 +5277,7 @@ crash if you try to modify the tree)'/>
<enum name='XML_RNGP_VALUE_NO_CONTENT' file='xmlerror' value='1120' type='xmlParserErrors' info='1120'/>
<enum name='XML_RNGP_XMLNS_NAME' file='xmlerror' value='1121' type='xmlParserErrors' info='1121'/>
<enum name='XML_RNGP_XML_NS' file='xmlerror' value='1122' type='xmlParserErrors' info='1122'/>
- <enum name='XML_SAVE_AS_HTML' file='xmlsave' value='64' type='xmlSaveOption' info=' force HTML serialization on XML doc'/>
+ <enum name='XML_SAVE_AS_HTML' file='xmlsave' value='64' type='xmlSaveOption' info='force HTML serialization on XML doc'/>
<enum name='XML_SAVE_AS_XML' file='xmlsave' value='32' type='xmlSaveOption' info='force XML serialization on HTML doc'/>
<enum name='XML_SAVE_CHAR_INVALID' file='xmlerror' value='1401' type='xmlParserErrors' info='1401'/>
<enum name='XML_SAVE_FORMAT' file='xmlsave' value='1' type='xmlSaveOption' info='format save output'/>
@@ -5280,6 +5287,7 @@ crash if you try to modify the tree)'/>
<enum name='XML_SAVE_NO_EMPTY' file='xmlsave' value='4' type='xmlSaveOption' info='no empty tags'/>
<enum name='XML_SAVE_NO_XHTML' file='xmlsave' value='8' type='xmlSaveOption' info='disable XHTML1 specific rules'/>
<enum name='XML_SAVE_UNKNOWN_ENCODING' file='xmlerror' value='1403' type='xmlParserErrors' info='1403'/>
+ <enum name='XML_SAVE_WSNONSIG' file='xmlsave' value='128' type='xmlSaveOption' info=' format with non-significant whitespace'/>
<enum name='XML_SAVE_XHTML' file='xmlsave' value='16' type='xmlSaveOption' info='force XHTML1 specific rules'/>
<enum name='XML_SCHEMAP_AG_PROPS_CORRECT' file='xmlerror' value='3087' type='xmlParserErrors' info='3086'/>
<enum name='XML_SCHEMAP_ATTRFORMDEFAULT_VALUE' file='xmlerror' value='1701' type='xmlParserErrors' info='1701'/>
@@ -11042,7 +11050,7 @@ Could we use @subtypes for this?'/>
<function name='xmlNanoFTPGetConnection' file='nanoftp' module='nanoftp'>
<cond>defined(LIBXML_FTP_ENABLED)</cond>
<info>Try to open a data connection to the server. Currently only passive mode is supported.</info>
- <return type='int' info='-1 incase of error, 0 otherwise'/>
+ <return type='SOCKET' info='-1 incase of error, 0 otherwise'/>
<arg name='ctx' type='void *' info='an FTP context'/>
</function>
<function name='xmlNanoFTPGetResponse' file='nanoftp' module='nanoftp'>
@@ -11054,7 +11062,7 @@ Could we use @subtypes for this?'/>
<function name='xmlNanoFTPGetSocket' file='nanoftp' module='nanoftp'>
<cond>defined(LIBXML_FTP_ENABLED)</cond>
<info>Initiate fetch of the given file from the server.</info>
- <return type='int' info='the socket for the data connection, or &lt;0 in case of error'/>
+ <return type='SOCKET' info='the socket for the data connection, or &lt;0 in case of error'/>
<arg name='ctx' type='void *' info='an FTP context'/>
<arg name='filename' type='const char *' info='the file to retrieve (or NULL if path is in context).'/>
</function>
View
13 doc/libxml2-refs.xml
@@ -34,6 +34,7 @@
<reference name='HTML_TEXT_NODE' href='html/libxml-HTMLtree.html#HTML_TEXT_NODE'/>
<reference name='HTML_VALID' href='html/libxml-HTMLparser.html#HTML_VALID'/>
<reference name='INPUT_CHUNK' href='html/libxml-parserInternals.html#INPUT_CHUNK'/>
+ <reference name='INVALID_SOCKET' href='html/libxml-nanoftp.html#INVALID_SOCKET'/>
<reference name='IS_ASCII_DIGIT' href='html/libxml-parserInternals.html#IS_ASCII_DIGIT'/>
<reference name='IS_ASCII_LETTER' href='html/libxml-parserInternals.html#IS_ASCII_LETTER'/>
<reference name='IS_BASECHAR' href='html/libxml-parserInternals.html#IS_BASECHAR'/>
@@ -96,6 +97,7 @@
<reference name='MOVETO_ENDTAG' href='html/libxml-parserInternals.html#MOVETO_ENDTAG'/>
<reference name='MOVETO_STARTTAG' href='html/libxml-parserInternals.html#MOVETO_STARTTAG'/>
<reference name='SKIP_EOL' href='html/libxml-parserInternals.html#SKIP_EOL'/>
+ <reference name='SOCKET' href='html/libxml-nanoftp.html#SOCKET'/>
<reference name='UTF8ToHtml' href='html/libxml-HTMLparser.html#UTF8ToHtml'/>
<reference name='UTF8Toisolat1' href='html/libxml-encoding.html#UTF8Toisolat1'/>
<reference name='WITHOUT_TRIO' href='html/libxml-xmlversion.html#WITHOUT_TRIO'/>
@@ -801,6 +803,7 @@
<reference name='XML_SAVE_NO_EMPTY' href='html/libxml-xmlsave.html#XML_SAVE_NO_EMPTY'/>
<reference name='XML_SAVE_NO_XHTML' href='html/libxml-xmlsave.html#XML_SAVE_NO_XHTML'/>
<reference name='XML_SAVE_UNKNOWN_ENCODING' href='html/libxml-xmlerror.html#XML_SAVE_UNKNOWN_ENCODING'/>
+ <reference name='XML_SAVE_WSNONSIG' href='html/libxml-xmlsave.html#XML_SAVE_WSNONSIG'/>
<reference name='XML_SAVE_XHTML' href='html/libxml-xmlsave.html#XML_SAVE_XHTML'/>
<reference name='XML_SAX2_MAGIC' href='html/libxml-parser.html#XML_SAX2_MAGIC'/>
<reference name='XML_SCHEMAP_AG_PROPS_CORRECT' href='html/libxml-xmlerror.html#XML_SCHEMAP_AG_PROPS_CORRECT'/>
@@ -3579,6 +3582,7 @@
</letter>
<letter name='I'>
<ref name='INPUT_CHUNK'/>
+ <ref name='INVALID_SOCKET'/>
<ref name='IS_ASCII_DIGIT'/>
<ref name='IS_ASCII_LETTER'/>
<ref name='IS_BASECHAR'/>
@@ -3647,6 +3651,7 @@
</letter>
<letter name='S'>
<ref name='SKIP_EOL'/>
+ <ref name='SOCKET'/>
</letter>
<letter name='U'>
<ref name='UTF8ToHtml'/>
@@ -4358,6 +4363,7 @@
<ref name='XML_SAVE_NO_EMPTY'/>
<ref name='XML_SAVE_NO_XHTML'/>
<ref name='XML_SAVE_UNKNOWN_ENCODING'/>
+ <ref name='XML_SAVE_WSNONSIG'/>
<ref name='XML_SAVE_XHTML'/>
<ref name='XML_SAX2_MAGIC'/>
<ref name='XML_SCHEMAP_AG_PROPS_CORRECT'/>
@@ -7129,6 +7135,10 @@
</letter>
</alpha>
<constructors>
+ <type name='SOCKET'>
+ <ref name='xmlNanoFTPGetConnection'/>
+ <ref name='xmlNanoFTPGetSocket'/>
+ </type>
<type name='const htmlElemDesc *'>
<ref name='htmlTagLookup'/>
</type>
@@ -11166,6 +11176,8 @@
<ref name='xmlListWalker'/>
</file>
<file name='nanoftp'>
+ <ref name='INVALID_SOCKET'/>
+ <ref name='SOCKET'/>
<ref name='ftpDataCallback'/>
<ref name='ftpListCallback'/>
<ref name='xmlNanoFTPCheckResponse'/>
@@ -13486,6 +13498,7 @@
<ref name='XML_SAVE_NO_DECL'/>
<ref name='XML_SAVE_NO_EMPTY'/>
<ref name='XML_SAVE_NO_XHTML'/>
+ <ref name='XML_SAVE_WSNONSIG'/>
<ref name='XML_SAVE_XHTML'/>
<ref name='xmlSaveClose'/>
<ref name='xmlSaveCtxt'/>
View
56 include/libxml/nanoftp.h
@@ -7,7 +7,7 @@
*
* Author: Daniel Veillard
*/
-
+
#ifndef __NANO_FTP_H__
#define __NANO_FTP_H__
@@ -15,12 +15,20 @@
#ifdef LIBXML_FTP_ENABLED
+/* Needed for portability to Windows 64 bits */
+#if defined(__MINGW32__) || defined(_WIN32_WCE)
+#include <winsock2.h>
+#else
+#define SOCKET int
+#define INVALID_SOCKET (-1)
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
/**
- * ftpListCallback:
+ * ftpListCallback:
* @userData: user provided data for the callback
* @filename: the file name (including "->" when links are shown)
* @attrib: the attribute string
@@ -44,7 +52,7 @@ typedef void (*ftpListCallback) (void *userData,
const char *month, int day, int hour,
int minute);
/**
- * ftpDataCallback:
+ * ftpDataCallback:
* @userData: the user provided context
* @data: the data received
* @len: its size in bytes
@@ -60,78 +68,78 @@ typedef void (*ftpDataCallback) (void *userData,
*/
XMLPUBFUN void XMLCALL
xmlNanoFTPInit (void);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void XMLCALL
xmlNanoFTPCleanup (void);
/*
* Creating/freeing contexts.
*/
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void * XMLCALL
xmlNanoFTPNewCtxt (const char *URL);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void XMLCALL
xmlNanoFTPFreeCtxt (void * ctx);
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void * XMLCALL
xmlNanoFTPConnectTo (const char *server,
int port);
/*
* Opening/closing session connections.
*/
-XMLPUBFUN void * XMLCALL
+XMLPUBFUN void * XMLCALL
xmlNanoFTPOpen (const char *URL);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPConnect (void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPClose (void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPQuit (void *ctx);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void XMLCALL
xmlNanoFTPScanProxy (const char *URL);
-XMLPUBFUN void XMLCALL
+XMLPUBFUN void XMLCALL
xmlNanoFTPProxy (const char *host,
int port,
const char *user,
const char *passwd,
int type);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPUpdateURL (void *ctx,
const char *URL);
/*
* Rather internal commands.
*/
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPGetResponse (void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPCheckResponse (void *ctx);
/*
* CD/DIR/GET handlers.
*/
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPCwd (void *ctx,
const char *directory);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPDele (void *ctx,
const char *file);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN SOCKET XMLCALL
xmlNanoFTPGetConnection (void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPCloseConnection(void *ctx);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPList (void *ctx,
ftpListCallback callback,
void *userData,
const char *filename);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN SOCKET XMLCALL
xmlNanoFTPGetSocket (void *ctx,
const char *filename);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPGet (void *ctx,
ftpDataCallback callback,
void *userData,
const char *filename);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlNanoFTPRead (void *ctx,
void *dest,
int len);
View
215 nanoftp.c
@@ -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 *directory) {
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 *file) {
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 *file) {
* 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, ftpListCallback callback, void *userData,
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, ftpListCallback callback, void *userData,
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, ftpListCallback callback, void *userData,
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, ftpListCallback callback, void *userData,
#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, ftpListCallback callback, void *userData,
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, ftpListCallback callback, void *userData,
*/
-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 char *filename) {
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 char *filename) {
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 callback, void *userData,
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 callback, void *userData,
#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 callback, void *userData,
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, int len) {
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, int len) {
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);
View
67 nanohttp.c
@@ -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 ctxt) {
#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 ctxt, const char *line) {
* 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 sockaddr *addr)
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 sockaddr *addr)
#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 sockaddr *addr)
__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 sockaddr *addr)
#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 sockaddr *addr)
/* 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 sockaddr *addr)
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 sockaddr *addr)
"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 sockaddr *addr)
* 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, int port)
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, int port)
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, int port)
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, int port)
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, int port)
continue; /* for */
s = xmlNanoHTTPConnectAttempt (addr);
- if (s != -1) {
+ if (s != INVALID_SOCKET) {
freeaddrinfo (result);
return (s);
}
@@ -1155,7 +1153,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
#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, int port)
/* 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, int port)
/* 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, int port)
break; /* for */
s = xmlNanoHTTPConnectAttempt (addr);
- if (s != -1)
+ if (s != INVALID_SOCKET)
return (s);
}
}
@@ -1198,7 +1196,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
"xmlNanoHTTPConnectHost: unable to connect to '%s'.\n",
host);
#endif
- return (-1);
+ return INVALID_SOCKET;
}
@@ -1342,7 +1340,8 @@ xmlNanoHTTPMethodRedir(const char *URL, const char *method, const char *input,
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 @@ xmlNanoHTTPMethodRedir(const char *URL, const char *method, const char *input,
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);
View
61 testapi.c
@@ -11639,32 +11639,8 @@ static int
test_xmlNanoFTPGetConnection(void) {
int test_ret = 0;
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- int ret_val;
- void * ctx; /* an FTP context */
- int n_ctx;
-
- for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
- mem_base = xmlMemBlocks();
- ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
-
- ret_val = xmlNanoFTPGetConnection(ctx);
- desret_int(ret_val);
- call_tests++;
- des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctx);
- printf("\n");
- }
- }
- function_tests++;
-#endif
+ /* missing type support */
return(test_ret);
}
@@ -11707,39 +11683,8 @@ static int
test_xmlNanoFTPGetSocket(void) {
int test_ret = 0;
-#if defined(LIBXML_FTP_ENABLED)
- int mem_base;
- int ret_val;
- void * ctx; /* an FTP context */
- int n_ctx;
- const char * filename; /* the file to retrieve (or NULL if path is in context). */
- int n_filename;
-
- for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
- for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
- mem_base = xmlMemBlocks();
- ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
- filename = gen_filepath(n_filename, 1);
-
- ret_val = xmlNanoFTPGetSocket(ctx, filename);
- desret_int(ret_val);
- call_tests++;
- des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
- des_filepath(n_filename, filename, 1);
- xmlResetLastError();
- if (mem_base != xmlMemBlocks()) {
- printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
- xmlMemBlocks() - mem_base);
- test_ret++;
- printf(" %d", n_ctx);
- printf(" %d", n_filename);
- printf("\n");
- }
- }
- }
- function_tests++;
-#endif
+ /* missing type support */
return(test_ret);
}
@@ -12043,7 +11988,7 @@ static int
test_nanoftp(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing nanoftp : 16 of 22 functions ...\n");
+ if (quiet == 0) printf("Testing nanoftp : 14 of 22 functions ...\n");
test_ret += test_xmlNanoFTPCheckResponse();
test_ret += test_xmlNanoFTPCleanup();
test_ret += test_xmlNanoFTPCloseConnection();
Please sign in to comment.
Something went wrong with that request. Please try again.