revert commit 3298, 3299. This will be revised after 6.0.
bzr revid: al@openerp.com-20110118235033-r3n38tu482krm173
This commit is contained in:
@@ -123,12 +123,10 @@ class HttpLogHandler:
|
||||
|
||||
class MultiHandler2(HttpLogHandler, MultiHTTPHandler):
|
||||
_logger = logging.getLogger('http')
|
||||
wbufsize = 32768
|
||||
|
||||
|
||||
class SecureMultiHandler2(HttpLogHandler, SecureMultiHTTPHandler):
|
||||
_logger = logging.getLogger('https')
|
||||
wbufsize = 32768
|
||||
|
||||
def getcert_fnames(self):
|
||||
tc = tools.config
|
||||
|
||||
@@ -108,8 +108,6 @@ class TinySocketServerThread(threading.Thread,netsvc.Server):
|
||||
self.__interface = interface
|
||||
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
# disables Nagle algorithm (avoids 200ms default delay on Windows)
|
||||
self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||
self.socket.bind((self.__interface, self.__port))
|
||||
self.socket.listen(5)
|
||||
self.threads = []
|
||||
|
||||
@@ -182,13 +182,12 @@ class FixSendError:
|
||||
self.send_header('Connection', 'close')
|
||||
self.send_header('Content-Length', len(content) or 0)
|
||||
self.end_headers()
|
||||
if hasattr(self, '_flush'):
|
||||
self._flush()
|
||||
|
||||
if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
|
||||
self.wfile.write(content)
|
||||
|
||||
if hasattr(self, '_flush'):
|
||||
self._flush()
|
||||
|
||||
class HttpOptions:
|
||||
_HTTP_OPTIONS = {'Allow': ['OPTIONS' ] }
|
||||
|
||||
@@ -396,7 +395,6 @@ class MultiHTTPHandler(FixSendError, HttpOptions, BaseHTTPRequestHandler):
|
||||
return
|
||||
if not self.parse_rawline():
|
||||
self.log_message("Could not parse rawline.")
|
||||
self.wfile.flush()
|
||||
return
|
||||
# self.parse_request(): # Do NOT parse here. the first line should be the only
|
||||
|
||||
@@ -405,7 +403,6 @@ class MultiHTTPHandler(FixSendError, HttpOptions, BaseHTTPRequestHandler):
|
||||
if not self.parse_request():
|
||||
return
|
||||
self.do_OPTIONS()
|
||||
self.wfile.flush()
|
||||
return
|
||||
|
||||
for vdir in self.server.vdirs:
|
||||
@@ -432,11 +429,9 @@ class MultiHTTPHandler(FixSendError, HttpOptions, BaseHTTPRequestHandler):
|
||||
"client closed connection", self.rlpath.rstrip())
|
||||
else:
|
||||
raise
|
||||
self.wfile.flush()
|
||||
return
|
||||
# if no match:
|
||||
self.send_error(404, "Path not found: %s" % self.path)
|
||||
self.wfile.flush()
|
||||
return
|
||||
|
||||
def _get_ignore_body(self,fore):
|
||||
|
||||
+9
-1
@@ -61,7 +61,15 @@ class mysocket:
|
||||
|
||||
def mysend(self, msg, exception=False, traceback=None):
|
||||
msg = cPickle.dumps([msg,traceback])
|
||||
self.sock.sendall('%8d%s%s' % (len(msg), exception and "1" or "0", msg))
|
||||
size = len(msg)
|
||||
self.sock.send('%8d' % size)
|
||||
self.sock.send(exception and "1" or "0")
|
||||
totalsent = 0
|
||||
while totalsent < size:
|
||||
sent = self.sock.send(msg[totalsent:])
|
||||
if sent == 0:
|
||||
raise RuntimeError, "socket connection broken"
|
||||
totalsent = totalsent + sent
|
||||
|
||||
def myreceive(self):
|
||||
buf=''
|
||||
|
||||
Reference in New Issue
Block a user