]> git.saurik.com Git - wxWidgets.git/commitdiff
test for bug with new wu-ftpd
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 3 Jan 2001 17:16:43 +0000 (17:16 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 3 Jan 2001 17:16:43 +0000 (17:16 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/console/console.cpp

index bf00e4a65c09e50e91efa828e2ff9021f1af995d..d7088dec55f5f91f6e6a00e6bdfac0592bbd889c 100644 (file)
@@ -44,8 +44,8 @@
 //#define TEST_EXECUTE
 //#define TEST_FILE
 //#define TEST_FILECONF
-#define TEST_FILENAME
-//#define TEST_FTP
+//#define TEST_FILENAME
+#define TEST_FTP
 //#define TEST_HASH
 //#define TEST_LIST
 //#define TEST_LOG
@@ -1481,9 +1481,46 @@ static void TestProtocolFtp()
     puts("*** Testing wxFTP download ***\n");
 
     wxFTP ftp;
+
+#ifdef TEST_WUFTPD // test (fixed?) wxFTP bug with wu-ftpd >= 2.6.0?
+    static const char *hostname = "ftp.eudora.com";
+    if ( !ftp.Connect(hostname) )
+    {
+        printf("ERROR: failed to connect to %s\n", hostname);
+    }
+    else
+    {
+        static const char *filename = "eudora/pubs/draft-gellens-submit-09.txt";
+        wxInputStream *in = ftp.GetInputStream(filename);
+        if ( !in )
+        {
+            printf("ERROR: couldn't get input stream for %s\n", filename);
+        }
+        else
+        {
+            size_t size = in->StreamSize();
+            printf("Reading file %s (%u bytes)...", filename, size);
+
+            char *data = new char[size];
+            if ( !in->Read(data, size) )
+            {
+                puts("ERROR: read error");
+            }
+            else
+            {
+                printf("Successfully retrieved the file.\n");
+            }
+
+            delete [] data;
+            delete in;
+        }
+    }
+#else // !TEST_WUFTPD
+
 #if 1
     static const char *hostname = "ftp.wxwindows.org";
     static const char *directory = "pub";
+    static const char *filename = "welcome.msg";
 
     printf("--- Attempting to connect to %s:21 anonymously...\n", hostname);
 #else
@@ -1550,7 +1587,6 @@ static void TestProtocolFtp()
         }
 
         // test RETR
-        static const char *filename = "welcome.msg";
         wxInputStream *in = ftp.GetInputStream(filename);
         if ( !in )
         {
@@ -1595,6 +1631,7 @@ static void TestProtocolFtp()
                    ftp.GetLastResult().c_str());
         }
     }
+#endif // TEST_WUFTPD/!TEST_WUFTPD
 }
 
 static void TestProtocolFtpUpload()