diff options
author | cboesch <cboesch@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-11-21 16:52:22 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-12-16 04:27:56 +0200 |
commit | 9bf59a1fcb6de3fed117accaec60b6b0eaece17d (patch) | |
tree | 8314a84618eb3501d6515d3fc615460364127b72 /stream/url.c | |
parent | 5e6c4de69e157301204a543b108b40d513983e3e (diff) | |
download | mpv-9bf59a1fcb6de3fed117accaec60b6b0eaece17d.tar.bz2 mpv-9bf59a1fcb6de3fed117accaec60b6b0eaece17d.tar.xz |
stream/http: Do not keep authentication in URL when proxied
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32640 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/url.c')
-rw-r--r-- | stream/url.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/stream/url.c b/stream/url.c index 0d64382e2f..92ea058831 100644 --- a/stream/url.c +++ b/stream/url.c @@ -57,9 +57,19 @@ URL_t *url_redirect(URL_t **url, const char *redir) { return res; } +static int make_noauth_url(URL_t *url, char *dst, int dst_size) +{ + if (url->port) + return snprintf(dst, dst_size, "%s://%s:%d%s", url->protocol, + url->hostname, url->port, url->file); + else + return snprintf(dst, dst_size, "%s://%s%s", url->protocol, + url->hostname, url->file); +} + URL_t* url_new(const char* url) { - int pos1, pos2,v6addr = 0; + int pos1, pos2,v6addr = 0, noauth_len; URL_t* Curl = NULL; char *escfilename=NULL; char *ptr1=NULL, *ptr2=NULL, *ptr3=NULL, *ptr4=NULL; @@ -231,6 +241,17 @@ url_new(const char* url) { strcpy(Curl->file, "/"); } + noauth_len = make_noauth_url(Curl, NULL, 0); + if (noauth_len > 0) { + noauth_len++; + Curl->noauth_url = malloc(noauth_len); + if (!Curl->noauth_url) { + mp_msg(MSGT_NETWORK, MSGL_FATAL, "Memory allocation failed.\n"); + goto err_out; + } + make_noauth_url(Curl, Curl->noauth_url, noauth_len); + } + free(escfilename); return Curl; err_out: |