mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-03-11 00:15:16 +00:00
Update server.py
This commit is contained in:
parent
7e17fb7fe6
commit
288ae6b883
14
server.py
14
server.py
|
@ -192,7 +192,19 @@ def proxy_server(webserver, port, scheme, method, url, conn, addr, data):
|
|||
except Exception as e:
|
||||
raise Exception("SSL negotiation failed. (%s:%s) %s" % (webserver.decode(client_encoding), str(port), str(e)))
|
||||
|
||||
# check request data
|
||||
# Wait to see if there is more data to transmit
|
||||
if len(data) == buffer_size:
|
||||
conn.settimeout(5)
|
||||
while True:
|
||||
try:
|
||||
chunk = conn.recv(buffer_size)
|
||||
if not chunk:
|
||||
break
|
||||
data += chunk
|
||||
except:
|
||||
break
|
||||
|
||||
# check requested data
|
||||
if proxy_check_filtered(data, webserver, port, scheme, method, url):
|
||||
conn.sendall(b"HTTP/1.1 403 Forbidden\n\n{\"status\":403}")
|
||||
conn.close()
|
||||
|
|
Loading…
Reference in New Issue
Block a user