Ticket #3990: apache_mod_proxy.2.patch
File apache_mod_proxy.2.patch, 2.9 KB (added by , 17 years ago) |
---|
-
mythweb/includes/utils.php
336 336 if (!$ext && $_SESSION['file_url_override']) 337 337 return 'file://'.$_SESSION['file_url_override'].str_replace('%2F', '/', rawurlencode(basename($show->filename))); 338 338 // Which protocol should we use for downloads? 339 340 $host = $_SERVER['HTTP_HOST']; 341 if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) 342 $host = $_SERVER['HTTP_X_FORWARDED_HOST']; 343 339 344 $url = (($_SESSION['stream']['force_http'] || !isset($_SERVER['HTTPS'])) 340 ? 'http://' .$ _SERVER['HTTP_HOST'].':'._or($_SESSION['stream']['force_http_port'], '80')341 : 'https://'.$ _SERVER['HTTP_HOST'].':'._or($_SESSION['stream']['force_http_port'], '443')345 ? 'http://' .$host.':'._or($_SESSION['stream']['force_http_port'], '80') 346 : 'https://'.$host.':'._or($_SESSION['stream']['force_http_port'], '443') 342 347 ) 343 348 .root."pl/stream/$show->chanid/$show->recstartts"; 344 349 // Handle specific file extension modes … … 356 361 // Windows likely gets a myth:// url -- grab the master host and port 357 362 global $Master_Host, $Master_Port; 358 363 // Is either the browser xor the master in an rfc 1918 zone? 364 $remoteaddr = $_SERVER['REMOTE_ADDR']; 365 if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) 366 $remoteaddr = $_SERVER['HTTP_X_FORWARDED_FOR']; 359 367 if (preg_match('/^(?:10|192\.168|172\.(?:1[6-9]|2[0-9]|3[0-6]))\./', $Master_Host) 360 xor preg_match('/^(?:10|192\.168|172\.(?:1[6-9]|2[0-9]|3[0-6]))\./', $ _SERVER['REMOTE_ADDR'])) {368 xor preg_match('/^(?:10|192\.168|172\.(?:1[6-9]|2[0-9]|3[0-6]))\./', $remoteaddr)) { 361 369 return $url; 362 370 } 363 371 // Send the myth url -
mythweb/modules/stream/handler.pl
91 91 my $uri = ($ENV{'HTTPS'} || $ENV{'SERVER_PORT'} == 443) 92 92 ? 'https' 93 93 : 'http'; 94 $uri .= '://'.($ENV{'SERVER_NAME'} or $ENV{'SERVER_ADDR'}).':'.$ENV{'SERVER_PORT'} 94 my $serverAddr = $ENV{'HTTP_X_FORWARDED_HOST'} || $ENV{'SERVER_NAME'} || $ENV{'SERVER_ADDR'}; 95 $uri .= '://'.$serverAddr.':'.$ENV{'SERVER_PORT'} 95 96 .$ENV{'REQUEST_URI'}; 97 96 98 $uri =~ s/\.asx$//i; 97 99 # Build the ASX file so we can know how long it is 98 100 my $file = <<EOF; … … 105 107 <REF HREF = "$uri" /> 106 108 </ENTRY> 107 109 </ASX> 110 TEST - $ENV{'REQUEST_URI'} 108 111 EOF 109 112 # Print out the HTML headers and the ASX file itself 110 113 print header(-type => 'video/x-ms-asf',