Yes, you don't need to normalize such URLs.

Svyatoslav <notifications@github.com> wrote:
>> +            const int hostNameLength =  hostPosition.second -
>hostPosition.first;
>> +            return url.substr(hostPosition.first, hostNameLength);
>> +        }
>> +
>> +        std::string resourceFromUrl(const std::string &url)
>> +        {
>> +            const std::pair<int, int> hostPosition =
>getHostPosition(url);
>> +            return url.substr(hostPosition.second);
>> +        }
>> +
>> +        std::string normalizeUrl(std::string url)
>> +        {
>> +            std::regex hasProtocol(".*://.*");
>> +            if (!std::regex_match(url, hasProtocol))
>> +                url = "http://" + url;
>> +            std::regex hasSlashAfterHost(".*://.*/.*");
>
>>and you don't need the third one at all
>
><code>.+://.+/</code> doesn't match
><code>http://www.example.com/resource.php</code>, for example, but as
>far as i understand, this url should not be modified
>
>---
>Reply to this email directly or view it on GitHub:
>https://github.com/4d6178/academy-oauth/pull/12/files#r5525829

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.