summaryrefslogtreecommitdiff
path: root/paste
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2019-09-09 00:50:58 -0700
committerChris Dent <cdent@anticdent.org>2019-09-09 08:50:58 +0100
commit7e2f7e78697a0a9126cdbc69bbea699c00b7c121 (patch)
tree4059366257bbbc3a9f39ba0f58229ac09359ae94 /paste
parent3a1642dce3a9a5b3f7805ab9f7a4792a494a8db7 (diff)
downloadpaste-git-7e2f7e78697a0a9126cdbc69bbea699c00b7c121.tar.gz
LimitedLengthFile: Handle io.UnsupportedOperation from socket.tell(). (#35)
On Python 3, socket.makefile() returns an object with a tell() method, but one that always raises io.UnsupportedOperation.
Diffstat (limited to 'paste')
-rwxr-xr-xpaste/httpserver.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/paste/httpserver.py b/paste/httpserver.py
index 063c180..7709c60 100755
--- a/paste/httpserver.py
+++ b/paste/httpserver.py
@@ -20,6 +20,7 @@ if pyOpenSSL is installed, it also provides SSL capabilities.
from __future__ import print_function
import atexit
import traceback
+import io
import socket, sys, threading
import posixpath
import six
@@ -523,9 +524,11 @@ class LimitedLengthFile(object):
def tell(self):
if hasattr(self.file, 'tell'):
- return self.file.tell()
- else:
- return self._consumed
+ try:
+ return self.file.tell()
+ except io.UnsupportedOperation:
+ pass
+ return self._consumed
class ThreadPool(object):
"""