summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorRudolf Polzer <divverent@xonotic.org>2013-01-10 14:11:26 +0100
committerRudolf Polzer <divverent@xonotic.org>2013-01-10 14:11:26 +0100
commit944be9d24bbf748ce65feda44e8df75fd1950bc6 (patch)
tree0ebd2d3cc656820f089aef32b7cbd8127340f0d6 /stream
parent7c40d8a36ef48ca7216e3d8f4eddf19e70d419e5 (diff)
downloadmpv-944be9d24bbf748ce65feda44e8df75fd1950bc6.tar.bz2
mpv-944be9d24bbf748ce65feda44e8df75fd1950bc6.tar.xz
Fix lots of bugs in mp_http URL handling
Many instances of "http" were not changed to "mp_http", which made many aspects of the mp_http protocol handler broken.
Diffstat (limited to 'stream')
-rw-r--r--stream/network.c11
-rw-r--r--stream/url.c6
2 files changed, 10 insertions, 7 deletions
diff --git a/stream/network.c b/stream/network.c
index 56e5a1b5e1..d48444faa6 100644
--- a/stream/network.c
+++ b/stream/network.c
@@ -110,12 +110,12 @@ check4proxies( const URL_t *url ) {
URL_t *url_out = NULL;
if( url==NULL ) return NULL;
url_out = url_new( url->url );
- if( !strcasecmp(url->protocol, "http_proxy") ) {
+ if( !strcasecmp(url->protocol, "mp_http_proxy") ) {
mp_msg(MSGT_NETWORK,MSGL_V,"Using HTTP proxy: http://%s:%d\n", url->hostname, url->port );
return url_out;
}
// Check if the http_proxy environment variable is set.
- if( !strcasecmp(url->protocol, "http") ) {
+ if( !strcasecmp(url->protocol, "mp_http") ) {
char *proxy;
proxy = getenv("http_proxy");
if( proxy!=NULL ) {
@@ -180,9 +180,12 @@ http_send_request( URL_t *url, int64_t pos ) {
http_hdr = http_new_header();
- if( !strcasecmp(url->protocol, "http_proxy") ) {
+ if( !strcasecmp(url->protocol, "mp_http_proxy") ) {
proxy = 1;
- server_url = url_new( (url->file)+1 );
+ if (!strncasecmp(url->file, "/mp_", 3))
+ server_url = url_new( (url->file)+4 );
+ else
+ server_url = url_new( (url->file)+1 );
if (!server_url) {
mp_msg(MSGT_NETWORK, MSGL_ERR, "Invalid URL '%s' to proxify\n", url->file+1);
goto err_out;
diff --git a/stream/url.c b/stream/url.c
index 7919a356f1..70d2db4ea5 100644
--- a/stream/url.c
+++ b/stream/url.c
@@ -61,7 +61,7 @@ end:
}
static int is_proxy(const URL_t *url) {
- return !strcasecmp(url->protocol, "http_proxy") && url->file && strstr(url->file, "://");
+ return !strcasecmp(url->protocol, "mp_http_proxy") && url->file && strstr(url->file, "://");
}
int url_is_protocol(const URL_t *url, const char *proto) {
@@ -137,12 +137,12 @@ static char *get_noauth_url(const URL_t *url)
char *get_http_proxy_url(const URL_t *proxy, const char *host_url)
{
if (proxy->username)
- return mp_asprintf("http_proxy://%s:%s@%s:%d/%s",
+ return mp_asprintf("mp_http_proxy://%s:%s@%s:%d/%s",
proxy->username,
proxy->password ? proxy->password : "",
proxy->hostname, proxy->port, host_url);
else
- return mp_asprintf("http_proxy://%s:%d/%s",
+ return mp_asprintf("mp_http_proxy://%s:%d/%s",
proxy->hostname, proxy->port, host_url);
}