Merge lp:~notmyname/swift/allowed_headers_head_backport into lp:~swift/swift/omega-1.3.0-4

Proposed by John Dickinson
Status: Merged
Merge reported by: gholt
Merged at revision: not available
Proposed branch: lp:~notmyname/swift/allowed_headers_head_backport
Merge into: lp:~swift/swift/omega-1.3.0-4
Diff against target: 38 lines (+15/-2)
2 files modified
swift/obj/server.py (+2/-2)
test/unit/obj/test_server.py (+13/-0)
To merge this branch: bzr merge lp:~notmyname/swift/allowed_headers_head_backport
Reviewer Review Type Date Requested Status
gholt Approve
Review via email: mp+58396@code.launchpad.net

Description of the change

fixed allowed_headers to work with both HEAD and GET

To post a comment you must log in.
Revision history for this message
gholt (gholt) wrote :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'swift/obj/server.py'
2--- swift/obj/server.py 2011-04-12 00:24:35 +0000
3+++ swift/obj/server.py 2011-04-19 21:16:29 +0000
4@@ -649,8 +649,8 @@
5 response = Response(content_type=file.metadata['Content-Type'],
6 request=request, conditional_response=True)
7 for key, value in file.metadata.iteritems():
8- if key == 'X-Object-Manifest' or \
9- key.lower().startswith('x-object-meta-'):
10+ if key.lower().startswith('x-object-meta-') or \
11+ key.lower() in self.allowed_headers:
12 response.headers[key] = value
13 response.etag = file.metadata['ETag']
14 response.last_modified = float(file.metadata['X-Timestamp'])
15
16=== modified file 'test/unit/obj/test_server.py'
17--- test/unit/obj/test_server.py 2011-03-29 20:32:27 +0000
18+++ test/unit/obj/test_server.py 2011-04-19 21:16:29 +0000
19@@ -343,6 +343,19 @@
20 "Content-Encoding" in resp.headers)
21 self.assertEquals(resp.headers['Content-Type'], 'application/x-test')
22
23+ req = Request.blank('/sda1/p/a/c/o',
24+ environ={'REQUEST_METHOD': 'HEAD'})
25+ resp = self.object_controller.HEAD(req)
26+ self.assert_("X-Object-Meta-1" not in resp.headers and
27+ "X-Object-Meta-Two" not in resp.headers and
28+ "X-Object-Meta-3" in resp.headers and
29+ "X-Object-Meta-4" in resp.headers and
30+ "Foo" in resp.headers and
31+ "Bar" in resp.headers and
32+ "Baz" not in resp.headers and
33+ "Content-Encoding" in resp.headers)
34+ self.assertEquals(resp.headers['Content-Type'], 'application/x-test')
35+
36 timestamp = normalize_timestamp(time())
37 req = Request.blank('/sda1/p/a/c/o',
38 environ={'REQUEST_METHOD': 'POST'},

Subscribers

People subscribed via source and target branches

to all changes: