]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: WPS ER and HTTP client timeout
authorJouni Malinen <j@w1.fi>
Sun, 28 Mar 2021 15:05:47 +0000 (18:05 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 28 Mar 2021 15:05:47 +0000 (18:05 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_wps.py

index 08be5f41f230c082d7556f6441d98cf2c7a56dfa..2120e503ecd6116cfda4a9777f882759a8b6d577 100644 (file)
@@ -4358,10 +4358,12 @@ def wps_er_stop(dev, sock, server, on_alloc_fail=False):
             raise Exception("No WPS-ER-AP-REMOVE event on max-age timeout")
     dev.request("WPS_ER_STOP")
 
-def run_wps_er_proto_test(dev, handler, no_event_url=False, location_url=None):
+def run_wps_er_proto_test(dev, handler, no_event_url=False, location_url=None,
+                          max_age=1):
     try:
         uuid = '27ea801a-9e5c-4e73-bd82-f89cbcd10d7e'
-        server, sock = wps_er_start(dev, handler, location_url=location_url)
+        server, sock = wps_er_start(dev, handler, location_url=location_url,
+                                    max_age=max_age)
         global wps_event_url
         wps_event_url = None
         server.handle_request()
@@ -5105,6 +5107,15 @@ def test_ap_wps_er_http_client(dev, apdev):
     run_wps_er_proto_test(dev[0], WPSAPHTTPServer_req_as_resp,
                           no_event_url=True)
 
+def test_ap_wps_er_http_client_timeout(dev, apdev):
+    """WPS ER and HTTP client timeout"""
+    class WPSAPHTTPServer_timeout(WPSAPHTTPServer):
+        def handle_upnp_info(self):
+            time.sleep(31)
+            self.wfile.write(b"GET / HTTP/1.1\r\n\r\n")
+    run_wps_er_proto_test(dev[0], WPSAPHTTPServer_timeout,
+                          no_event_url=True, max_age=60)
+
 def test_ap_wps_init_oom(dev, apdev):
     """wps_init OOM cases"""
     ssid = "test-wps"