Commit 8db2ea57 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

http: parse redirection correctly

parent 833d3e97
...@@ -202,7 +202,9 @@ static int Open(vlc_object_t *obj) ...@@ -202,7 +202,9 @@ static int Open(vlc_object_t *obj)
free(redir); free(redir);
redir = fixed; redir = fixed;
} }
access->psz_url = redir;
access->psz_url = vlc_uri_resolve(access->psz_url, redir);
free(redir);
ret = VLC_ACCESS_REDIRECT; ret = VLC_ACCESS_REDIRECT;
goto error; goto error;
} }
......
...@@ -278,18 +278,6 @@ char *vlc_http_res_get_redirect(struct vlc_http_resource *restrict res) ...@@ -278,18 +278,6 @@ char *vlc_http_res_get_redirect(struct vlc_http_resource *restrict res)
/* NOTE: The anchor is discard if it is present as VLC does not support /* NOTE: The anchor is discard if it is present as VLC does not support
* HTML anchors so far. */ * HTML anchors so far. */
size_t len = strcspn(location, "#"); size_t len = strcspn(location, "#");
/* FIXME: resolve relative URL _correctly_ */
if (location[0] == '/')
{
char *url;
if (unlikely(asprintf(&url, "%s://%s%.*s",
res->secure ? "https" : "http", res->authority,
(int)len, location) < 0))
return NULL;
return url;
}
return strndup(location, len); return strndup(location, len);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment