Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enduser_setup not working #2847

Closed
HHHartmann opened this issue Jul 23, 2019 · 5 comments
Closed

enduser_setup not working #2847

HHHartmann opened this issue Jul 23, 2019 · 5 comments
Assignees
Labels

Comments

@HHHartmann
Copy link
Member

Expected behavior

the POST /setwifi call shpould parse the params

Actual behavior

  1. The end of the wifi_password param is searched to be & or space. In the post it is not anymore but the end of the message
  2. if the headers and body are fragmented in several packets only the first one is analyzed and thus data is incomplete. This applies to the GET request as well but likely will nerver hit there.
    At least fiddler (a windows web analyzer tool) does send headers and body in two packets.

(1.) works well on params in the URL as used in the GET request. They are terminated by '&' or 'space'

GET /url?wifi_ssid=ssid&wifi_password=pass HTTP/1.1

The new POST locks loke this:

POST http://aaa.com/setwifi HTTP/1.1
Host: aaa.com
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Content-Length: 30

wifi_ssid=xxx&wifi_password=aa

So the wifi_password is terminated by the end of data here.

Test code

compile with

#define ENDUSER_SETUP_DEBUG_ENABLE 1
#define ENDUSER_SETUP_DEBUG_SHOW_HTTP_REQUEST 1

Example from the documentation

enduser_setup.start(
  function()
    print("Connected to WiFi as:" .. wifi.sta.getip())
  end,
  function(err, str)
    print("enduser_setup: Err #" .. err .. ": " .. str)
  end,
  print -- Lua print function can serve as the debug callback
)

NodeMCU version

Current dev build with the brand new enduser_setup

Hardware

ESP8266 dev board

@HHHartmann HHHartmann added the bug label Jul 23, 2019
@d-rez
Copy link

d-rez commented Jul 24, 2019

Looking at source this is by design as the code is only handling GET:

https://github.com/nodemcu/nodemcu-firmware/blob/master/app/modules/enduser_setup.c#L947

EDIT: Nevermind, wrong branch

@HHHartmann
Copy link
Member Author

Have a look on dev. It's a new design now.

@HHHartmann HHHartmann added this to the Next release milestone Jul 24, 2019
@HHHartmann HHHartmann self-assigned this Jul 24, 2019
@HHHartmann
Copy link
Member Author

Will fix 1. but the fragmentation part is above my C skills.

@marcelstoer
Copy link
Member

Interesting. Looks like my browser didn't fragment the packets then.

@HHHartmann
Copy link
Member Author

The missing part of this bug is covered in detail in #2931. So closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants