tominsam/PythonDaap — Issue #1: Missing User-Agent
Author: decibyte
Created: 2011-12-05 10:27:20+00:00
State: open

When I try to connect to a share served by forked-daapd (on Ubuntu), itshell.py dies.

Output from itshell.py:

Connecting to 'localhost':3689
2011-12-05 11:17:50,494 DEBUG getting /content-codes
2011-12-05 11:17:54,691 DEBUG gunzipping data
2011-12-05 11:17:54,692 DEBUG expanded from 1770 bytes to 7045 bytes
2011-12-05 11:17:54,697 DEBUG getting /server-info
2011-12-05 11:17:59,267 DEBUG gunzipping data
2011-12-05 11:17:59,268 DEBUG expanded from 128 bytes to 175 bytes
2011-12-05 11:17:59,268 DEBUG getting /login
Traceback (most recent call last):
File "itshell.py", line 193, in
shell.cmdloop()
File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python2.7/cmd.py", line 219, in onecmd
return func(arg)
File "itshell.py", line 55, in do_connect
self.session = client.login()
File "/usr/lib/pymodules/python2.7/daap.py", line 471, in login
response = self.request("/login")
File "/usr/lib/pymodules/python2.7/daap.py", line 435, in request
raise DAAPError('DAAPClient: %s: Authentication failure'%r)
daap.DAAPError: DAAPClient: /login: Authentication failure

And from forked-daapd.log (on the server):

[2011-12-05 11:23:09] daap: DAAP request: /content-codes
[2011-12-05 11:23:09] daap: DAAP request: /server-info
[2011-12-05 11:23:09] daap: DAAP request: /login
[2011-12-05 11:23:09] daap: No User-Agent header, rejecting login request

It seems forked-daapd expects a User-Agent header to be present. I don't know if this header is part of any DAAP specification, but I guess it's fairly easy to add a User-Agent header to please forked-daapd (I might as well do it myself if I find the time).