WiFiManager icon indicating copy to clipboard operation
WiFiManager copied to clipboard

Can't find parameters in Safari on OSX

Open jhoughjr opened this issue 6 years ago • 9 comments

I suspect its the regex, but idk. it does find the params in chrome but then can't find my AP name, possibly due to spaces being replaced with pluses.

jhoughjr avatar May 15 '18 22:05 jhoughjr

Confirmed on OSX Safari. Entering an SSID and password then configure button leads to a connection reset on /configure. Refreshing the page returns "Parameters not found"

Checking the ESP8266 filesystem shows there is no .ini file created.

Safari Version 12.0 (13606.2.11) on OSX 10.13.6 Micropython Version esp8266-20180511-v1.9.4

Works fine with Firefox 62.0.3

quarterturn avatar Oct 09 '18 14:10 quarterturn

I've got the same issue with ESP32. I can see WiFi network and connect to it. Then I can browse from iPhone Safari to 192.168.4.1, but when I want to save password I am receiving "Parameters not found"

On Android phone work as expected

tikky avatar Jan 15 '20 11:01 tikky

Has this issue been resolved? I cannot set wifi SSID and PW using any browser in iOS. I get the same 'Parameters not found error' as above.

rftestman1 avatar Apr 10 '20 22:04 rftestman1

This is because Safari sends the data in the Request Body, i.e. after the \r\n\r\n that the code uses to detect the end of the sequence. I have gotten it working but there is more testing to do. In the meantime, this should fix it for you:

After this block (i.e. lines 286-290):

            try:
                while "\r\n\r\n" not in request:
                    request += client.recv(512)
            except OSError:
                pass

Add this block (i.e. starting line 291):

            # Handle form data from Safari on macOS and iOS; it sends \r\n\r\nssid=<ssid>&password=<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

before the original code continues:

            print("Request is: {}".format(request))

ColinNg avatar Sep 22 '20 10:09 ColinNg

How about solving special characters like ¡, @, ö, etc which get encoded like %40 for @? I solved temporarly the issue with the code below. I've not tried ure.encoding = 'utg-8' yet.

ssid = match.group(1).decode("utf-8").replace("%3F", "?").replace("%21", "!").replace("%40", "@")
password = match.group(2).decode("utf-8").replace("%3F", "?").replace("%21", "!").replace("%40", "@")

ebolisa avatar Sep 22 '20 11:09 ebolisa

How about solving special characters like ¡, @, ö, etc which get encoded like %40 for @? I solved temporarly the issue with the code below. I've not tried ure.encoding = 'utg-8' yet.

ssid = match.group(1).decode("utf-8").replace("%3F", "?").replace("%21", "!").replace("%40", "@")
password = match.group(2).decode("utf-8").replace("%3F", "?").replace("%21", "!").replace("%40", "@")

Sorry, that's an altogether separate issue, https://github.com/tayfunulu/WiFiManager/issues/8

ColinNg avatar Sep 22 '20 13:09 ColinNg

This is because Safari sends the data in the Request Body, i.e. after the \r\n\r\n that the code uses to detect the end of the sequence. I have gotten it working but there is more testing to do. In the meantime, this should fix it for you:

After this block (i.e. lines 286-290):

            try:
                while "\r\n\r\n" not in request:
                    request += client.recv(512)
            except OSError:
                pass

Add this block (i.e. starting line 291):

            # Handle form data from Safari on macOS and iOS; it sends \r\n\r\nssid=<ssid>&password=<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

before the original code continues:

            print("Request is: {}".format(request))

This did not work for me, yet. The request includes only the first 7 characters of the password.

Any suggestion?

DanielBustillos avatar May 24 '22 06:05 DanielBustillos

@DanielBustillos Is the 8th character a space, or special character? There seems to be bugs with spaces in SSIDs, so maybe there are bugs with spaces in passwords.

ColinNg avatar May 24 '22 16:05 ColinNg

@DanielBustillos Is the 8th character a space, or special character? There seems to be bugs with spaces in SSIDs, so maybe there are bugs with spaces in passwords.

It. is not, but I was pasting an invisible non utf8 character. Everything is working.

DanielBustillos avatar May 25 '22 01:05 DanielBustillos