Commits

Dmitry Fedorov committed b213fd9

fix for large uploads on windows

  • Participants
  • Parent commits edf80ff

Comments (0)

Files changed (1)

File paste/httpserver.py

 import time
 import thread
 import os
+import sys
 from itertools import count
 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
 from SocketServer import ThreadingMixIn
         max_read = self.length - self._consumed
         if len(args):
             max_read = min(args[0], max_read)
-        data = self.file.readline(max_read)
+        total = max_read
+        # readline errors in windows for files larger than 2GB, limit max_read size by maxint
+        max_read = min(max_read, sys.maxint)
+#        data = []
+#        while total>0:
+#            buf = self.file.readline(max_read)
+#            data.append(buf)
+#            total -= max_read
+#            if len(buf)<max_read:
+#                break
+#        data = ''.join(data)      
+        data = self.file.readline(max_read)      
         self._consumed += len(data)
         return data