On 04/14/2014 10:07 AM, Adam Watkins wrote:
> 
> 
> This comes from the server discussed in my first email, and is running
> S3QL 2.8.1:
[...]

Could you apply the attached patches the python-dugong and S3QL, and
then try to reproduce the problem?

To apply the patches, do a 'patch -p1 < patchname.diff' in the directory
created when extracting the tarball.


Hopefully this will result in a more helpful mount.log.


Thanks!
-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.«

-- 
You received this message because you are subscribed to the Google Groups 
"s3ql" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/dugong/__init__.py b/dugong/__init__.py
--- a/dugong/__init__.py
+++ b/dugong/__init__.py
@@ -845,6 +845,42 @@
             raise self._encoding
         else:
             raise RuntimeError('ooops, this should not be possible')
+
+    def read_raw(self, size):
+        '''Read *size* bytes of uninterpreted data
+
+        This method may be used even after `UnsupportedResponse` or
+        `InvalidResponse` has been raised. It reads raw data from the socket
+        without attempting to interpret it. This is probably only useful for
+        debugging purposes to take a look at the raw data received from the
+        server. This method blocks if no data is available, and returns ``b''``
+        if the connection has been closed.
+
+        Calling this method will break the internal state and switch the socket
+        to blocking operation. The connection has to be closed and reestablished
+        afterwards.
+
+        **Don't use this method unless you know exactly what you are doing**.
+        '''
+
+        self._sock.setblocking(True)
+        
+        buf = bytearray()
+        rbuf = self._rbuf
+        while len(buf) < size:
+            len_ = min(size - len(buf), len(rbuf))
+            if len_ < len(rbuf):
+                buf += rbuf.d[rbuf.b:rbuf.b+len_]
+                rbuf.b += len_
+            elif len_ == 0:
+                buf2 = self._sock.recv(size - len(buf))
+                if not buf2:
+                    break
+                buf += buf2
+            else:
+                buf += rbuf.exhaust()
+
+        return buf
         
     def readinto(self, buf):
         '''placeholder, will be replaced dynamically'''
diff --git a/src/s3ql/backends/s3c.py b/src/s3ql/backends/s3c.py
--- a/src/s3ql/backends/s3c.py
+++ b/src/s3ql/backends/s3c.py
@@ -14,7 +14,8 @@
                                   ABCDocstMeta)
 from io import BytesIO
 from shutil import copyfileobj
-from dugong import HTTPConnection, is_temp_network_error, BodyFollowing, CaseInsensitiveDict
+from dugong import (HTTPConnection, is_temp_network_error, BodyFollowing, CaseInsensitiveDict,
+                    UnsupportedResponse)
 from base64 import b64encode, b64decode
 from email.utils import parsedate_tz, mktime_tz
 from urllib.parse import urlsplit
@@ -134,9 +135,14 @@
         '''
 
         if body is None:
-            body = self.conn.read(2048)
-            if body:
-                self.conn.discard()
+            try:
+                body = self.conn.read(2048)
+                if body:
+                    self.conn.discard()
+            except UnsupportedResponse:
+                log.warning('Unsupported response, trying to retrieve data from raw socket!')
+                body = self.conn.read_raw(2048)
+                self.conn.close()
         else:
             body = body[:2048]
             

Reply via email to