r111782 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111781‎ | r111782 | r111783 >
Date:20:07, 17 February 2012
Author:ben
Status:ok
Tags:
Comment:
Better to leave out the header than have its value be 'None'
Modified paths:
  • /trunk/extensions/SwiftMedia/wmf/rewrite.py (modified) (history)

Diff [purge]

Index: trunk/extensions/SwiftMedia/wmf/rewrite.py
@@ -175,13 +175,10 @@
176176
177177
178178 resp = webob.Response(app_iter=upcopy, content_type=c_t)
179 - try:
180 - resp.headers.add('Content-Length', uinfo.getheader('Content-Length'))
181 - resp.headers.add('Last-Modified', uinfo.getheader('Last-Modified'))
182 - resp.headers.add('Accept-Ranges', uinfo.getheader('Accept-Ranges'))
183 - except:
184 - # grab the headers if we can, no biggy if we can't.
185 - pass
 179+ # add in the headers if we've got them
 180+ for header in ['Content-Length', 'Last-Modified', 'Accept-Ranges']:
 181+ if(uinfo.getheader(header)):
 182+ resp.headers.add(header, uinfo.getheader(header))
186183 return resp
187184
188185 def __call__(self, env, start_response):

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111778Do not write the object to swift for HEAD requests, just return it to the user.ben19:47, 17 February 2012

Status & tagging log