jiridanek commented on a change in pull request #1010: URL: https://github.com/apache/qpid-dispatch/pull/1010#discussion_r567472244
########## File path: tests/system_tests_http1_adaptor.py ########## @@ -1705,5 +1705,80 @@ def test_03_bad_response_message(self): self.assertEqual(1, count) +class CrashingHTTPTest(TestCase): + @classmethod + def setUpClass(cls): + super(CrashingHTTPTest, cls).setUpClass() + + cls.httpListener_port = cls.tester.get_port() + cls.httpConnector_port = cls.tester.get_port() + config = Qdrouterd.Config([ + ('router', {'mode': 'standalone', 'id': 'QDR'}), + ('listener', {'port': cls.tester.get_port(), 'role': 'normal', 'host': '0.0.0.0'}), + ('httpListener', { + 'port': str(cls.httpListener_port), + 'address': 'examples', + 'host': '127.0.0.1', + 'protocolVersion': 'HTTP1' + }), + ('httpConnector', { + 'port': str(cls.httpConnector_port), + 'address': 'examples', + 'host': '127.0.0.1', + 'protocolVersion': 'HTTP1', + 'name': 'http-server' + }) + ]) + + cls.router_qdr = cls.tester.qdrouterd("http-crash-router", config, wait=True) + + def test_crash_http1_01_weird_server(self): + client_request_to_router = ( + 0x00, 0x47, 0x45, 0x54, 0x20, 0x2f, 0x3f, 0x61, + 0x6d, 0x65, 0x70, 0x69, 0x66, 0x3d, 0x68, 0x6e, + 0x70, 0x6b, 0x6a, 0x67, 0x20, 0x48, 0x54, 0x54, + 0x50, 0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x58, + 0x2d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x4d, + 0x65, 0x3a, 0x20, 0x70, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x20, 0x40, 0x20, 0x73, 0x70, 0x61, 0x6d, + 0x62, 0x6f, 0x74, 0x5f, 0x69, 0x72, 0x63, 0x20, + 0x2b, 0x20, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, + 0x20, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x0d, 0x0a, + 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, + 0x6e, 0x74, 0x3a, 0x20, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x2d, 0x68, 0x74, 0x74, 0x70, 0x77, + 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x65, 0x20, 0x40, + 0x20, 0x73, 0x70, 0x61, 0x6d, 0x62, 0x6f, 0x74, + 0x5f, 0x69, 0x72, 0x63, 0x20, 0x2b, 0x20, 0x73, + 0x65, 0x6c, 0x65, 0x63, 0x74, 0x20, 0x75, 0x6e, + 0x69, 0x6f, 0x6e, 0x0d, 0x0a, 0x58, 0x2d, 0x57, + 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x65, 0x3a, 0x20, + 0x31, 0x34, 0x30, 0x30, 0x38, 0x36, 0x36, 0x37, + 0x35, 0x34, 0x38, 0x32, 0x30, 0x30, 0x30, 0x0d, + 0x0a, 0x48, 0x6f, 0x73, 0x74, 0x3a, 0x20, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, + 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x64, 0x6f, + 0x6d, 0x61, 0x69, 0x6e, 0x0d, 0x0a, 0x0d, 0x0a) + + s = socket.create_connection(('localhost', self.httpListener_port)) + s.send(bytes(client_request_to_router)) + s.close() + + server_reply_to_router = ( + 0x00, 0x00, 0x06, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64) + + a = socket.socket() + a.bind(('localhost', self.httpConnector_port)) + a.listen() Review comment: `listen()` without parameters is possible only since Python 3.5, Did not know that. https://docs.python.org/3/library/socket.html#socket.socket.listen ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org