[FIX]Copy colly of handle function of basehttpserver. Lucky guess
bzr revid: dle@openerp.com-20121212182413-kusxwx9g9qrg7jdv
This commit is contained in:
parent
0d168ae647
commit
d2cc57ffb6
|
@ -93,8 +93,48 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler):
|
||||||
def _log(self, message):
|
def _log(self, message):
|
||||||
self._logger.debug(message)
|
self._logger.debug(message)
|
||||||
|
|
||||||
|
def handle_one_request(self):
|
||||||
|
"""Handle a single HTTP request.
|
||||||
|
|
||||||
|
You normally don't need to override this method; see the class
|
||||||
|
__doc__ string for information on how to handle specific HTTP
|
||||||
|
commands such as GET and POST.
|
||||||
|
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
self.raw_requestline = self.rfile.readline(65537)
|
||||||
|
if len(self.raw_requestline) > 65536:
|
||||||
|
self.requestline = ''
|
||||||
|
self.request_version = ''
|
||||||
|
self.command = ''
|
||||||
|
self.send_error(414)
|
||||||
|
return
|
||||||
|
if not self.raw_requestline:
|
||||||
|
self.close_connection = 1
|
||||||
|
return
|
||||||
|
if not self.parse_request():
|
||||||
|
# An error code has been sent, just exit
|
||||||
|
return
|
||||||
|
mname = 'do_' + self.command
|
||||||
|
if not hasattr(self, mname):
|
||||||
|
self.send_error(501, "Unsupported method (%r)" % self.command)
|
||||||
|
return
|
||||||
|
method = getattr(self, mname)
|
||||||
|
method()
|
||||||
|
self.wfile.flush() #actually send the response if not already done.
|
||||||
|
except Exception as e:
|
||||||
|
#a read or a write timed out. Discard this connection
|
||||||
|
self.log_error("Request timed out: %r", e)
|
||||||
|
self.close_connection = 1
|
||||||
|
return
|
||||||
|
|
||||||
def handle(self):
|
def handle(self):
|
||||||
self._init_buffer()
|
"""Handle multiple requests if necessary."""
|
||||||
|
self.close_connection = 1
|
||||||
|
|
||||||
|
self.handle_one_request()
|
||||||
|
while not self.close_connection:
|
||||||
|
self.handle_one_request()
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue