mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
51b8281151
commit
38f4a2aa69
@ -15,13 +15,12 @@ from calibre.ptempfile import TemporaryDirectory
|
|||||||
from calibre.srv.opts import Options
|
from calibre.srv.opts import Options
|
||||||
from calibre.srv.utils import (
|
from calibre.srv.utils import (
|
||||||
socket_errors_socket_closed, socket_errors_nonblocking, HandleInterrupt,
|
socket_errors_socket_closed, socket_errors_nonblocking, HandleInterrupt,
|
||||||
socket_errors_eintr, start_cork, stop_cork)
|
socket_errors_eintr, start_cork, stop_cork, DESIRED_SEND_BUFFER_SIZE)
|
||||||
from calibre.utils.socket_inheritance import set_socket_inherit
|
from calibre.utils.socket_inheritance import set_socket_inherit
|
||||||
from calibre.utils.logging import ThreadSafeLog
|
from calibre.utils.logging import ThreadSafeLog
|
||||||
from calibre.utils.monotonic import monotonic
|
from calibre.utils.monotonic import monotonic
|
||||||
|
|
||||||
READ, WRITE, RDWR = 'READ', 'WRITE', 'RDWR'
|
READ, WRITE, RDWR = 'READ', 'WRITE', 'RDWR'
|
||||||
DESIRED_SEND_BUFFER_SIZE = 16 * 1024
|
|
||||||
|
|
||||||
class Connection(object):
|
class Connection(object):
|
||||||
|
|
||||||
|
@ -329,6 +329,7 @@ class TestHTTP(BaseTest):
|
|||||||
self.ae(len(data), len(rdata))
|
self.ae(len(data), len(rdata))
|
||||||
self.ae(hashlib.sha1(data).hexdigest(), hashlib.sha1(rdata).hexdigest())
|
self.ae(hashlib.sha1(data).hexdigest(), hashlib.sha1(rdata).hexdigest())
|
||||||
self.ae(data, rdata)
|
self.ae(data, rdata)
|
||||||
self.assertLess(monotonic() - start_time, 1, 'Large file transfer took too long')
|
time_taken = monotonic() - start_time
|
||||||
|
self.assertLess(time_taken, 1, 'Large file transfer took too long')
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -17,6 +17,7 @@ from calibre.constants import iswindows
|
|||||||
|
|
||||||
HTTP1 = 'HTTP/1.0'
|
HTTP1 = 'HTTP/1.0'
|
||||||
HTTP11 = 'HTTP/1.1'
|
HTTP11 = 'HTTP/1.1'
|
||||||
|
DESIRED_SEND_BUFFER_SIZE = 16 * 1024 # windows 7 uses an 8KB sndbuf
|
||||||
|
|
||||||
def http_date(timeval=None):
|
def http_date(timeval=None):
|
||||||
return type('')(formatdate(timeval=timeval, usegmt=True))
|
return type('')(formatdate(timeval=timeval, usegmt=True))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user