[MPlayer-dev-eng] [PATCH 3/7] Use authorization field to pass server authentication through proxy
Clément Bœsch
ubitux at gmail.com
Mon Oct 18 12:05:53 CEST 2010
Currently, http_proxy:// does not forward server auth correcly, here is
a fix.
---
stream/network.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/stream/network.c b/stream/network.c
index 9f81609..1ec1220 100644
--- a/stream/network.c
+++ b/stream/network.c
@@ -209,7 +209,11 @@ http_send_request( URL_t *url, off_t pos ) {
mp_msg(MSGT_NETWORK, MSGL_ERR, "Invalid URL '%s' to proxify\n", url->file+1);
goto err_out;
}
- http_set_uri( http_hdr, server_url->url );
+ snprintf(str, 256, "http://%s:%d%s",
+ server_url->hostname,
+ server_url->port ? server_url->port : 80,
+ server_url->file);
+ http_set_uri( http_hdr, str );
} else {
server_url = url;
http_set_uri( http_hdr, server_url->file );
@@ -254,10 +258,13 @@ http_send_request( URL_t *url, off_t pos ) {
if (network_cookies_enabled) cookies_set( http_hdr, server_url->hostname, server_url->url );
http_set_field( http_hdr, "Connection: close");
- if (proxy)
+ if (proxy) {
http_add_basic_proxy_authentication( http_hdr, url->username, url->password );
- else
+ if (server_url->username && server_url->password)
+ http_add_basic_authentication( http_hdr, server_url->username, server_url->password );
+ } else {
http_add_basic_authentication( http_hdr, url->username, url->password );
+ }
if( http_build_request( http_hdr )==NULL ) {
goto err_out;
}
--
1.7.3.1
More information about the MPlayer-dev-eng
mailing list