mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-29 19:08:44 +00:00
add test case for #375
This commit is contained in:
parent
d0809a210b
commit
d7341e7798
21
test/tools/passive_close.py
Normal file
21
test/tools/passive_close.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import SocketServer
|
||||||
|
from threading import Thread
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
class service(SocketServer.BaseRequestHandler):
|
||||||
|
def handle(self):
|
||||||
|
data = 'dummy'
|
||||||
|
print "Client connected with ", self.client_address
|
||||||
|
while True:
|
||||||
|
self.request.send("HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: 7\r\n\r\ncontent")
|
||||||
|
data = self.request.recv(1024)
|
||||||
|
if not len(data):
|
||||||
|
print "Connection closed by remote: ", self.client_address
|
||||||
|
sleep(3600)
|
||||||
|
|
||||||
|
|
||||||
|
class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
|
||||||
|
pass
|
||||||
|
|
||||||
|
server = ThreadedTCPServer(('',1520), service)
|
||||||
|
server.serve_forever()
|
Loading…
Reference in New Issue
Block a user