From 8e92966aec31193b2c10dec046b2ea5774661963 Mon Sep 17 00:00:00 2001 From: Colin Ng Date: Tue, 22 Sep 2020 03:43:34 -0700 Subject: [PATCH] Fix parameters in Safari on macOS and iOS by reading the form data which appears after `\r\n\r\n` (HTTP POST data was verified with WireShark). --- wifimgr.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wifimgr.py b/wifimgr.py index a697655..e00e13b 100644 --- a/wifimgr.py +++ b/wifimgr.py @@ -289,6 +289,13 @@ def start(port=80): except OSError: pass + # Handle form data from Safari on macOS and iOS; it sends \r\n\r\nssid=&password= + try: + request += client.recv(512) + print("Received form data after \\r\\n\\r\\n(i.e. from Safari on macOS or iOS)") + except OSError: + pass + print("Request is: {}".format(request)) if "HTTP" not in request: # skip invalid requests continue