[Slim-Checkins] r8762 - in /trunk/server/Slim/Networking: Async/HTTP.pm UPnP/ControlPoint.pm

andy at svn.slimdevices.com andy at svn.slimdevices.com
Tue Aug 1 16:50:02 PDT 2006


Author: andy
Date: Tue Aug  1 16:50:01 2006
New Revision: 8762

URL: http://svn.slimdevices.com?rev=8762&view=rev
Log:
Check for a real URL in UPnP Location, also check that everything we send through Async::HTTP is an HTTP URL

Modified:
    trunk/server/Slim/Networking/Async/HTTP.pm
    trunk/server/Slim/Networking/UPnP/ControlPoint.pm

Modified: trunk/server/Slim/Networking/Async/HTTP.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Networking/Async/HTTP.pm?rev=8762&r1=8761&r2=8762&view=diff
==============================================================================
--- trunk/server/Slim/Networking/Async/HTTP.pm (original)
+++ trunk/server/Slim/Networking/Async/HTTP.pm Tue Aug  1 16:50:01 2006
@@ -118,6 +118,11 @@
 		||
 		HTTP::Request->new( $args->{method} => $args->{url} )
 	);
+	
+	if ( $self->request->uri !~ /^http/i ) {
+		my $error = 'Cannot request non-HTTP URL ' . $self->request->uri;
+		return $self->_http_error( $error, $args );
+	}
 	
 	if ( !$self->request->protocol ) {
 		$self->request->protocol( 'HTTP/1.0' );
@@ -143,10 +148,8 @@
 	my $headers = $self->request->headers;
 	
 	# handle basic auth if username, password provided
-	if ( $self->request->uri->can('userinfo') ) {
-		if ( my $userinfo = $self->request->uri->userinfo ) {
-			$headers->header( Authorization => 'Basic ' . encode_base64( $userinfo ) );
-		}
+	if ( my $userinfo = $self->request->uri->userinfo ) {
+		$headers->header( Authorization => 'Basic ' . encode_base64( $userinfo ) );
 	}
 	
 	my $host = $self->request->uri->host;

Modified: trunk/server/Slim/Networking/UPnP/ControlPoint.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Networking/UPnP/ControlPoint.pm?rev=8762&r1=8761&r2=8762&view=diff
==============================================================================
--- trunk/server/Slim/Networking/UPnP/ControlPoint.pm (original)
+++ trunk/server/Slim/Networking/UPnP/ControlPoint.pm Tue Aug  1 16:50:01 2006
@@ -108,6 +108,9 @@
 	
 	return unless ( $ssdp_res_msg =~ m/LOCATION[ :]+(.*)\r/i );
 	my $dev_location = $1;
+	
+	# Some UPnP devices report a Location of '*' (Xbox 360), so we must check for a proper URL
+	return unless $dev_location =~ /^http/i;
 	
 	my ($USN) = $ssdp_res_msg =~ m/USN[ :]+(.*)\r/i;
 	my ($udn) = _parseUSNHeader( $USN );



More information about the checkins mailing list