On 12/02/2014 02:20 PM, Shannon Dealy wrote:
> On Tue, 2 Dec 2014, Shannon Dealy wrote:
> 
> [snip]
>> I performed a capture as requested, ...
> 
> Sorry Nikolaus,
> 
> I have deleted that file from where I posted it.
> 
> I made a mistake, that file was captured with ssl enabled.  In fact, it
> appears based on a limited sample, that fsck.s3ql fails 100% of the time
> when ssl is enabled (35+ runs), and succeeds 100% of the time when ssl
> is disabled (6 runs so far).  I don't know if this is a generic work
> around, or if it just happens to work this way for my particular data set.

Looks like a pattern, thanks a lot for all the tests!

> Given the above, there is no way I can provide you with a "no-ssl"
> version of the captured data (since it always succeeds).  Could you make
> a patch to fsck.s3ql which would provide you with the required data?  

Not to fsck.s3ql, but the attached patch should enable traffic dumping
on the lower-level dugong library. It creates files "raw_stream_xx.dat"
in the current directory. Could you give that a shot and attach both the
results for an ssl and no-ssl run?

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«
diff --git a/dugong/__init__.py b/dugong/__init__.py
--- a/dugong/__init__.py
+++ b/dugong/__init__.py
@@ -17,7 +17,9 @@
 import ssl
 import hashlib
 from inspect import getdoc
+from itertools import count
 import textwrap
+import os
 from base64 import b64encode
 from collections import deque
 from collections.abc import MutableMapping, Mapping
@@ -424,6 +426,11 @@
         self._in_remaining = None
         self._pending_requests = deque()
 
+        for i in count():
+            if not os.path.exists('raw_stream_%d.dat' % i):
+                break
+        self.dumpfh = open('raw_stream_%d.dat' % i, 'wb')
+
         log.debug('done')
 
     def _co_tunnel(self):
@@ -573,7 +580,7 @@
         '''Send *buf* to server'''
 
         log.debug('trying to send %d bytes', len(buf))
-
+        
         if not isinstance(buf, memoryview):
             buf = memoryview(buf)
 
@@ -608,6 +615,7 @@
                 continue
 
             log.debug('sent %d bytes', len_)
+            self.dumpfh.write(buf[:len_])
             buf = buf[len_:]
             if len(buf) == 0:
                 log.debug('done')
@@ -922,6 +930,7 @@
                 buf2 = self._sock.recv(size - len(buf))
                 if not buf2:
                     break
+                self.dumpfh.write(buf2)
                 buf += buf2
             else:
                 buf += rbuf.exhaust()
@@ -1062,6 +1071,7 @@
                 raise ConnectionClosed('connection closed unexpectedly')
 
             log.debug('got %d bytes', read)
+            self.dumpfh.write(buf[pos:pos+read])
             self._in_remaining -= read
             pos += read
             if pos == len_:
@@ -1213,6 +1223,7 @@
             assert rbuf.e < len(rbuf.d)
             raise ConnectionClosed('connection closed unexpectedly')
 
+        self.dumpfh.write(rbuf.d[rbuf.e:rbuf.e+len_])
         rbuf.e += len_
         log.debug('done (got %d bytes)', len_)
         return len_
@@ -1288,6 +1299,7 @@
             self._sock.close()
             self._sock = None
             self._rbuf.clear()
+            self.dumpfh.close()
         else:
             log.debug('already closed')
 

Reply via email to