r111778 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111777‎ | r111778 | r111779 >
Date:19:47, 17 February 2012
Author:ben
Status:ok
Tags:
Comment:
Do not write the object to swift for HEAD requests, just return it to the user.
Modified paths:
  • /trunk/extensions/SwiftMedia/wmf/rewrite.py (modified) (history)

Diff [purge]

Index: trunk/extensions/SwiftMedia/wmf/rewrite.py
@@ -166,14 +166,16 @@
167167 except TypeError:
168168 last_modified = time.mktime(time.localtime())
169169
170 - if self.writethumb:
 170+ if self.writethumb and reqorig.method != 'HEAD':
171171 # Fetch from upload, write into the cluster, and return it
172172 upcopy = Copy2(upcopy, self.app, url,
173173 urllib2.quote(container), obj, self.authurl, self.login,
174174 self.key, content_type=c_t, modified=last_modified,
175175 content_length=content_length)
176176
 177+
177178 resp = webob.Response(app_iter=upcopy, content_type=c_t)
 179+ resp.headers.add('Content-Length', uinfo.getheader('Content-Length'))
178180 resp.headers.add('Last-Modified', uinfo.getheader('Last-Modified'))
179181 return resp
180182

Follow-up revisions

RevisionCommit summaryAuthorDate
r111781add in Accept-Ranges header to be consistent. Also it's ok if we can't get t...ben19:55, 17 February 2012
r111782Better to leave out the header than have its value be 'None'ben20:07, 17 February 2012

Status & tagging log