dont fail if accept-encoding is not set

This commit is contained in:
j 2012-09-07 14:02:26 +02:00
parent 5b97b26692
commit 1f2dd79517

View file

@ -158,7 +158,7 @@ class Server(Resource):
if request.path == '/api/':
return self
if request.path == '/library.xml':
accept_encoding = request.getHeader('accept-encoding')
accept_encoding = request.getHeader('accept-encoding') or ''
if 'gzip' in accept_encoding:
f = GzipFile(self.backend.xml, 'application/xml')
else:
@ -166,7 +166,6 @@ class Server(Resource):
f.isLeaf = True
return f
if request.path.startswith('/track/'):
track_id = request.path.split('/')[-1].split('.')[0]
track = self.backend.library['Tracks'].get(track_id)
@ -198,7 +197,7 @@ class Server(Resource):
else:
data = {}
action = request.args['action'][0]
accept_encoding = request.getHeader('accept-encoding')
accept_encoding = request.getHeader('accept-encoding') or ''
if 'gzip' in accept_encoding:
request = GzipRequest(request)
#FIXME: this should be done async