investtools-ftpd 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +5 -0
  3. data/.yardopts +7 -0
  4. data/Changelog.md +310 -0
  5. data/Gemfile +15 -0
  6. data/Gemfile.lock +93 -0
  7. data/LICENSE.md +9 -0
  8. data/README.md +371 -0
  9. data/Rakefile +14 -0
  10. data/VERSION +1 -0
  11. data/doc/benchmarks.md +82 -0
  12. data/doc/references.md +66 -0
  13. data/doc/rfc-compliance.md +292 -0
  14. data/examples/example.rb +275 -0
  15. data/examples/example_spec.rb +93 -0
  16. data/examples/hello_world.rb +32 -0
  17. data/features/example/eplf.feature +14 -0
  18. data/features/example/example.feature +18 -0
  19. data/features/example/read_only.feature +63 -0
  20. data/features/example/step_definitions/example_server.rb +11 -0
  21. data/features/ftp_server/abort.feature +13 -0
  22. data/features/ftp_server/allo.feature +33 -0
  23. data/features/ftp_server/append.feature +94 -0
  24. data/features/ftp_server/cdup.feature +36 -0
  25. data/features/ftp_server/command_errors.feature +13 -0
  26. data/features/ftp_server/concurrent_sessions.feature +14 -0
  27. data/features/ftp_server/delay_after_failed_login.feature +23 -0
  28. data/features/ftp_server/delete.feature +60 -0
  29. data/features/ftp_server/directory_navigation.feature +59 -0
  30. data/features/ftp_server/disconnect_after_failed_logins.feature +25 -0
  31. data/features/ftp_server/eprt.feature +55 -0
  32. data/features/ftp_server/epsv.feature +36 -0
  33. data/features/ftp_server/features.feature +38 -0
  34. data/features/ftp_server/file_structure.feature +43 -0
  35. data/features/ftp_server/get.feature +80 -0
  36. data/features/ftp_server/get_ipv6.feature +43 -0
  37. data/features/ftp_server/get_tls.feature +23 -0
  38. data/features/ftp_server/help.feature +21 -0
  39. data/features/ftp_server/implicit_tls.feature +23 -0
  40. data/features/ftp_server/invertability.feature +15 -0
  41. data/features/ftp_server/list.feature +94 -0
  42. data/features/ftp_server/list_tls.feature +29 -0
  43. data/features/ftp_server/logging.feature +11 -0
  44. data/features/ftp_server/login_auth_level_account.feature +51 -0
  45. data/features/ftp_server/login_auth_level_password.feature +59 -0
  46. data/features/ftp_server/login_auth_level_user.feature +31 -0
  47. data/features/ftp_server/max_connections.feature +39 -0
  48. data/features/ftp_server/mdtm.feature +53 -0
  49. data/features/ftp_server/mkdir.feature +70 -0
  50. data/features/ftp_server/mode.feature +43 -0
  51. data/features/ftp_server/name_list.feature +77 -0
  52. data/features/ftp_server/name_list_tls.feature +30 -0
  53. data/features/ftp_server/noop.feature +17 -0
  54. data/features/ftp_server/options.feature +17 -0
  55. data/features/ftp_server/pasv.feature +23 -0
  56. data/features/ftp_server/port.feature +49 -0
  57. data/features/ftp_server/put.feature +79 -0
  58. data/features/ftp_server/put_tls.feature +23 -0
  59. data/features/ftp_server/put_unique.feature +56 -0
  60. data/features/ftp_server/quit.feature +23 -0
  61. data/features/ftp_server/reinitialize.feature +13 -0
  62. data/features/ftp_server/rename.feature +97 -0
  63. data/features/ftp_server/rmdir.feature +71 -0
  64. data/features/ftp_server/site.feature +13 -0
  65. data/features/ftp_server/size.feature +69 -0
  66. data/features/ftp_server/status.feature +18 -0
  67. data/features/ftp_server/step_definitions/logging.rb +8 -0
  68. data/features/ftp_server/step_definitions/test_server.rb +65 -0
  69. data/features/ftp_server/structure_mount.feature +13 -0
  70. data/features/ftp_server/syntax_errors.feature +18 -0
  71. data/features/ftp_server/syst.feature +18 -0
  72. data/features/ftp_server/timeout.feature +26 -0
  73. data/features/ftp_server/type.feature +59 -0
  74. data/features/step_definitions/append.rb +15 -0
  75. data/features/step_definitions/client.rb +24 -0
  76. data/features/step_definitions/client_and_server_files.rb +24 -0
  77. data/features/step_definitions/client_files.rb +14 -0
  78. data/features/step_definitions/command.rb +5 -0
  79. data/features/step_definitions/connect.rb +37 -0
  80. data/features/step_definitions/delete.rb +15 -0
  81. data/features/step_definitions/directory_navigation.rb +26 -0
  82. data/features/step_definitions/error_replies.rb +115 -0
  83. data/features/step_definitions/features.rb +21 -0
  84. data/features/step_definitions/file_structure.rb +16 -0
  85. data/features/step_definitions/generic_send.rb +9 -0
  86. data/features/step_definitions/get.rb +16 -0
  87. data/features/step_definitions/help.rb +18 -0
  88. data/features/step_definitions/invalid_commands.rb +11 -0
  89. data/features/step_definitions/line_endings.rb +7 -0
  90. data/features/step_definitions/list.rb +73 -0
  91. data/features/step_definitions/login.rb +82 -0
  92. data/features/step_definitions/mkdir.rb +9 -0
  93. data/features/step_definitions/mode.rb +15 -0
  94. data/features/step_definitions/mtime.rb +23 -0
  95. data/features/step_definitions/noop.rb +15 -0
  96. data/features/step_definitions/options.rb +9 -0
  97. data/features/step_definitions/passive.rb +3 -0
  98. data/features/step_definitions/pending.rb +3 -0
  99. data/features/step_definitions/port.rb +5 -0
  100. data/features/step_definitions/put.rb +29 -0
  101. data/features/step_definitions/quit.rb +15 -0
  102. data/features/step_definitions/rename.rb +11 -0
  103. data/features/step_definitions/rmdir.rb +9 -0
  104. data/features/step_definitions/server_files.rb +61 -0
  105. data/features/step_definitions/server_title.rb +12 -0
  106. data/features/step_definitions/size.rb +20 -0
  107. data/features/step_definitions/status.rb +9 -0
  108. data/features/step_definitions/success_replies.rb +7 -0
  109. data/features/step_definitions/system.rb +7 -0
  110. data/features/step_definitions/timing.rb +19 -0
  111. data/features/step_definitions/type.rb +15 -0
  112. data/features/support/env.rb +4 -0
  113. data/features/support/example_server.rb +67 -0
  114. data/features/support/file_templates/ascii_unix +4 -0
  115. data/features/support/file_templates/ascii_windows +4 -0
  116. data/features/support/file_templates/binary +0 -0
  117. data/features/support/test_client.rb +250 -0
  118. data/features/support/test_file_templates.rb +33 -0
  119. data/features/support/test_server.rb +293 -0
  120. data/features/support/test_server_files.rb +57 -0
  121. data/ftpd.gemspec +283 -0
  122. data/insecure-test-cert.pem +29 -0
  123. data/investtools-ftpd.gemspec +284 -0
  124. data/lib/ftpd.rb +86 -0
  125. data/lib/ftpd/auth_levels.rb +9 -0
  126. data/lib/ftpd/cmd_abor.rb +13 -0
  127. data/lib/ftpd/cmd_allo.rb +20 -0
  128. data/lib/ftpd/cmd_appe.rb +24 -0
  129. data/lib/ftpd/cmd_auth.rb +21 -0
  130. data/lib/ftpd/cmd_cdup.rb +16 -0
  131. data/lib/ftpd/cmd_cwd.rb +20 -0
  132. data/lib/ftpd/cmd_dele.rb +21 -0
  133. data/lib/ftpd/cmd_eprt.rb +23 -0
  134. data/lib/ftpd/cmd_epsv.rb +30 -0
  135. data/lib/ftpd/cmd_feat.rb +44 -0
  136. data/lib/ftpd/cmd_help.rb +29 -0
  137. data/lib/ftpd/cmd_list.rb +33 -0
  138. data/lib/ftpd/cmd_login.rb +60 -0
  139. data/lib/ftpd/cmd_mdtm.rb +27 -0
  140. data/lib/ftpd/cmd_mkd.rb +23 -0
  141. data/lib/ftpd/cmd_mode.rb +27 -0
  142. data/lib/ftpd/cmd_nlst.rb +27 -0
  143. data/lib/ftpd/cmd_noop.rb +14 -0
  144. data/lib/ftpd/cmd_opts.rb +14 -0
  145. data/lib/ftpd/cmd_pasv.rb +28 -0
  146. data/lib/ftpd/cmd_pbsz.rb +23 -0
  147. data/lib/ftpd/cmd_port.rb +28 -0
  148. data/lib/ftpd/cmd_prot.rb +34 -0
  149. data/lib/ftpd/cmd_pwd.rb +15 -0
  150. data/lib/ftpd/cmd_quit.rb +18 -0
  151. data/lib/ftpd/cmd_rein.rb +13 -0
  152. data/lib/ftpd/cmd_rename.rb +32 -0
  153. data/lib/ftpd/cmd_rest.rb +13 -0
  154. data/lib/ftpd/cmd_retr.rb +24 -0
  155. data/lib/ftpd/cmd_rmd.rb +22 -0
  156. data/lib/ftpd/cmd_site.rb +13 -0
  157. data/lib/ftpd/cmd_size.rb +29 -0
  158. data/lib/ftpd/cmd_smnt.rb +13 -0
  159. data/lib/ftpd/cmd_stat.rb +15 -0
  160. data/lib/ftpd/cmd_stor.rb +25 -0
  161. data/lib/ftpd/cmd_stou.rb +25 -0
  162. data/lib/ftpd/cmd_stru.rb +27 -0
  163. data/lib/ftpd/cmd_syst.rb +16 -0
  164. data/lib/ftpd/cmd_type.rb +28 -0
  165. data/lib/ftpd/command_handler.rb +90 -0
  166. data/lib/ftpd/command_handler_factory.rb +51 -0
  167. data/lib/ftpd/command_handlers.rb +60 -0
  168. data/lib/ftpd/command_loop.rb +80 -0
  169. data/lib/ftpd/command_sequence_checker.rb +58 -0
  170. data/lib/ftpd/config.rb +13 -0
  171. data/lib/ftpd/connection_throttle.rb +56 -0
  172. data/lib/ftpd/connection_tracker.rb +82 -0
  173. data/lib/ftpd/data_connection_helper.rb +123 -0
  174. data/lib/ftpd/disk_file_system.rb +434 -0
  175. data/lib/ftpd/error.rb +21 -0
  176. data/lib/ftpd/exception_translator.rb +32 -0
  177. data/lib/ftpd/exceptions.rb +62 -0
  178. data/lib/ftpd/file_info.rb +115 -0
  179. data/lib/ftpd/file_system_helper.rb +67 -0
  180. data/lib/ftpd/ftp_server.rb +214 -0
  181. data/lib/ftpd/gets_peer_address.rb +41 -0
  182. data/lib/ftpd/insecure_certificate.rb +16 -0
  183. data/lib/ftpd/list_format/eplf.rb +74 -0
  184. data/lib/ftpd/list_format/ls.rb +154 -0
  185. data/lib/ftpd/list_path.rb +28 -0
  186. data/lib/ftpd/null_logger.rb +22 -0
  187. data/lib/ftpd/protocols.rb +60 -0
  188. data/lib/ftpd/read_only_disk_file_system.rb +22 -0
  189. data/lib/ftpd/server.rb +139 -0
  190. data/lib/ftpd/session.rb +220 -0
  191. data/lib/ftpd/session_config.rb +111 -0
  192. data/lib/ftpd/stream.rb +80 -0
  193. data/lib/ftpd/telnet.rb +114 -0
  194. data/lib/ftpd/temp_dir.rb +22 -0
  195. data/lib/ftpd/tls_server.rb +111 -0
  196. data/lib/ftpd/translate_exceptions.rb +68 -0
  197. data/rake_tasks/cucumber.rake +9 -0
  198. data/rake_tasks/default.rake +1 -0
  199. data/rake_tasks/jeweler.rake +52 -0
  200. data/rake_tasks/spec.rake +3 -0
  201. data/rake_tasks/test.rake +2 -0
  202. data/rake_tasks/yard.rake +3 -0
  203. data/spec/command_sequence_checker_spec.rb +83 -0
  204. data/spec/connection_throttle_spec.rb +99 -0
  205. data/spec/connection_tracker_spec.rb +97 -0
  206. data/spec/disk_file_system_spec.rb +320 -0
  207. data/spec/exception_translator_spec.rb +36 -0
  208. data/spec/file_info_spec.rb +59 -0
  209. data/spec/ftp_server_error_spec.rb +13 -0
  210. data/spec/list_format/eplf_spec.rb +61 -0
  211. data/spec/list_format/ls_spec.rb +270 -0
  212. data/spec/list_path_spec.rb +21 -0
  213. data/spec/null_logger_spec.rb +24 -0
  214. data/spec/protocols_spec.rb +139 -0
  215. data/spec/server_spec.rb +81 -0
  216. data/spec/spec_helper.rb +15 -0
  217. data/spec/telnet_spec.rb +75 -0
  218. data/spec/translate_exceptions_spec.rb +40 -0
  219. metadata +404 -0
@@ -0,0 +1,371 @@
1
+ # Ftpd
2
+ [![Gem Version](https://badge.fury.io/rb/ftpd.png)](http://badge.fury.io/rb/ftpd)
3
+ [![Dependency Status](https://gemnasium.com/wconrad/ftpd.svg)](https://gemnasium.com/wconrad/ftpd)
4
+ [![Build Status](https://travis-ci.org/wconrad/ftpd.png)](https://travis-ci.org/wconrad/ftpd)
5
+ [![Code Climate](https://codeclimate.com/github/wconrad/ftpd.png)](https://codeclimate.com/github/wconrad/ftpd)
6
+
7
+
8
+ ftpd is a pure Ruby FTP server library. It supports implicit and
9
+ explicit TLS, IPV6, passive and active mode, and is unconditionally
10
+ compliant per [RFC-1123][1]. It can be used as part of a test fixture
11
+ or embedded in a program.
12
+
13
+ ## A note about this README
14
+
15
+ This readme contains [Yardoc](http://yardoc.org/) markup for links to
16
+ the API docs; those links don't display properly on github. You'll
17
+ find a properly rendered version [on
18
+ rubydoc.info](http://rubydoc.info/gems/ftpd)
19
+
20
+ ## The state of this library
21
+
22
+ Ftpd has been used for many years to test FTP clients, and is stable
23
+ and reliable for that purpose. However, it was not originally
24
+ intended to be part of a publically accessible FTP server. I would be
25
+ cautious in using it in an untrusted environment due to the
26
+ probability that it contains critical flaws (or even security
27
+ vulnarabilities) that have not been discovered in its use as a test
28
+ harness.
29
+
30
+ ## Hello World
31
+
32
+ This is examples/hello_world.rb, a bare minimum FTP server. It allows
33
+ any user/password, and serves files in a temporary directory. It
34
+ binds to an ephemeral port on the local interface:
35
+
36
+ ```ruby
37
+ require 'ftpd'
38
+ require 'tmpdir'
39
+
40
+ class Driver
41
+
42
+ def initialize(temp_dir)
43
+ @temp_dir = temp_dir
44
+ end
45
+
46
+ def authenticate(user, password)
47
+ true
48
+ end
49
+
50
+ def file_system(user)
51
+ Ftpd::DiskFileSystem.new(@temp_dir)
52
+ end
53
+
54
+ end
55
+
56
+ Dir.mktmpdir do |temp_dir|
57
+ driver = Driver.new(temp_dir)
58
+ server = Ftpd::FtpServer.new(driver)
59
+ server.start
60
+ puts "Server listening on port #{server.bound_port}"
61
+ gets
62
+ end
63
+ ```
64
+
65
+ A more full-featured example that allows TLS and takes options is in
66
+ examples/example.rb
67
+
68
+ ## Driver
69
+
70
+ Ftpd's dynamic behavior such as authentication and file retrieval is
71
+ controlled by a driver that you supply. The Driver class in the
72
+ "hello world" example above shows a rudimentary driver. Ftpd calls
73
+ the authenticate method to decide who can log in. Once someone is
74
+ logged on, it calls the file_system method to obtain a file system
75
+ driver for that user.
76
+
77
+ There is no base class for a driver. Any object that quacks like a
78
+ driver will do. Here are the methods your driver needs:
79
+
80
+ * {Example::Driver#authenticate authenticate}
81
+ * {Example::Driver#file_system file_system}
82
+
83
+ ## File System
84
+
85
+ The file system object that the driver supplies to Ftpd is Ftpd's
86
+ gateway to the logical file system. Ftpd doesn't know or care whether
87
+ it's serving files from disk, memory, or any other means.
88
+
89
+ The file system can be very minimal. If the file system is missing
90
+ certain methods, the server simply disables the commands which need
91
+ that method. For example, if there is no write method, then STOR is
92
+ not supported and causes a "502 Command not implemented" response to
93
+ the client.
94
+
95
+ The canonical and commented example of an Ftpd file system is
96
+ {Ftpd::DiskFileSystem}. You can use it as a template for creating
97
+ your own, and its comments are the official specification for an Ftpd
98
+ file system.
99
+
100
+ Here are the methods a file system may expose:
101
+
102
+ * {Ftpd::DiskFileSystem::Accessors#accessible? accessible?}
103
+ * {Ftpd::DiskFileSystem::Accessors#directory? directory?}
104
+ * {Ftpd::DiskFileSystem::Accessors#exists? exists?}
105
+ * {Ftpd::DiskFileSystem::Append#append append}
106
+ * {Ftpd::DiskFileSystem::Delete#delete delete}
107
+ * {Ftpd::DiskFileSystem::List#dir dir}
108
+ * {Ftpd::DiskFileSystem::List#file_info file_info}
109
+ * {Ftpd::DiskFileSystem::Mkdir#mkdir mkdir}
110
+ * {Ftpd::DiskFileSystem::Read#read read}
111
+ * {Ftpd::DiskFileSystem::Rename#rename rename}
112
+ * {Ftpd::DiskFileSystem::Rmdir#rmdir rmdir}
113
+ * {Ftpd::DiskFileSystem::Write#write write}
114
+
115
+ ### DiskFileSystem
116
+
117
+ Ftpd includes a disk based file system:
118
+
119
+ ```ruby
120
+ class Driver
121
+
122
+ ...
123
+
124
+ def file_system(user)
125
+ Ftpd::DiskFileSystem.new('/var/lib/ftp')
126
+ end
127
+
128
+ end
129
+ ```
130
+
131
+ **Warning**: The DiskFileSystem allows file and directory modification
132
+ including writing, renaming, deleting, etc. If you want a read-only
133
+ file system, then use {Ftpd::ReadOnlyDiskFileSystem} instead.
134
+
135
+ The DiskFileSystem is composed out of modules:
136
+
137
+ * {Ftpd::DiskFileSystem::Base Base} - You will need this
138
+ * {Ftpd::DiskFileSystem::Append Append} - File appending
139
+ * {Ftpd::DiskFileSystem::Delete Delete} - File deletion
140
+ * {Ftpd::DiskFileSystem::List List} - Directory listing
141
+ * {Ftpd::DiskFileSystem::Mkdir Mkdir} - Directory creation
142
+ * {Ftpd::DiskFileSystem::Read Read} - File reading
143
+ * {Ftpd::DiskFileSystem::Rename Rename} - File renaming
144
+ * {Ftpd::DiskFileSystem::Rmdir Rmdir} - Directory removal
145
+ * {Ftpd::DiskFileSystem::Write Write} - File writing
146
+
147
+ You can use these modules to create a custom disk file system that
148
+ allows only the operations you want, or which mixes the predefined
149
+ modules with your customizations, as in this silly example that allows
150
+ uploads but then throws them away.
151
+
152
+ ```ruby
153
+ class BlackHole
154
+ def write(ftp_path, contents)
155
+ end
156
+ end
157
+
158
+ class CustomDiskFileSystem
159
+ include DiskFileSystem::Base
160
+ include DiskFileSystem::Read
161
+ include BlackHole
162
+ end
163
+ ```
164
+
165
+ ## Configuration
166
+
167
+ Configuration is done via accessors on {Ftpd::FtpServer}. For
168
+ example, to set the session timeout to 10 minutes:
169
+
170
+ ```ruby
171
+ server = Ftpd::FtpServer.new(driver)
172
+ server.session_timeout = 10 * 60
173
+ server.start
174
+ ```
175
+
176
+ You can set any of these attributes before starting the server:
177
+
178
+ * {Ftpd::FtpServer#allow_low_data_ports}
179
+ * {Ftpd::FtpServer#auth_level}
180
+ * {Ftpd::FtpServer#failed_login_delay}
181
+ * {Ftpd::FtpServer#list_formatter}
182
+ * {Ftpd::FtpServer#log}
183
+ * {Ftpd::FtpServer#max_connections_per_ip}
184
+ * {Ftpd::FtpServer#max_connections}
185
+ * {Ftpd::FtpServer#max_failed_logins}
186
+ * {Ftpd::FtpServer#response_delay}
187
+ * {Ftpd::FtpServer#server_name}
188
+ * {Ftpd::FtpServer#server_version}
189
+ * {Ftpd::FtpServer#session_timeout}
190
+ * {Ftpd::Server#interface}
191
+ * {Ftpd::Server#port}
192
+ * {Ftpd::TlsServer#certfile_path}
193
+ * {Ftpd::TlsServer#tls}
194
+
195
+ ### LIST output format
196
+
197
+ By default, the LIST command uses Unix "ls -l" formatting:
198
+
199
+ -rw-r--r-- 1 user group 1234 Mar 3 08:38 foo
200
+
201
+ An alternative to "ls -l" formatting is [Easily Parsed LIST format
202
+ (EPLF)](http://cr.yp.to/ftp/list/eplf.html) format:
203
+
204
+ +r,s1234,m1362325080\tfoo
205
+
206
+ to configure Ftpd for EPLF formatting:
207
+
208
+ ftp_server.list_formatter = Ftpd::ListFormat::Eplf
209
+
210
+ To create your own custom formatter, create a class with these
211
+ methods:
212
+
213
+ * {Ftpd::ListFormat::Ls#initialize initialize}
214
+ * {Ftpd::ListFormat::Ls#to_s to_s}
215
+
216
+ And register your class with the ftp_server before starting it:
217
+
218
+ ftp_server.list_formatter = MyListFormatter
219
+
220
+ ### Logging
221
+
222
+ Ftpd can write to an instance of
223
+ {http://www.ruby-doc.org/stdlib-2.0.0/libdoc/logger/rdoc/Logger.html
224
+ Logger} that you provide. To log to standard out:
225
+
226
+ server.log = Logger.new($stdout)
227
+
228
+ To log to a file:
229
+
230
+ server.log = Logger.new('/tmp/ftpd.log')
231
+
232
+ ## Standards Compliance
233
+
234
+ * Unconditionally compliant per [RFC-1123][1] (Requirements for
235
+ Internet Hosts).
236
+
237
+ * Implements all of the security recommendations in
238
+ [RFC-2577](http://tools.ietf.org/rfc/rfc2577.txt) (FTP Security
239
+ Considerations).
240
+
241
+ * Implements [RFC-2389](http://tools.ietf.org/rfc/rfc2389.txt)
242
+ (Feature negotiation mechanism for the File Transfer Protocol)
243
+
244
+ * Implements [RFC-2428](http://tools.ietf.org/rfc/rfc2428.txt) (FTP
245
+ Extensions for IPv6 and NATs)
246
+
247
+ * Implements enough of
248
+ [RFC-4217](http://tools.ietf.org/rfc/rfc4217.txt) (Securing FTP with
249
+ TLS) to get by.
250
+
251
+ See [RFC Compliance](doc/rfc-compliance.md) for details
252
+
253
+ ## Ruby Compatability
254
+
255
+ The tests pass with these Rubies:
256
+
257
+ * ruby-1.9.3
258
+ * ruby-2.0
259
+ * ruby-2.1
260
+
261
+ For Ruby 1.8, use an ftpd version before 0.8. In your Gemfile:
262
+
263
+ gem 'ftpd', '<0.8'
264
+
265
+ ## OS compatability
266
+
267
+ ## *nix
268
+
269
+ Ftpd runs on:
270
+
271
+ * Linux
272
+ * OSX
273
+
274
+ ## Windows
275
+
276
+ The master branch of ftpd does not currently run on Windows. There is
277
+ an experimental branch for Windows which contains several changes that
278
+ ought to make ftpd work on Windows, but they need testing. To try
279
+ that branch, use this line in your Gemfile:
280
+
281
+ gem 'ftpd', github: 'wconrad/ftpd', branch: 'windows'
282
+
283
+ Does it work for you? Is it busted? Please report your experience
284
+ [here](https://github.com/wconrad/ftpd/issues/3).
285
+
286
+ ## Development
287
+
288
+ ### Tests
289
+
290
+ To run the cucumber (functional) tests:
291
+
292
+ $ rake test:features
293
+
294
+ To run the rspec (unit) tests:
295
+
296
+ $ rake test:spec
297
+
298
+ To run all tests:
299
+
300
+ $ rake test
301
+
302
+ or just:
303
+
304
+ $ rake
305
+
306
+ To force features to write the server log to stdout:
307
+
308
+ $ FTPD_DEBUG=1 rake test:features
309
+
310
+ ### Example
311
+
312
+ The stand-alone example is good for manually testing Ftpd with any FTP
313
+ client. To run the stand-alone example:
314
+
315
+ $ examples/example.rb
316
+
317
+ The example prints its port, username and password to the console.
318
+ You can connect to the stand-alone example with any FTP client.
319
+
320
+ example.rb has many options. To see them:
321
+
322
+ $ examples/example.rb -h
323
+
324
+ ### Contributing
325
+
326
+ 1. Fork it
327
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
328
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
329
+ 4. Push to the branch (`git push origin my-new-feature`)
330
+ 5. Create new Pull Request
331
+
332
+ ## Origin
333
+
334
+ I created ftpd to support the test framework I wrote for Databill,
335
+ LLC, which has given its kind permission to donate it to the
336
+ community.
337
+
338
+ ## Whoami
339
+
340
+ Wayne Conrad <wconrad@yagni.com>
341
+
342
+ ## Credits
343
+
344
+ Thanks to Databill, LLC, which supported the creation of this library,
345
+ and granted permission to donate it to the community.
346
+
347
+ ### Contributors
348
+
349
+ Among those who have improved ftpd are:
350
+
351
+ * Alfonso Cora
352
+ * Bjoern B. Dorra
353
+ * Joshua Rutherford
354
+ * Larry. W. Cashdollar
355
+ * Michael de Silva
356
+ * Mike Ragalie
357
+ * cransom
358
+
359
+ If I've forgotten to add you, please remind me, or submit a merge
360
+ request.
361
+
362
+ Thank you!
363
+
364
+ ## See also
365
+
366
+ * [Changelog](Changelog.md)
367
+ * [RFC compliance](doc/rfc-compliance.md)
368
+ * [References](doc/references.md)
369
+ * [Benchmarks](doc/benchmarks.md)
370
+
371
+ [1]: http://tools.ietf.org/rfc/rfc1123.txt
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+ require 'rubygems'
3
+ require 'bundler'
4
+
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts 'Run `bundle install` to install missing gems'
10
+ exit e.status_code
11
+ end
12
+
13
+ $:.unshift(File.dirname(__FILE__) + '/lib')
14
+ Dir['rake_tasks/**/*.rake'].sort.each { |path| load path }
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.1
@@ -0,0 +1,82 @@
1
+ # Benchmarks
2
+
3
+ Benchmarks using pyftpd's benchmark script and
4
+ [procedures](http://code.google.com/p/pyftpdlib/wiki/Benchmarks).
5
+
6
+ ## Results
7
+
8
+ ### ftpd 0.17.0
9
+
10
+ (starting with 14.9M of memory being used)
11
+ STOR (client -> server) 120.75 MB/sec 14.9M
12
+ RETR (server -> client) 741.77 MB/sec 22.7M
13
+ 200 concurrent clients (connect, login) 0.20 secs 19.2M
14
+ STOR (1 file with 200 idle clients) 144.77 MB/sec 19.2M
15
+ RETR (1 file with 200 idle clients) 542.86 MB/sec 27.1M
16
+ 200 concurrent clients (RETR 10.0M file) 6.38 secs 32.1M
17
+ 200 concurrent clients (STOR 10.0M file) 2.76 secs 21.7M
18
+ 200 concurrent clients (QUIT) 0.03 secs
19
+
20
+ ### pyftpd 1.4.0
21
+
22
+ (starting with 4.2M of memory being used)
23
+ STOR (client -> server) 127.62 MB/sec 4.2M
24
+ RETR (server -> client) 1170.82 MB/sec 4.3M
25
+ 200 concurrent clients (connect, login) 2.53 secs 4.8M
26
+ STOR (1 file with 200 idle clients) 113.38 MB/sec 4.9M
27
+ RETR (1 file with 200 idle clients) 1139.89 MB/sec 4.9M
28
+ 200 concurrent clients (RETR 10.0M file) 2.55 secs 5.6M
29
+ 200 concurrent clients (STOR 10.0M file) 2.03 secs 5.7M
30
+ 200 concurrent clients (QUIT) 0.02 secs
31
+
32
+ ### proftpd 1.3.5rc4
33
+
34
+ (starting with 1.4M of memory being used)
35
+ STOR (client -> server) 117.59 MB/sec 3.2M
36
+ RETR (server -> client) 1318.32 MB/sec 3.2M
37
+ 200 concurrent clients (connect, login) 12.20 secs 366.4M
38
+ STOR (1 file with 200 idle clients) 123.82 MB/sec 368.3M
39
+ RETR (1 file with 200 idle clients) 1302.86 MB/sec 368.3M
40
+ 200 concurrent clients (RETR 10.0M file) 2.33 secs 366.4M
41
+ 200 concurrent clients (STOR 10.0M file) 2.76 secs 366.4M
42
+ 200 concurrent clients (QUIT) 0.00 secs
43
+
44
+ ### Notes
45
+
46
+ * Ftpd's fast time on the login test, compared to proftpd and
47
+ pyftpdlib, is probably a result of it not doing PAM authentication
48
+ whereas the other ftpd servers are. It is not an apples-to-apples
49
+ comparison.
50
+
51
+ * The only benchmark for which ftpd beats the competition is the
52
+ single-client STOR.
53
+
54
+ ## Setup
55
+
56
+ ### Machine
57
+
58
+ * Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz (4 cores)
59
+ * Python 3.4.1rc1
60
+ * pyftpd 1.4.0
61
+ * ruby 2.1.1p76 (2014-02-24 revision 45161) [i686-linux]
62
+ * Linux 3.0.0-1-686-pae #1 SMP Sat Aug 27 16:41:03 UTC 2011 i686 GNU/Linux
63
+
64
+ ### Benchmark command
65
+
66
+ bench.py needs psutil. Under Debian, install _python-psutil_.
67
+
68
+ pyftpdlib-1.0.1/test$ python3 bench.py -u <USER> -p <PASS> -H localhost -P <PORT> -b all -n 200 -k <PID>
69
+
70
+ ### Proftpd
71
+
72
+ /etc/proftpd/proftpd.conf:
73
+
74
+ MaxInstances 2000
75
+
76
+ ### Ftpd
77
+
78
+ $ bundle exec examples/example.rb -p 2222 -U bench -P bench
79
+
80
+ ### Pyftpd
81
+
82
+ pyftpdlib-1.4.0/demo$ sudo python ./unix_daemon.py 2>/dev/null