mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Revert "Set timeout for client socket (slow client DoS)."
This changes introduced an issue with websockets support (#432) and is probably related to #428 & #416 . It is safer for now to revert it. This reverts commit aa22115cfc9c2b76c818ce231089b01c690052b6. Conflicts: gunicorn/workers/async.py gunicorn/workers/sync.py
This commit is contained in:
parent
daa04fc931
commit
bb9ddb4ca9
@ -29,7 +29,6 @@ class AsyncWorker(base.Worker):
|
|||||||
def handle(self, client, addr):
|
def handle(self, client, addr):
|
||||||
req = None
|
req = None
|
||||||
try:
|
try:
|
||||||
client.settimeout(self.cfg.timeout)
|
|
||||||
parser = http.RequestParser(self.cfg, client)
|
parser = http.RequestParser(self.cfg, client)
|
||||||
try:
|
try:
|
||||||
if not self.cfg.keepalive:
|
if not self.cfg.keepalive:
|
||||||
@ -48,12 +47,8 @@ class AsyncWorker(base.Worker):
|
|||||||
self.log.debug("Ignored premature client disconnection. %s", e)
|
self.log.debug("Ignored premature client disconnection. %s", e)
|
||||||
except StopIteration as e:
|
except StopIteration as e:
|
||||||
self.log.debug("Closing connection. %s", e)
|
self.log.debug("Closing connection. %s", e)
|
||||||
except socket.error:
|
|
||||||
raise # pass to next try-except level
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.handle_error(req, client, addr, e)
|
self.handle_error(req, client, addr, e)
|
||||||
except socket.timeout as e:
|
|
||||||
self.handle_error(req, client, addr, e)
|
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
if e.args[0] not in (errno.EPIPE, errno.ECONNRESET):
|
if e.args[0] not in (errno.EPIPE, errno.ECONNRESET):
|
||||||
self.log.exception("Socket error processing request.")
|
self.log.exception("Socket error processing request.")
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import os
|
|||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import socket
|
|
||||||
|
|
||||||
|
|
||||||
from gunicorn import util
|
from gunicorn import util
|
||||||
@ -165,10 +164,6 @@ class Worker(object):
|
|||||||
error=str(exc),
|
error=str(exc),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif isinstance(exc, socket.timeout):
|
|
||||||
status_int = 408
|
|
||||||
reason = "Request Timeout"
|
|
||||||
mesg = "<p>The server timed out handling for the request</p>"
|
|
||||||
else:
|
else:
|
||||||
self.log.exception("Error handling request")
|
self.log.exception("Error handling request")
|
||||||
|
|
||||||
|
|||||||
@ -68,7 +68,6 @@ class SyncWorker(base.Worker):
|
|||||||
def handle(self, client, addr):
|
def handle(self, client, addr):
|
||||||
req = None
|
req = None
|
||||||
try:
|
try:
|
||||||
client.settimeout(self.cfg.timeout)
|
|
||||||
parser = http.RequestParser(self.cfg, client)
|
parser = http.RequestParser(self.cfg, client)
|
||||||
req = six.next(parser)
|
req = six.next(parser)
|
||||||
self.handle_request(req, client, addr)
|
self.handle_request(req, client, addr)
|
||||||
@ -76,8 +75,6 @@ class SyncWorker(base.Worker):
|
|||||||
self.log.debug("Ignored premature client disconnection. %s", e)
|
self.log.debug("Ignored premature client disconnection. %s", e)
|
||||||
except StopIteration as e:
|
except StopIteration as e:
|
||||||
self.log.debug("Closing connection. %s", e)
|
self.log.debug("Closing connection. %s", e)
|
||||||
except socket.timeout as e:
|
|
||||||
self.handle_error(req, client, addr, e)
|
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
if e.args[0] != errno.EPIPE:
|
if e.args[0] != errno.EPIPE:
|
||||||
self.log.exception("Error processing request.")
|
self.log.exception("Error processing request.")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user