If url is relative, use session.url (...) to get valid url.

It could happen with relative url in `Location: ...` header (for redirection).
This commit is contained in:
Jocelyn Fiat
2017-09-21 10:45:08 +02:00
parent 6425482070
commit 20a90db2e3
2 changed files with 6 additions and 1 deletions

View File

@@ -31,7 +31,11 @@ feature {NONE} -- Initialization
-- This can be used to reset/reinitialize Current with new url -- This can be used to reset/reinitialize Current with new url
-- in the case of redirection. -- in the case of redirection.
do do
if a_url.starts_with ("http://") or a_url.starts_with ("http://") then
url := a_url url := a_url
else
url := session.url (a_url, Void)
end
headers := session.headers.twin headers := session.headers.twin
if ctx /= Void then if ctx /= Void then
context := ctx context := ctx

View File

@@ -113,6 +113,7 @@ feature -- Access
-- Get URL data -- Get URL data
l_is_https := url.starts_with_general ("https://") l_is_https := url.starts_with_general ("https://")
create l_uri.make_from_string (url) create l_uri.make_from_string (url)
check valid_url: l_uri.is_valid end
l_port := l_uri.port l_port := l_uri.port
if l_port = 0 then if l_port = 0 then
if l_is_https then if l_is_https then