summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-09-07 16:59:19 +0300
committerJouni Malinen <j@w1.fi>2015-09-07 16:59:19 +0300
commit18478107c2310ebf0672277984163cf244eec5b4 (patch)
tree8112bf69c727a2bb643089e8d80a221abc89d103 /tests
parenta302ee342cf259710157882abbc4d383cd728686 (diff)
downloadhostap-18478107c2310ebf0672277984163cf244eec5b4.tar.gz
tests: WPS ER and OOM in HTTP response generation
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_ap_wps.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py
index f05aaeaf0..01cb2bab3 100644
--- a/tests/hwsim/test_ap_wps.py
+++ b/tests/hwsim/test_ap_wps.py
@@ -3947,7 +3947,7 @@ def run_wps_er_proto_test(dev, handler, no_event_url=False, location_url=None):
finally:
dev.request("WPS_ER_STOP")
-def send_wlanevent(url, uuid, data):
+def send_wlanevent(url, uuid, data, no_response=False):
conn = httplib.HTTPConnection(url.netloc)
payload = '''<?xml version="1.0" encoding="utf-8"?>
<e:propertyset xmlns:e="urn:schemas-upnp-org:event-1-0">
@@ -3964,6 +3964,12 @@ def send_wlanevent(url, uuid, data):
"SEQ": "0",
"Content-Length": str(len(payload)) }
conn.request("NOTIFY", url.path, payload, headers)
+ if no_response:
+ try:
+ conn.getresponse()
+ except Exception, e:
+ pass
+ return
resp = conn.getresponse()
if resp.status != 200:
raise Exception("Unexpected HTTP response: %d" % resp.status)
@@ -4341,6 +4347,13 @@ RGV2aWNlIEEQSQAGADcqAAEg
with alloc_fail(dev[0], 1, func):
send_wlanevent(url, uuid, m1)
+ with alloc_fail(dev[0], 1, "wps_er_http_resp_ok"):
+ send_wlanevent(url, uuid, m1, no_response=True)
+
+ with alloc_fail(dev[0], 1, "wps_er_http_resp_not_found"):
+ url2 = urlparse.urlparse(wps_event_url.replace('/event/', '/notfound/'))
+ send_wlanevent(url2, uuid, m1, no_response=True)
+
def test_ap_wps_er_http_proto_no_event_sub_url(dev, apdev):
"""WPS ER HTTP protocol testing - no eventSubURL"""
class WPSAPHTTPServer_no_event_sub_url(WPSAPHTTPServer):