-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Accept WebServer Query Arguments not containing an equals sign (and ALEXA issue) #5222
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
Conversation
Fixes several issues and also Alexa queries. Previous behavior was to completely ignore the argument (if not contains an equals sign), yet still include it in the argument count. (The use of "key=value" arguments is a convention, not an actual requirement in URLs.) For example, Amazon Echo sends a put-request with content-type "application/x-www-form-urlencoded" set in the headers but sends out json encoded data. _parseArguments fails to parse the arguments (which is correct) but completly discards the data. This change checks if the parser picked something up and if it didn't, it just adds it as plain data to the arguments.
Thanks for bringing this issue again and before 2.5.0, because the ESP deserves chats with humans. |
Hi The query http://xxxx/index.html?foo?bar is not used as far as I know. This PR is mainly to solve the old Alexa issue (look at the opening dates of the referred still open issues) If you want the library to also address that query, we can make another PR for that after this one. Now it is urged this fix for Alexa. Hope this will be merged ASAP because for Sonoff-Tasmota we are making this patch manually to give Alexa compatible precompiled bins for our users. The people that does not make this patch and use the core as it is right now, then they rise issues at Sonoff-Tasmota repository saying that Alexa does not work. This also happens for the other Tasmota alike softwares. With this Pull Request, we can solve this issue for all the softwares that uses this core and Alexa. Please, take this PR into account in order to solve these issues. Thanks. |
@d-a-v Tested @ascillato PR solved the Tasmota issue(s) |
After a discussion with @devyte and @earlephilhower, This PR being essentially a rewrite of #4151, let us some days to address the above request type. Quoting @earlephilhower:
|
Also, the reason the other two PRs are still open is that they had different solutions to the alexa bug, and it was not yet clear which of the two was cleaner. That is still pending. |
Just because I saw my name… :) In my opinion we need to
It should be able to handle things like http://invalid/folder/page.html?foo=baa&answer=42#fragment Everything else looks to me like vodoo and might be better solved by individual magic. |
The 3 opened PR that solves Alexa Bug (#4151, #4236, #4573) are aiming the same thing (Accept WebServer Query Arguments not containing an equals sign) The cleaner solution IMHO is 4151, that is why I added that to this PR since 4151 is rebased by the actual codebase. I agree with you all. I think that the library should handle & and ; as separators to be able to parse: http://xxxx/index.html?foo&bar&lol=&ness=&key=val;another=way;to;separate= But all that should be done in another PR. This PR aims just to allow the library to accept as input: With just that simple solution, Alexa bug is gone. Then we can make the library to accept the other parameters too. Please, take this PR into account in order to solve this issue for all the softwares that uses this core and Alexa.. Thanks. |
What do you think of #5230 ? |
Like a lot your approach! Please, use that to solve all these issues 👍 |
Looks good @d-a-v ;) |
The PR #5230 now solves also the parsing issue with Alexa. If 5230 is merged, this PR is no longer needed and can be closed. |
Closing in favor of #5252 . |
This PR fixes the following issues and also Alexa queries.
The actual codebase behavior is to completely ignore the argument (if not contains an equals sign), yet still include it in the argument count. (The use of "key=value" arguments is a convention, not an actual requirement in URLs.) This PR aims to fix that.
For example:
If you send
http://xxxx/index.html?foo=baa OR http://xxxx/index.html?foo=
You will get an
args()
result.If you send
http://xxxx/index.html?foo
the foo is lost, no
args()
, nothing.Another example:
Amazon Echo (Alexa) sends a put-request with content-type "application/x-www-form-urlencoded" set in the headers but sends out json encoded data.
_parseArguments
fails to parse the arguments (which is correct) but completly discards the data. This change checks if the parser picked something up and if it didn't, it just adds it as plain data to the arguments.Please, take this PR into account in order to solve these issues. Thanks.
@reloxx13, @holgerlembke, @jasonharper, @OFreddy, @Monarch73, @arendst, @andrethomas, @Jason2866, @d-a-v