koush/AndroidAsync — pull request #264 by nutsiepully (2014-10-18 19:19:49+00:00)
Title: asyncHttpServer.directory fix. replaceAll replaces the entire url pattern.

Currently the code in asyncHttpServer works as follows.
1. 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.
2. 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.