[MPlayer-dev-eng] [PATCH 3/7] Use authorization field to pass server authentication through proxy

Clément Bœsch ubitux at gmail.com
Thu Nov 18 21:34:24 CET 2010


On Sat, Nov 06, 2010 at 11:06:44AM +0100, Reimar Döffinger wrote:
> On Sun, Oct 24, 2010 at 09:44:56PM +0200, Clément Bœsch wrote:
> > On Sun, Oct 24, 2010 at 08:38:43PM +0200, Reimar Döffinger wrote:
> > > On Mon, Oct 18, 2010 at 12:05:53PM +0200, Clément Bœsch wrote:
> > > > 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 );
> > > 
> > > What is going wrong here, what is in server_url->url?
> > > 
> > 
> > http://login:password@host:8000/foo.ogg instead of
> > http://host:8000/foo.ogg
> 
> At least I think it should use server_url->protocol instead of
> a fixed "http".
> 

This patch is necessary with proxies like polipo.

Requesting
http_proxy://localhost:8123/http://login:password@host:8000/foo/bar.ogg,
proxy receives:

  before the patch:

    GET http://login:password@host:8000/foo/bar.ogg HTTP/1.0
    [...]
    Authorization: Basic bG9naW46cGFzc3dvcmQ=

  after the patch:

    GET http://host:8000/foo/bar.ogg HTTP/1.0
    [...]
    Authorization: Basic bG9naW46cGFzc3dvcmQ=

This allows the proxy to correctly forward the request (and not try to
resolve login:password as URL).

OK to apply?

-- 
Clément B.
Not sent from a jesusPhone.


More information about the MPlayer-dev-eng mailing list