From dee98d2d9e5e658517f5f1b3a66c9a317957a567 Mon Sep 17 00:00:00 2001 From: Zoe Slattery Date: Fri, 5 Dec 2008 16:27:01 +0000 Subject: [PATCH] FTP test from Nathaniel McHugh --- ext/ftp/tests/ftp_mdtm_basic.phpt | 48 +++++++++++++++++++++++++++++++ ext/ftp/tests/server.inc | 21 +++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 ext/ftp/tests/ftp_mdtm_basic.phpt diff --git a/ext/ftp/tests/ftp_mdtm_basic.phpt b/ext/ftp/tests/ftp_mdtm_basic.phpt new file mode 100644 index 0000000000..39aeb766fb --- /dev/null +++ b/ext/ftp/tests/ftp_mdtm_basic.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test the File Modification Time as described in http://tools.ietf.org/html/rfc3659#section-3.1 +--CREDITS-- +Nathaniel McHugh +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +June 15 1998 10:00:45 000000 +June 15 1998 10:00:45 000000 +July 05 1998 13:23:16 000000 +int(-1) +October 05 1999 21:31:02 000000 +int(-1) diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc index c101c7c70f..bf11257af0 100644 --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@ -244,7 +244,26 @@ while($buf = fread($s, 4098)) { } elseif (preg_match('/^USER /', $buf)) { user_auth($buf); - } else { + } elseif (preg_match('/^MDTM ([\w\h]+)/', $buf, $matches)) { + switch ($matches [1]){ + case "A": + fputs($s, "213 19980615100045.014\r\n"); + break; + case "B": + fputs($s, "213 19980615100045.014\r\n"); + break; + case "C": + fputs($s, "213 19980705132316\r\n"); + break; + case "19990929043300 File6": + fputs($s, "213 19991005213102\r\n"); + break; + default : + fputs($s, "550 No file named \"{$matches [1]}\"\r\n"); + break; + } + } + else { fputs($s, "500 Syntax error, command unrecognized.\r\n"); dump_and_exit($buf); } -- 2.40.0