ftpfxp 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ftpfxp/ftpfxp.rb CHANGED
@@ -142,10 +142,11 @@ module Net
142
142
  dst.fxpsetport(ports)
143
143
  dst.fxpstor(dstpath)
144
144
  fxpretr(srcpath)
145
- resp = fxpwait
146
- raise FTPFXPSrcSiteError unless '226' == resp[0,3]
147
- resp = dst.fxpwait
148
- raise FTPFXPDstSiteError unless '226' == resp[0,3]
145
+ resp = {}
146
+ resp[:srcresp] = fxpwait
147
+ raise FTPFXPTLSSrcSiteError unless '226' == resp[:srcresp][0,3]
148
+ resp[:dstresp] = dst.fxpwait
149
+ raise FTPFXPTLSDstSiteError unless '226' == resp[:dstresp][0,3]
149
150
  return resp
150
151
  end
151
152
 
@@ -89,10 +89,10 @@ module Net
89
89
 
90
90
  # Protection buffer size must be set to 0 since FTP-TLS does
91
91
  # not require this, but it still must be set.
92
- voidcmd('PBSZ 0')
92
+ fxppbsz(0)
93
93
 
94
94
  # Set to P since we're using TLS.
95
- voidcmd('PROT P')
95
+ fxpprotp
96
96
  @secure_on = true
97
97
  end
98
98
 
@@ -107,6 +107,17 @@ module Net
107
107
  #
108
108
  # :startdoc:
109
109
 
110
+ #
111
+ # This method sets the +protection buffer size+.
112
+ # Usually this is set to 0 for SSL/TLS transfers.
113
+ #
114
+ def fxppbsz(size)
115
+ synchronize do
116
+ putline("PBSZ #{size}")
117
+ return getresp
118
+ end
119
+ end
120
+
110
121
  #
111
122
  # This method notifies the server to start using protection mode.
112
123
  # Must issue this command on both control connections
@@ -207,7 +218,7 @@ module Net
207
218
  #
208
219
  def fxpto(dst, dstpath, srcpath)
209
220
  if not @secure_on
210
- voidcmd('PROT P')
221
+ fxpprotp
211
222
  @secure_on = true
212
223
  end
213
224
 
@@ -217,10 +228,11 @@ module Net
217
228
  dst.fxpsetport(ports)
218
229
  dst.fxpstor(dstpath)
219
230
  fxpretr(srcpath)
220
- resp = fxpwait
221
- raise FTPFXPTLSSrcSiteError unless '226' == resp[0,3]
222
- resp = dst.fxpwait
223
- raise FTPFXPTLSDstSiteError unless '226' == resp[0,3]
231
+ resp = {}
232
+ resp[:srcresp] = fxpwait
233
+ raise FTPFXPTLSSrcSiteError unless '226' == resp[:srcresp][0,3]
234
+ resp[:dstresp] = dst.fxpwait
235
+ raise FTPFXPTLSDstSiteError unless '226' == resp[:dstresp][0,3]
224
236
  return resp
225
237
  end
226
238
 
@@ -232,7 +244,7 @@ module Net
232
244
  #
233
245
  def fxpsscnto(dst, dstpath, srcpath)
234
246
  if not @secure_on
235
- voidcmd('PROT P')
247
+ fxpprotp
236
248
  @secure_on = true
237
249
  end
238
250
 
@@ -244,10 +256,11 @@ module Net
244
256
  dst.fxpsetport(ports)
245
257
  dst.fxpstor(dstpath)
246
258
  fxpretr(srcpath)
247
- resp = fxpwait
248
- raise FTPFXPTLSSrcSiteError unless '226' == resp[0,3]
249
- resp = dst.fxpwait
250
- raise FTPFXPTLSDstSiteError unless '226' == resp[0,3]
259
+ resp = {}
260
+ resp[:srcresp] = fxpwait
261
+ raise FTPFXPTLSSrcSiteError unless '226' == resp[:srcresp][0,3]
262
+ resp[:dstresp] = dst.fxpwait
263
+ raise FTPFXPTLSDstSiteError unless '226' == resp[:dstresp][0,3]
251
264
  return resp
252
265
  end
253
266
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ftpfxp
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.2
7
- date: 2006-07-11 00:00:00 -04:00
6
+ version: 0.0.3
7
+ date: 2006-07-23 00:00:00 -04:00
8
8
  summary: Extension to Net::FTP providing FXP and SSL/TLS support
9
9
  require_paths:
10
10
  - lib