daapclient plugin does not play songs from IPv6 servers

Bug #713471 reported by Bernhard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Exaile
Confirmed
Medium
Unassigned

Bug Description

Exaile 0.3.1.1
installed from Ubuntu Repositories

Expected Behaviour:
Songs on IPv6 connected DAAP servers should be playable

Actual Behaviour:
Trying to play songs on IPv6 connected DAAP servers results in an error message about an invalid URI

Problem:
The IPv6 IP needs to be escaped with [] within an URI. It is not.

e.g.:
* Class DaapConnection is instantiated

* self.server == "2a20:abcd:abcd:2::10"
* self.port == 3691

then in "DaapConnection.convert_list" on the following statement
* uri = "http://%s:%s/databases/%s/items/%s.%s?session-id=%s" % \
                    (server_uri, self.port, self.database.id, tr.id,
                    tr.type, self.session.sessionid)

the result will be
uri == "http://2a02:3e0:2002:1::1:3691/databases/....

Which will _never_ work, because now the port and ip can't be differentiated.

Instead a correct URI would look like this:
http://[2a02:3e0:2002:1::1]:3691/databases/...

Suggestion for a trivial fix follows:

[..]
+ server_uri = self.server
+ if ":" in server_uri:
+ # is IPv6 IP -> add [] for uri
+ server_uri = "[" + server_uri + "]"
[...]
                uri = "http://%s:%s/databases/%s/items/%s.%s?session-id=%s" % \
- (self.server, self.port, self.database.id, tr.id,
+ (server_uri, self.port, self.database.id, tr.id,
                    tr.type, self.session.sessionid)

Revision history for this message
Johannes Sasongko (sjohannes) wrote :

Have you checked to see if it actually works?

Changed in exaile:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Brian Parma (bj0) wrote :

I actually tested a similar fix, the problem is there's a bug in httplib (http://bugs.python.org/issue5111) which is used to connect to DAAP servers. According to that issue tracker, it should be fixed, but my system still has the error.

For now, I've just disabled ipv6 support? If there is demand or exaile's supported python version gets that patch, ipv6 support can be added.

Revision history for this message
Bernhard (xro) wrote :

I tested for the python bug (http://bugs.python.org/issue5111) on my system and it seems to not be present, aka fixed.
Distribution: Ubuntu 11.10
Python 2.7.2+ (default, Oct 4 2011, 20:06:09)
Exaile run's fine with python 2.7.2+ so there should be no issue with fixing this bug on ubuntu at least.
Also, there's definately demand here :) Exaile is a imho the best player but all our DAAP shares have IPv6 addresses only.

Revision history for this message
Brian Parma (bj0) wrote :

According to the issue tracker it's been backported to 2.7, but exaile is currently supporting 2.6. I have nearly the same distro as you though, so I'll have to look at why I was still getting the error.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.