[Slim-Checkins] r9445 - in /branches/6.5/server/Slim:
Networking/UPnP/ControlPoint.pm Utils/UPnPMediaServer.pm
andy at svn.slimdevices.com
andy at svn.slimdevices.com
Wed Sep 6 11:44:31 PDT 2006
Author: andy
Date: Wed Sep 6 11:44:29 2006
New Revision: 9445
URL: http://svn.slimdevices.com?rev=9445&view=rev
Log:
Fix UPnP param ordering so we can work with Windows Media Connect servers
Modified:
branches/6.5/server/Slim/Networking/UPnP/ControlPoint.pm
branches/6.5/server/Slim/Utils/UPnPMediaServer.pm
Modified: branches/6.5/server/Slim/Networking/UPnP/ControlPoint.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Networking/UPnP/ControlPoint.pm?rev=9445&r1=9444&r2=9445&view=diff
==============================================================================
--- branches/6.5/server/Slim/Networking/UPnP/ControlPoint.pm (original)
+++ branches/6.5/server/Slim/Networking/UPnP/ControlPoint.pm Wed Sep 6 11:44:29 2006
@@ -344,13 +344,20 @@
my $ctrl_url = $service->getposturl();
+ # Make sure we don't have double-slashes in the URL
+ my $uri = URI->new($ctrl_url)->canonical;
+ my $path_query = $uri->path_query;
+ $path_query =~ s{//}{/}g;
+ $uri->path_query($path_query);
+ $ctrl_url = $uri->as_string;
+
my $service_type = $service->getservicetype();
my $soap_action = "\"" . $service_type . "#" . $action_name . "\"";
my $soap_content = qq{<?xml version="1.0" encoding="utf-8"?>
-<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <s:Body>
- <u:$action_name xmlns:u="$service_type">
+<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
+ <s:Body>
+ <u:$action_name xmlns:u="$service_type">
};
if ( ref $action_arg ) {
@@ -361,19 +368,21 @@
next if $arg_name !~ /^[A-Z]/;
if ( length($arg_value) <= 0 ) {
- $soap_content .= qq{ <$arg_name />} . "\n";
+ $soap_content .= qq{ <$arg_name />} . "\n";
next;
}
- $soap_content .= qq{ <$arg_name>$arg_value</$arg_name>} . "\n";
- }
- }
-
- $soap_content .= qq{
- </u:$action_name>
- </s:Body>
+ $soap_content .= qq{ <$arg_name>$arg_value</$arg_name>} . "\n";
+ }
+ }
+
+ $soap_content .= qq{ </u:$action_name>
+ </s:Body>
</s:Envelope>
};
+ # Make sure we have correct line-endings
+ $soap_content =~ s/\r?\n/\r\n/g;
+
return ( $ctrl_url, $soap_action, $soap_content );
}
Modified: branches/6.5/server/Slim/Utils/UPnPMediaServer.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Utils/UPnPMediaServer.pm?rev=9445&r1=9444&r2=9445&view=diff
==============================================================================
--- branches/6.5/server/Slim/Utils/UPnPMediaServer.pm (original)
+++ branches/6.5/server/Slim/Utils/UPnPMediaServer.pm Wed Sep 6 11:44:29 2006
@@ -11,6 +11,7 @@
use warnings;
use HTML::Entities;
+use Tie::LLHash;
use URI::Escape qw(uri_escape);
use Slim::Buttons::BrowseUPnPMediaServer;
@@ -166,11 +167,12 @@
sub loadContainer {
my $args = shift;
- Slim::Networking::UPnP::ControlPoint->browse( {
+ # Retarded servers such as Windows Media Connect require a certain order of XML elements (!)
+ tie my %args, 'Tie::LLHash', (
udn => $args->{udn},
service => 'urn:schemas-upnp-org:service:ContentDirectory:1',
- # SOAP params
+ # SOAP params, they MUST be in this order
ObjectID => $args->{id} || 0,
BrowseFlag => $args->{method} || 'BrowseDirectChildren',
Filter => '*',
@@ -180,7 +182,9 @@
callback => \&gotContainer,
passthrough => [ $args ],
- } );
+ );
+
+ Slim::Networking::UPnP::ControlPoint->browse( \%args );
}
sub gotContainer {
More information about the checkins
mailing list