Skip to content

Commit

Permalink
Avoid headers errors in stream.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro committed Oct 23, 2014
1 parent e00ff73 commit 45a7209
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions weppy/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def streamer(environ, static_file, version=None, headers=None,
mtime = time.strftime(
'%a, %d %b %Y %H:%M:%S GMT', time.gmtime(modified))
headers['Content-Type'] = contenttype(static_file)
# check if file to be served as an attachment
if environ.get('QUERY_STRING').startswith('attachment'):
# check if file has to be served as an attachment
if environ.get('QUERY_STRING', '').startswith('attachment'):
headers['Content-Disposition'] = 'attachment; filename="%s"' % \
static_file
# check if file modified since or not
Expand Down Expand Up @@ -90,7 +90,7 @@ def streamer(environ, static_file, version=None, headers=None,
headers['Content-Encoding'] = 'gzip'
headers['Vary'] = 'Accept-Encoding'
stream = open(static_file, 'rb')
headers['Content-Length'] = fsize
headers['Content-Length'] = str(fsize)
except IOError:
if sys.exc_info()[1][0] in (errno.EISDIR, errno.EACCES):
return HTTP(403)
Expand Down

0 comments on commit 45a7209

Please sign in to comment.