tayfunulu / WiFiManager

WiFi manager for ESP8266 - ESP12 - ESP32 - micropython
MIT License
345 stars 104 forks source link

Can't find parameters in Safari on OSX #9

Open jhoughjr opened 6 years ago

jhoughjr commented 6 years ago

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.

quarterturn commented 5 years ago

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

tikky commented 4 years ago

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

rftestman1 commented 4 years ago

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.

ColinNg commented 3 years ago

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))
ebolisa commented 3 years ago

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", "@")
ColinNg commented 3 years ago

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

DanielBustillos commented 2 years ago

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?

ColinNg commented 2 years ago

@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.

DanielBustillos commented 2 years ago

@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.