[MPlayer-users] Proxy authentication problem
Sam Mason
sam at samason.me.uk
Thu Nov 20 18:17:09 CET 2003
Sam Mason wrote:
>I guess you would need to change libmpdemux/network.c quite a bit to
>get it all working.
Scratch that; it's a pretty trivial change. . . Try the included
patch (against 1.0pre2, but may work against other versions).
My proxy doesn't need authentication, but it looks as though it's
sending the right stuff out onto the network.
Let me know how you get on,
Sam
-------------- next part --------------
--- MPlayer-1.0pre2/libmpdemux/network.c 2003-08-15 20:13:23.000000000 +0100
+++ MPlayer-hacked/libmpdemux/network.c 2003-11-20 16:59:46.000000000 +0000
@@ -403,12 +403,26 @@
mp_msg(MSGT_NETWORK,MSGL_V,"Using HTTP proxy: %s\n", proxy_url->url );
len = strlen( proxy_url->hostname ) + strlen( url->url ) + 20; // 20 = http_proxy:// + port
+
+ if(proxy_url->username)
+ {
+ len += strlen( proxy_url->username ) + 2;
+
+ if(proxy_url->password)
+ len += strlen( proxy_url->password );
+ }
+
new_url = malloc( len+1 );
if( new_url==NULL ) {
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed\n");
return url_out;
}
- sprintf(new_url, "http_proxy://%s:%d/%s", proxy_url->hostname, proxy_url->port, url->url );
+
+ if(proxy_url->username)
+ sprintf(new_url, "http_proxy://%s:%s@%s:%d/%s", proxy_url->username, proxy_url->password ? proxy_url->password : "", proxy_url->hostname, proxy_url->port, url->url );
+ else
+ sprintf(new_url, "http_proxy://%s:%d/%s", proxy_url->hostname, proxy_url->port, url->url );
+
tmp_url = url_new( new_url );
if( tmp_url==NULL ) {
return url_out;
More information about the MPlayer-users
mailing list