[MPlayer-dev-eng] Little patch

Mariusz Jedrzejewski mj at polcard.com.pl
Tue Nov 25 15:36:21 CET 2003


Hi.
There is a stupid as I've never seen before proxy server - Nokia Checkpoint.
This thing is not able to process properly Proxy-Authorization string when
it ends with equal sign ('='). Even when it is normal for base 64
encoding...

Tcpflow shows that mplayer running with http_proxy://user:pass@proxy:port
can send "Proxy-Authorization: Basic WeirdBase64String=".
My little patch can avoid that problem:

===========================================================================
--- MPlayer-1.0pre2/libmpdemux/http.c.orig      2003-11-24 16:15:06.000000000 +0100
+++ MPlayer-1.0pre2/libmpdemux/http.c   2003-11-25 13:04:48.000000000 +0100
@@ -318,7 +318,7 @@
 int
 http_add_basic_authentication( HTTP_header_t *http_hdr, const char *username, const char *password ) {
        char *auth, *usr_pass, *b64_usr_pass;
-       int encoded_len, pass_len=0, out_len;
+       int encoded_len, pass_len=0, out_len, eq;
        if( http_hdr==NULL || username==NULL ) return -1;
 
        if( password!=NULL ) {
@@ -348,6 +348,13 @@
        }
 
        b64_usr_pass[out_len]='\0';
+       /* Now we must determine first occurence of '=' and replace it with EOL */
+       for(eq=0; eq<out_len; eq++) {
+               if(b64_usr_pass[eq] == '=') {
+                       b64_usr_pass[eq] = '\0';
+                       break; /* We don't care about rest */
+               }
+       }
        
        auth = (char*)malloc(encoded_len+22);
        if( auth==NULL ) {
===========================================================================

After patch authorization will pass.

Anyway, mplayer is first program that send '=' signs in Proxy-Auth string.
(Yes, I know it's not bad...)

What do you think about it?

Greetings

-- 
.==[ Mariusz Jedrzejewski ]==---------------------------------------.
+==[ mj(at)polcard.com.pl ]==[ http://206046.prv.pl ]==-------------+
+==[ GG/EKG: 1111022 ]==[ GPG: http://206046.prv.pl/Mariusz.asc ]==-+
`==[ Registered Linux User #206046 ]==[ JabberID: mj at chrome.pl ]==--'



More information about the MPlayer-dev-eng mailing list