-
Notifications
You must be signed in to change notification settings - Fork 13.3k
fix parseArgument #5230
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
fix parseArgument #5230
Conversation
@d-a-v recursive calls are hard to understand at a glance, and they're dangerous on a stack-constrained platform like ours. |
Looks great from the tests, with one minor niggle. The last check:
(I'm assuming "url" should be "string after 1st "?") For, say " |
@earlephilhower True. I made copy paste of some previous result. fixed in OP. @devyte Recursion is only one level: the number of inner call is really 1 and does not depend on the request itself. For clarity I removed this call. Still not using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the check on the null-param case. LGTM!
@ascillato @andrethomas @reloxx13 I assume you have made tests with alexa ? |
With this PR Alexa bug is stills there. Sorry. With the PR I proposed, Alexa was working. I'm checking your code and it should work but I don't know why it doesn't. It needs something extra for the parameters? Testing using Sonoff-Tasmota. |
@ascillato Arduino/libraries/ESP8266WebServer/src/Parsing.cpp Lines 198 to 203 in db0cd7d
alexa does not or does send a FALSE encoding, leading to skip the parsing. in my pr there is a check if their are args found |
So, as any of the 2 options solves the Alexa Bug, can be added to your PR any of those approaches ? |
@ascillato Thanks for your two tests and your links in #5222. |
Hi If I just change in the last actual core only the line 198 from parsing.cpp to
Alexa works! I don't know what is happening with the rest of the parsing you have added that this line stop working. |
key_end_pos--; dont count down here, it will cut of every key by -1 ("save" will be "sav") (substring (end = up to, but not including, so no need to -1) Parsing cpp L329 arg.value = urlDecode(data.substring(equal_index + 1, next_index - 1)); => -1 is too less for substring (substring (end = up to, but not including, so no need to -1)
latest switch hue on with alexa log
|
its too late, good night ;p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As disccussed, please update per this gist:
https://gist.github.com/devyte/0e51bc55557af5a3b56bfb040515db08
fix pos substrings
@devyte I'll open an issue for your proposal. This PR was itself a pain to fix (no alexa around, me not used to http request world, difficulties to test, lots of cases and no emulated environment (yet :) to speed tests up). It should be part of a general cleaning pass. @ alexa users, please tell me this is working (= I was working with good fake requests with AdvancedWebserver example). special thanks to @reloxx13 who made a PR (merged) in my branch to fix a nasty parsing bugs I was not seeing in my original commit (the bug was in my testing process, mainly, so we need that emulated enviroment fully working #1715). |
just tested latest commit on https://github.com/d-a-v/Arduino/tree/parserequest and works for me with alexa and web saves/posts log:
|
Hi, I found that there is a memory leak using this PR. If I use the Core at the commit c8497da the core works fine. No issues. If I add this PR to that commit, In few minutes all RAM goes to zero and the device reboots. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, review where is the memory leak.
Tested using request http://192.168.1.32/in?
Very Nice work! Bug solved. All working. 👍 Please, merge this PR. |
Tested using Sonoff-Tasmota for several hours and no issue. The actual core with this PR is working really good and fast. No memory leak, no reboots, no disconnections, no exceptions, sleep works, OTA URL works, and Alexa works. Hope this got merged soon as to have a reference commit of a very stable version. |
@d-a-v Great Job :-) !! Please do a Merge very very soon to Master to have a reference commit of a very well done stable Version. T H X for your great work |
Great work @d-a-v I get the same result as @Jason2866 Everything seems to be working as it should. Can we please get this PR merged so that we can continue to use this as a staged core for Tasmota development binaries. Much appreciated, THX! |
Closing in favor of #5252 . |
edit
url: ''
args=1
arg(0): '' = ''
it is really:
(bad copy paste)