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