Do not modify the string passed to write() operations

git-svn-id: file:///home/svn/framework3/trunk@12394 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2011-04-21 17:29:11 +00:00
parent 8b920a8f95
commit a61e7290b0
2 changed files with 2 additions and 4 deletions

View File

@ -160,7 +160,7 @@ protected
total_length = buf.length total_length = buf.length
while( total_sent < total_length ) while( total_sent < total_length )
begin begin
data = buf[0, buf.length] data = buf[total_sent, buf.length]
sent = self.write( data ) sent = self.write( data )
# sf: Only remove the data off the queue is syswrite was successfull. # sf: Only remove the data off the queue is syswrite was successfull.
# This way we naturally perform a resend if a failure occured. # This way we naturally perform a resend if a failure occured.
@ -168,7 +168,6 @@ protected
# failes gracefully and a resend is required. # failes gracefully and a resend is required.
if( sent > 0 ) if( sent > 0 )
total_sent += sent total_sent += sent
buf[0, sent] = ""
end end
rescue ::IOError => e rescue ::IOError => e
closed = true closed = true

View File

@ -193,11 +193,10 @@ class Socks4a
total_length = buf.length total_length = buf.length
while( total_sent < total_length ) while( total_sent < total_length )
begin begin
data = buf[0, buf.length] data = buf[total_sent, buf.length]
sent = self.write( data ) sent = self.write( data )
if( sent > 0 ) if( sent > 0 )
total_sent += sent total_sent += sent
buf[0, sent] = ""
end end
rescue rescue
closed = true closed = true