khoih-prog/WiFiWebServer

Decoding Error. two times called urlDecode in Parsing-impl.h.

RQnet opened this issue · 3 comments

RQnet commented

Describe the bug

if i use password with special charakters like "%&*%25%26" with WiFiManager_NINA_lite V1.6.1 the decoding of this password is wrong. I got just "%". I use "GET" with urlDecoded value request.

Steps to Reproduce

just send this password %&*%25%26 with WiFiManager_NINA_lite

Problem

urlDecode(.....) is called two times.
first in _parseRequest() -> urlDecode(...)
second in _parseRequest() -> _parseArguments(...) -> (void)_parseArgumentsPrivate(data, storeArgHandler()); -> urlDecode(...)

the first call is decoding and the second decoding is trimming at the "&".

Solution

replace this line
searchStr = urlDecode(url.substring(hasSearch + 1));

with that line
searchStr = url.substring(hasSearch + 1);

problem

solution

Hi @RQnet

Thanks for your bug report and very detailed investigative information. I wish any bug report will be as good as this one from you.

I definitely will fix this hard-to-find bug, with a note for your contribution. If you have some more time, please help by doing some more tests to see if there are anymore bug relating to this duplicated use of urlDecode().

Regards,


PS:

You can also create a PR. If you're not familiar now, it's good time to start and be a PR master.
Some unimportant note: it's better to post the code and terminal output in code tag, not picture.

I'm glad to see you've been moving forward quite fast from recent posts. Successfully debugging, which requires you read and understand the library code, will definitely help you a lot in the future.

Hi @RQnet

The new WiFiWebServer releases v1.6.3 has just been published. Your contribution is noted in Contributions and Thanks

Best Regards,


Releases v1.6.3

  1. Fix decoding error bug when using special & in data fields. Check Decoding Error. two times called urlDecode in Parsing-impl.h. #17
  2. Update Packages' Patches
RQnet commented

Hi @khoih-prog,
its my first time in microcontroller progrmming. so i needed a little bit of time to get knowledge. but i could get a good understand your clean coded implementation. thanks for fixing the bug and your really good work in your libraries. they are very helpfull!
Best Regards