Actions
Bug #8539
closedcivetweb backend responds with a body when a HEAD request yields an error
Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
% Done:
0%
Source:
Community (user)
Tags:
Backport:
firefly
Regression:
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Description
So for example, doing a HEAD on a non-existent key will yield a 404, along with a Content-Length: 79 (which is allowed), but then there should be no body at all (even with a content-length, see http specs).
Currently it will actually send a body when using the civetweb backend (it works with the fastcgi one, althouhg I don't know if it really works or if the http server actually cleans up the response ...).
I applied this fix to my tree to fix the issue. I'm not sure it's the "right fix", but it works and makes my regression test pass.
diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index 69948a6..b74002d 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -180,7 +180,7 @@ void rgw_flush_formatter_and_reset(struct req_state *s, Formatter *formatter) std::ostringstream oss; formatter->flush(oss); std::string outs(oss.str()); - if (!outs.empty()) { + if (!outs.empty() && s->op != OP_HEAD) { s->cio->write(outs.c_str(), outs.size()); } @@ -192,7 +192,7 @@ void rgw_flush_formatter(struct req_state *s, Formatter *formatter) std::ostringstream oss; formatter->flush(oss); std::string outs(oss.str()); - if (!outs.empty()) { + if (!outs.empty() && s->op != OP_HEAD) { s->cio->write(outs.c_str(), outs.size()); } }
Files
Updated by Yehuda Sadeh almost 10 years ago
This fix seems fine to me. Can you resend it with a proper description and a Signed-off-by line?
Updated by Sylvain Munaut almost 10 years ago
- File fix-for-head-body.diff fix-for-head-body.diff added
Here you go.
Updated by Yehuda Sadeh over 9 years ago
- Status changed from New to Pending Backport
- Backport set to firefly
Updated by Yehuda Sadeh over 9 years ago
Merged, commit:0a2b4c25541bbd15776d3d35986518e37166910f
Updated by Sage Weil over 9 years ago
- Status changed from Pending Backport to Resolved
Actions