Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parsing of URLs containing IPv6 addresses
That includes the front-end accepting things like ``[::1]`` and the injector accepting URLs like ``http://[2001:db8::1]:8080/foo/bar``.
- Loading branch information
Showing
2 changed files
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ static ostream& operator<<(ostream& os, const ClientFrontEnd::Task& task) { | |
static | ||
string path_from_url(const string& url) { | ||
// This is not a bullet-proof URL parser, it just gets some common cases here. | ||
static const boost::regex urlrx("^(?:http://[-\\.a-z0-9]+)?(/[^?#]*).*"); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ivilata
Author
Collaborator
|
||
static const boost::regex urlrx("^(?:http://[-\\.:\\[\\]a-z0-9]+)?(/[^?#]*).*"); | ||
boost::smatch url_match; | ||
boost::regex_match(url, url_match, urlrx); | ||
return url_match[1]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ivilata could you try
std::regex
instead whenever you'll be writing new regex code?