cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl not sending QUIT to terminate control connection

From: Joe Halpin <j.p.h_at_comcast.net>
Date: Mon, 19 Jan 2004 20:56:32 -0600

codemastr wrote:
> Usually it's best to submit an actual patch (diff -c for example) rather
> than giving a description of your changes as that way people know exactly
> how to apply your changes rather than saying "Do A and then do B."
>
>>Now when I run make test all the ftp test cases fail, although the test
>>data looks ok (QUIT is being sent, and a response is being received).
>>I've been looking at the perl script, but I don't see the problem. Any
>>ideas what I'm missing?
>
> As Daniel wrote in his first response to you, "Also note that since this
> changes the commands-response flow, just about all
> FTP test cases need to get adjusted as well!"

Ok, sorry to be so dense, I know everyone else here is busy too. I'm
just not used to this development environment yet.

Anyway, I think I figured out most of the test stuff, and I'm attaching
a patch for what I did. However, tests 304 and 505 keep failing and I
don't see why. test304 is http so shouldn't be affected by a change to
ftp.c. test505 output looks like it's correct to me.

Thanks

Joe

Only in curl: .cvsignore
Only in curl.work: Makefile
Only in curl.work: Makefile.in
Only in curl.work: aclocal.m4
Only in curl.work/ares: autom4te.cache
Only in curl.work/ares: configure
Only in curl.work: autom4te.cache
Only in curl.work: config.guess
Only in curl.work: config.log
Only in curl.work: config.status
Only in curl.work: config.sub
Only in curl.work: configure
Only in curl.work: curl-config
Only in curl.work: depcomp
Only in curl.work/docs: Makefile
Only in curl.work/docs: Makefile.in
Only in curl.work/docs/examples: Makefile
Only in curl.work/docs/examples: Makefile.in
Only in curl.work/docs/libcurl: Makefile
Only in curl.work/docs/libcurl: Makefile.in
Only in curl.work/include: Makefile
Only in curl.work/include: Makefile.in
Only in curl.work/include/curl: Makefile
Only in curl.work/include/curl: Makefile.in
Only in curl.work/lib: .deps
Only in curl.work/lib: Makefile
Only in curl.work/lib: Makefile.in
Only in curl.work/lib: ca-bundle.h
Only in curl.work/lib: config.h
Only in curl.work/lib: config.h.in
diff -ur curl/lib/ftp.c curl.work/lib/ftp.c
--- curl/lib/ftp.c 2004-01-07 03:19:35.000000000 -0600
+++ curl.work/lib/ftp.c 2004-01-19 20:38:12.000000000 -0600
@@ -2411,6 +2411,30 @@
 
 /***********************************************************************
  *
+ * Curl_ftp_quit()
+ *
+ * This should be called before calling sclose() on an ftp control connection
+ * (not data connections). We should then wait for the response from the
+ * server before returning. The calling code should then try to close the
+ * connection.
+ *
+ */
+CURLcode Curl_ftp_quit(struct connectdata *conn)
+{
+ int nread;
+ int ftpcode;
+ CURLcode ret;
+
+ ret = Curl_ftpsendf(conn, "%s", "QUIT");
+ if(CURLE_OK == ret)
+ ret = Curl_GetFTPResponse(&nread, conn, &ftpcode);
+
+ return ret;
+}
+
+
+/***********************************************************************
+ *
  * Curl_ftp_disconnect()
  *
  * Disconnect from an FTP server. Cleanup protocol-specific per-connection
@@ -2420,6 +2444,8 @@
 {
   struct FTP *ftp= conn->proto.ftp;
 
+ (void) Curl_ftp_quit(conn);
+
   /* The FTP session may or may not have been allocated/setup at this point! */
   if(ftp) {
     if(ftp->entrypath)
diff -ur curl/lib/ftp.h curl.work/lib/ftp.h
--- curl/lib/ftp.h 2004-01-07 03:19:35.000000000 -0600
+++ curl.work/lib/ftp.h 2004-01-19 20:38:17.000000000 -0600
@@ -32,6 +32,7 @@
 CURLcode Curl_GetFTPResponse(ssize_t *nread, struct connectdata *conn,
                              int *ftpcode);
 CURLcode Curl_ftp_nextconnect(struct connectdata *conn);
+CURLcode Curl_ftp_quit(struct connectdata *conn);
 #endif
 
 #endif
Only in curl.work/lib: getdate.c
Only in curl.work/lib: stamp-h1
Only in curl.work: libtool
Only in curl.work: ltmain.sh
Only in curl.work/packages/DOS: Makefile
Only in curl.work/packages/DOS: Makefile.in
Only in curl.work/packages/EPM: Makefile
Only in curl.work/packages/EPM: Makefile.in
Only in curl.work/packages/EPM: curl.list
Only in curl.work/packages/Linux: Makefile
Only in curl.work/packages/Linux: Makefile.in
Only in curl.work/packages/Linux/RPM: Makefile
Only in curl.work/packages/Linux/RPM: Makefile.in
Only in curl.work/packages/Linux/RPM: curl-ssl.spec
Only in curl.work/packages/Linux/RPM: curl.spec
Only in curl.work/packages: Makefile
Only in curl.work/packages: Makefile.in
Only in curl.work/packages/Solaris: Makefile
Only in curl.work/packages/Solaris: Makefile.in
Only in curl.work/packages/Win32: Makefile
Only in curl.work/packages/Win32: Makefile.in
Only in curl.work/packages/Win32/cygwin: Makefile
Only in curl.work/packages/Win32/cygwin: Makefile.in
Only in curl.work/src: .deps
Only in curl.work/src: Makefile
Only in curl.work/src: Makefile.in
Only in curl.work/src: config.h
Only in curl.work/src: stamp-h2
Only in curl.work/tests: .ftp.pid
Only in curl.work/tests: .http.pid
Only in curl.work/tests: .https.pid
Only in curl.work/tests: Makefile
Only in curl.work/tests: Makefile.in
Only in curl.work/tests/data: Makefile
Only in curl.work/tests/data: Makefile.in
diff -ur curl/tests/data/test100 curl.work/tests/data/test100
--- curl/tests/data/test100 2003-04-30 15:25:39.000000000 -0500
+++ curl.work/tests/data/test100 2004-01-19 20:42:18.000000000 -0600
@@ -43,5 +43,6 @@
 EPSV
 TYPE A
 LIST
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test101 curl.work/tests/data/test101
--- curl/tests/data/test101 2003-04-30 15:25:39.000000000 -0500
+++ curl.work/tests/data/test101 2004-01-19 20:42:18.000000000 -0600
@@ -43,5 +43,6 @@
 PORT 127,0,0,1,243,212
 TYPE A
 LIST
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test102 curl.work/tests/data/test102
--- curl/tests/data/test102 2003-04-30 15:25:40.000000000 -0500
+++ curl.work/tests/data/test102 2004-01-19 20:42:18.000000000 -0600
@@ -38,5 +38,6 @@
 TYPE I
 SIZE 102
 RETR 102
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test103 curl.work/tests/data/test103
--- curl/tests/data/test103 2003-04-30 15:25:40.000000000 -0500
+++ curl.work/tests/data/test103 2004-01-19 20:42:18.000000000 -0600
@@ -40,5 +40,6 @@
 TYPE I
 SIZE 103
 RETR 103
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test104 curl.work/tests/data/test104
--- curl/tests/data/test104 2003-07-30 02:52:02.000000000 -0500
+++ curl.work/tests/data/test104 2004-01-19 20:42:18.000000000 -0600
@@ -30,5 +30,6 @@
 TYPE I
 SIZE 103
 REST 0
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test105 curl.work/tests/data/test105
--- curl/tests/data/test105 2003-04-30 15:25:40.000000000 -0500
+++ curl.work/tests/data/test105 2004-01-19 20:42:18.000000000 -0600
@@ -38,5 +38,6 @@
 TYPE A
 SIZE 103
 RETR 103
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test106 curl.work/tests/data/test106
--- curl/tests/data/test106 2003-07-28 04:02:15.000000000 -0500
+++ curl.work/tests/data/test106 2004-01-19 20:42:18.000000000 -0600
@@ -35,5 +35,6 @@
 TYPE A
 SIZE 106
 RETR 106
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test107 curl.work/tests/data/test107
--- curl/tests/data/test107 2003-04-30 15:25:40.000000000 -0500
+++ curl.work/tests/data/test107 2004-01-19 20:42:18.000000000 -0600
@@ -37,5 +37,6 @@
 EPSV
 TYPE I
 STOR 107
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test108 curl.work/tests/data/test108
--- curl/tests/data/test108 2003-04-30 15:25:40.000000000 -0500
+++ curl.work/tests/data/test108 2004-01-19 20:42:18.000000000 -0600
@@ -38,6 +38,7 @@
 PORT 127,0,0,1,5,109
 TYPE I
 STOR 108
+QUIT
 </protocol>
 <upload>
 Moooooooooooo
diff -ur curl/tests/data/test109 curl.work/tests/data/test109
--- curl/tests/data/test109 2003-04-30 15:25:40.000000000 -0500
+++ curl.work/tests/data/test109 2004-01-19 20:42:18.000000000 -0600
@@ -32,6 +32,7 @@
 EPSV
 TYPE I
 APPE 109
+QUIT
 </protocol>
 <upload>
 Moooooooooooo
diff -ur curl/tests/data/test110 curl.work/tests/data/test110
--- curl/tests/data/test110 2003-04-30 15:25:41.000000000 -0500
+++ curl.work/tests/data/test110 2004-01-19 20:42:18.000000000 -0600
@@ -39,5 +39,6 @@
 SIZE 110
 REST 20
 RETR 110
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test111 curl.work/tests/data/test111
--- curl/tests/data/test111 2003-04-30 15:25:41.000000000 -0500
+++ curl.work/tests/data/test111 2004-01-19 20:42:18.000000000 -0600
@@ -32,5 +32,6 @@
 EPSV
 TYPE I
 SIZE 111
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test112 curl.work/tests/data/test112
--- curl/tests/data/test112 2003-04-30 15:25:41.000000000 -0500
+++ curl.work/tests/data/test112 2004-01-19 20:42:18.000000000 -0600
@@ -31,6 +31,7 @@
 EPSV
 TYPE I
 APPE 112
+QUIT
 </protocol>
 <upload>
  gonna upload
diff -ur curl/tests/data/test113 curl.work/tests/data/test113
--- curl/tests/data/test113 2003-04-30 15:25:41.000000000 -0500
+++ curl.work/tests/data/test113 2004-01-19 20:42:18.000000000 -0600
@@ -25,5 +25,6 @@
 </errorcode>
 <protocol>
 USER anonymous
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test114 curl.work/tests/data/test114
--- curl/tests/data/test114 2003-04-30 15:25:41.000000000 -0500
+++ curl.work/tests/data/test114 2004-01-19 20:42:18.000000000 -0600
@@ -26,5 +26,6 @@
 <protocol>
 USER anonymous
 PASS curl_by_daniel_at_haxx.se
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test115 curl.work/tests/data/test115
--- curl/tests/data/test115 2003-04-30 15:25:41.000000000 -0500
+++ curl.work/tests/data/test115 2004-01-19 20:42:18.000000000 -0600
@@ -30,5 +30,6 @@
 PWD
 EPSV
 PASV
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test116 curl.work/tests/data/test116
--- curl/tests/data/test116 2003-04-30 15:25:41.000000000 -0500
+++ curl.work/tests/data/test116 2004-01-19 20:42:18.000000000 -0600
@@ -32,5 +32,6 @@
 USER anonymous
 PASS curl_by_daniel_at_haxx.se
 PWD
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test117 curl.work/tests/data/test117
--- curl/tests/data/test117 2003-04-30 15:25:41.000000000 -0500
+++ curl.work/tests/data/test117 2004-01-19 20:42:18.000000000 -0600
@@ -31,5 +31,6 @@
 EPSV
 PASV
 TYPE I
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test118 curl.work/tests/data/test118
--- curl/tests/data/test118 2003-04-30 15:25:42.000000000 -0500
+++ curl.work/tests/data/test118 2004-01-19 20:42:18.000000000 -0600
@@ -33,5 +33,6 @@
 TYPE I
 SIZE 118
 RETR 118
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test119 curl.work/tests/data/test119
--- curl/tests/data/test119 2003-04-30 15:25:42.000000000 -0500
+++ curl.work/tests/data/test119 2004-01-19 20:42:18.000000000 -0600
@@ -35,5 +35,6 @@
 TYPE I
 SIZE 119
 RETR 119
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test120 curl.work/tests/data/test120
--- curl/tests/data/test120 2003-04-30 15:25:42.000000000 -0500
+++ curl.work/tests/data/test120 2004-01-19 20:42:18.000000000 -0600
@@ -38,5 +38,6 @@
 SIZE 120
 RETR 120
 DELE file
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test121 curl.work/tests/data/test121
--- curl/tests/data/test121 2003-04-30 15:25:42.000000000 -0500
+++ curl.work/tests/data/test121 2004-01-19 20:42:18.000000000 -0600
@@ -35,5 +35,6 @@
 SIZE 121
 RETR 121
 DELE after_transfer
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test122 curl.work/tests/data/test122
--- curl/tests/data/test122 2003-04-30 15:25:42.000000000 -0500
+++ curl.work/tests/data/test122 2004-01-19 20:42:18.000000000 -0600
@@ -31,5 +31,6 @@
 PASV
 TYPE I
 SIZE 122
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test123 curl.work/tests/data/test123
--- curl/tests/data/test123 2003-04-30 15:25:42.000000000 -0500
+++ curl.work/tests/data/test123 2004-01-19 20:42:18.000000000 -0600
@@ -26,5 +26,6 @@
 PWD
 EPSV
 TYPE I
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test124 curl.work/tests/data/test124
--- curl/tests/data/test124 2003-04-30 15:25:42.000000000 -0500
+++ curl.work/tests/data/test124 2004-01-19 20:42:18.000000000 -0600
@@ -33,5 +33,6 @@
 TYPE I
 SIZE 124
 RETR 124
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test125 curl.work/tests/data/test125
--- curl/tests/data/test125 2003-04-30 15:25:45.000000000 -0500
+++ curl.work/tests/data/test125 2004-01-19 20:42:18.000000000 -0600
@@ -28,5 +28,6 @@
 PASS curl_by_daniel_at_haxx.se
 PWD
 CWD path
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test126 curl.work/tests/data/test126
--- curl/tests/data/test126 2003-04-30 15:25:47.000000000 -0500
+++ curl.work/tests/data/test126 2004-01-19 20:42:18.000000000 -0600
@@ -33,5 +33,6 @@
 TYPE I
 SIZE 126
 RETR 126
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test127 curl.work/tests/data/test127
--- curl/tests/data/test127 2003-04-30 15:25:47.000000000 -0500
+++ curl.work/tests/data/test127 2004-01-19 20:42:18.000000000 -0600
@@ -31,5 +31,6 @@
 TYPE I
 SIZE 127
 RETR 127
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test128 curl.work/tests/data/test128
--- curl/tests/data/test128 2003-04-30 15:25:47.000000000 -0500
+++ curl.work/tests/data/test128 2004-01-19 20:42:18.000000000 -0600
@@ -33,6 +33,7 @@
 EPSV
 TYPE I
 STOR 128
+QUIT
 </protocol>
 <upload>
 file
diff -ur curl/tests/data/test135 curl.work/tests/data/test135
--- curl/tests/data/test135 2003-04-30 15:25:48.000000000 -0500
+++ curl.work/tests/data/test135 2004-01-19 20:42:18.000000000 -0600
@@ -38,5 +38,6 @@
 SIZE 135
 REST 4
 RETR 135
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test136 curl.work/tests/data/test136
--- curl/tests/data/test136 2003-04-30 15:25:48.000000000 -0500
+++ curl.work/tests/data/test136 2004-01-19 20:42:18.000000000 -0600
@@ -28,5 +28,6 @@
 TYPE I
 SIZE 136
 RETR 136
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test137 curl.work/tests/data/test137
--- curl/tests/data/test137 2003-04-30 15:25:48.000000000 -0500
+++ curl.work/tests/data/test137 2004-01-19 20:42:18.000000000 -0600
@@ -33,5 +33,6 @@
 TYPE I
 SIZE 137
 RETR 137
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test138 curl.work/tests/data/test138
--- curl/tests/data/test138 2003-04-30 15:25:48.000000000 -0500
+++ curl.work/tests/data/test138 2004-01-19 20:42:18.000000000 -0600
@@ -36,5 +36,6 @@
 TYPE I
 SIZE 138
 RETR 138
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test139 curl.work/tests/data/test139
--- curl/tests/data/test139 2003-04-30 15:25:48.000000000 -0500
+++ curl.work/tests/data/test139 2004-01-19 20:42:18.000000000 -0600
@@ -33,5 +33,6 @@
 TYPE I
 SIZE 139
 RETR 139
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test140 curl.work/tests/data/test140
--- curl/tests/data/test140 2003-04-30 15:25:48.000000000 -0500
+++ curl.work/tests/data/test140 2004-01-19 20:42:18.000000000 -0600
@@ -28,5 +28,6 @@
 PWD
 CWD blalbla
 MDTM 140
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test141 curl.work/tests/data/test141
--- curl/tests/data/test141 2003-10-31 15:37:03.000000000 -0600
+++ curl.work/tests/data/test141 2004-01-19 20:42:18.000000000 -0600
@@ -31,6 +31,7 @@
 TYPE I
 SIZE 141
 REST 0
+QUIT
 </protocol>
 <stdout>
 Last-Modified: Wed, 09 Apr 2003 10:26:59 GMT
diff -ur curl/tests/data/test142 curl.work/tests/data/test142
--- curl/tests/data/test142 2003-04-30 15:25:48.000000000 -0500
+++ curl.work/tests/data/test142 2004-01-19 20:42:18.000000000 -0600
@@ -26,5 +26,6 @@
 USER anonymous
 PASS curl_by_daniel_at_haxx.se
 PWD
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test143 curl.work/tests/data/test143
--- curl/tests/data/test143 2003-05-01 12:49:00.000000000 -0500
+++ curl.work/tests/data/test143 2004-01-19 20:42:18.000000000 -0600
@@ -30,5 +30,6 @@
 TYPE A
 SIZE 143
 RETR 143
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test144 curl.work/tests/data/test144
--- curl/tests/data/test144 2003-05-23 06:10:35.000000000 -0500
+++ curl.work/tests/data/test144 2004-01-19 20:42:18.000000000 -0600
@@ -35,5 +35,6 @@
 PORT 127,0,0,1,243,212
 TYPE A
 NLST
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test145 curl.work/tests/data/test145
--- curl/tests/data/test145 2003-05-23 06:10:35.000000000 -0500
+++ curl.work/tests/data/test145 2004-01-19 20:42:18.000000000 -0600
@@ -38,5 +38,6 @@
 PORT 127,0,0,1,243,212
 TYPE A
 NLST
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test146 curl.work/tests/data/test146
--- curl/tests/data/test146 2003-08-05 07:59:23.000000000 -0500
+++ curl.work/tests/data/test146 2004-01-19 20:42:18.000000000 -0600
@@ -42,5 +42,6 @@
 TYPE I
 SIZE 146
 RETR 146
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test147 curl.work/tests/data/test147
--- curl/tests/data/test147 2003-08-08 05:23:46.000000000 -0500
+++ curl.work/tests/data/test147 2004-01-19 20:42:18.000000000 -0600
@@ -44,5 +44,6 @@
 TYPE I
 SIZE 147
 RETR 147
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test148 curl.work/tests/data/test148
--- curl/tests/data/test148 2003-08-08 05:32:08.000000000 -0500
+++ curl.work/tests/data/test148 2004-01-19 20:42:18.000000000 -0600
@@ -37,5 +37,6 @@
 PWD
 CWD attempt
 MKD attempt
+QUIT
 </protocol>
 </verify>
diff -ur curl/tests/data/test149 curl.work/tests/data/test149
--- curl/tests/data/test149 2003-08-19 18:37:40.000000000 -0500
+++ curl.work/tests/data/test149 2004-01-19 20:42:18.000000000 -0600
@@ -39,6 +39,7 @@
 EPSV
 TYPE I
 STOR 148
+QUIT
 </protocol>
 <file name="log/upload148">
 send away this contents
Only in curl.work/tests/libtest: .deps
Only in curl.work/tests/libtest: .libs
Only in curl.work/tests/libtest: Makefile
Only in curl.work/tests/libtest: Makefile.in
Only in curl.work/tests/libtest: first.o
Only in curl.work/tests/libtest: lib500
Only in curl.work/tests/libtest: lib500.o
Only in curl.work/tests/libtest: lib501
Only in curl.work/tests/libtest: lib501.o
Only in curl.work/tests/libtest: lib502
Only in curl.work/tests/libtest: lib502.o
Only in curl.work/tests/libtest: lib503
Only in curl.work/tests/libtest: lib503.o
Only in curl.work/tests/libtest: lib504
Only in curl.work/tests/libtest: lib504.o
Only in curl.work/tests/libtest: lib505
Only in curl.work/tests/libtest: lib505.o
Only in curl.work/tests/libtest: lib506
Only in curl.work/tests/libtest: lib506.o
Only in curl.work/tests/libtest: lib507
Only in curl.work/tests/libtest: lib507.o
Only in curl.work/tests/libtest: lib508
Only in curl.work/tests/libtest: lib508.o
Only in curl.work/tests/libtest: lib509
Only in curl.work/tests/libtest: lib509.o
Only in curl.work/tests: log
Only in curl.work/tests/server: .deps
Only in curl.work/tests/server: .libs
Only in curl.work/tests/server: Makefile
Only in curl.work/tests/server: Makefile.in
Only in curl.work/tests/server: getpart.o
Only in curl.work/tests/server: sws
Only in curl.work/tests/server: sws.o

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Received on 2004-01-20