Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Unified Diff: Lib/test/test_socketserver.py

Issue 26309: socketserver.BaseServer._handle_request_noblock() don't shutdwon request if verify_request is False
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/socketserver.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_socketserver.py Mon Feb 08 17:57:22 2016 +0200
+++ b/Lib/test/test_socketserver.py Mon Feb 15 18:21:34 2016 +0200
@@ -280,6 +280,30 @@
socketserver.TCPServer((HOST, -1),
socketserver.StreamRequestHandler)
+ def test_shutdown_request_called_if_verify_request_false(self):
+ # Issue #26309: BaseServer should call shutdown_request even if
+ # verify_request is False
+ shutdown_called = False
+
+ class MyServer(socketserver.TCPServer):
+ def verify_request(self, request, client_address):
+ return False
+
+ def shutdown_request(self, request):
+ nonlocal shutdown_called
+ shutdown_called = True
+ super().shutdown_request(request)
+
+ def connect_to_server(proto, addr):
+ s = socket.socket(proto, socket.SOCK_STREAM)
+ s.connect(addr)
+ s.close()
+
+ self.run_server(MyServer,
+ socketserver.StreamRequestHandler,
+ connect_to_server)
+ self.assertEqual(shutdown_called, True)
+
class MiscTestCase(unittest.TestCase):
« no previous file with comments | « Lib/socketserver.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+