[MPlayer-dev-eng] Patch to handle HTTP redirects which contain anchor data (anything following '#')

badmailserver at hushmail.com badmailserver at hushmail.com
Fri Jul 18 15:54:00 CEST 2014


The following patch makes redirected URLs (Location header) such as http://example.com/video.mp4?auth=secretauthentication#autoscroll_to_bottom work where it previously wouldn't because "#autoscroll_to_bottom" would be sent as part of the 'auth' GET variable, making authentication fail.

--- MPlayer-1.1.1.orig/stream/http.c	2011-12-11 16:41:37.000000000 +0100
+++ MPlayer-1.1.1/stream/http.c	2014-07-18 15:14:44.978000575 +0200
@@ -824,6 +824,9 @@
 				// TODO: RFC 2616, recommand to detect infinite redirection loops
 				next_url = http_get_field( http_hdr, "Location" );
 				if( next_url!=NULL ) {
+					// Avoid sending anchor data to the server
+					char* hash=strchr(next_url, '#');
+					if(hash){hash[0]=0;}
 					int is_ultravox = strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;
 					stream->streaming_ctrl->url = url_redirect( &url, next_url );
 					if (!strcasecmp(url->protocol, "mms")) {



More information about the MPlayer-dev-eng mailing list