Created by: nutsiepully
Currently the code in asyncHttpServer works as follows.
- It uses pattern.matches() to verify whether a match has been found in the URL. This needs to match the entire string else the match doesn't succeed.
- To extract the path, the directory function replaces the entire match with "".
So for example, if I need to match URLs with the pattern "/files/.*", the match succeeds, but the replaceAll("") converts the entire match to "". Thus for "/files/myfile", the path ends up as "" and doesn't work. If I simply use "/files/", the pattern.matches() fails since it'd doesn't match the entire string.
I have modified the code to do the following - Pattern matches the entire string but detects the path as the substring after the first group.
So "(/files/).*" matches "/files/myfile", but replaces it with "myfile".
Please let me know if this seems right. Thanks a lot for the great library.