]> git.tdb.fi Git - libs/net.git/commitdiff
Allow the query part of a URL to be empty
authorMikko Rasa <tdb@tdb.fi>
Mon, 23 Sep 2019 11:42:04 +0000 (14:42 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 23 Sep 2019 11:42:04 +0000 (14:42 +0300)
This can happen when submitting an empty form with the GET method.

source/http/utils.cpp

index 41fabeff80cb83c83e1ffd430b328073a27e1eb0..e52309aae50aab02648a1f1278d6787027063e74 100644 (file)
@@ -79,7 +79,7 @@ string urldecode(const string &str)
 
 Url parse_url(const string &str)
 {
-       static Regex r_url("^(([a-z]+)://)?([a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(:[0-9]+)?)?(/[^?#]*)?(\\?([^#]+))?(#(.*))?$");
+       static Regex r_url("^(([a-z]+)://)?([a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(:[0-9]+)?)?(/[^?#]*)?(\\?([^#]*))?(#(.*))?$");
        if(RegMatch m = r_url.match(str))
        {
                Url url;