New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hammer: rgw: refrain from sending Content-Type/Content-Length for 304 responses #8379
Conversation
just not sure if we add the notes in the cherry-picked commits
|
@tchaikov Yes, I am not sure, too. |
RFC7230 says: A server MUST NOT send a Content-Length header field in any response with a status code of 1xx (Informational) or 204 (No Content). Fixes: ceph#13582 Signed-off-by: Wido den Hollander <wido@42on.com> (cherry picked from commit 4e5921d)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com> (cherry picked from commit 2a12ffc)
so that we can avoid atoi() later Signed-off-by: Yehuda Sadeh <yehuda@redhat.com> (cherry picked from commit 744a29a) Conflicts: src/rgw/rgw_rest.cc rename the input parameter from `err` to `http_ret`
When we say the Content has not changed we should not respond with a content type which defaults to binary/octet stream. Fixes: ceph#15119 Signed-off-by: Wido den Hollander <wido@42on.com> (cherry picked from commit 471fa29)
We tell the client that the content has not changed. If we send a Content-Length header RFC2616 describes that the client MUST use that new value: "If a cache uses a received 304 response to update a cache entry, the cache MUST update the entry to reflect any new field values given in the response." Therefor we should not send a Content-Length header Fixes: ceph#15119 Signed-off-by: Wido den Hollander <wido@42on.com> (cherry picked from commit fb4e5cc)
ef716d7
to
20f300e
Compare
The conflict resolution comment matches the difference commit=19dbc2598d15d0676017abe4fb75f7ddc3248119 ; picked_from=$(git show --no-patch --pretty=%b $commit | perl -ne 'print if(s/.*cherry picked from commit (\w+).*/$1/)') ; diff -u --ignore-matching-lines '^[^+-]' <(git show $picked_from) <(git show $commit)
--- /dev/fd/63 2016-03-31 11:37:30.911948034 +0200
+++ /dev/fd/62 2016-03-31 11:37:30.927947932 +0200
@@ -149,11 +154,12 @@
+ dump_status(s, s->err.http_ret, http_status_names[s->err.http_ret]);
}
- void dump_errno(struct req_state *s, int http_ret)
+-void dump_errno(struct req_state *s, int err)
++void dump_errno(struct req_state *s, int http_ret)
{
- char buf[32];
-- snprintf(buf, sizeof(buf), "%d", http_ret);
-- dump_status(s, buf, http_status_names[http_ret]);
+- snprintf(buf, sizeof(buf), "%d", err);
+- dump_status(s, buf, http_status_names[s->err.http_ret]);
+ dump_status(s, http_ret, http_status_names[http_ret]);
} |
… Content-Length for 304 responses Reviewed-by: Loic Dachary <ldachary@redhat.com>
@@ -167,10 +167,14 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs, off_ | |||
s->cio->print("%s: %s\r\n", riter->first.c_str(), riter->second.c_str()); | |||
} | |||
|
|||
if (!content_type) | |||
content_type = "binary/octet-stream"; | |||
if (ret == ERR_NOT_MODIFIED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this should be ret == -ERR_NOT_MODIFIED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind creating an issue at http://tracker.ceph.com/projects/rgw/issues/new for that ? It's in master and should be fixed there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dachary Issue is http://tracker.ceph.com/issues/16327, fixed by #9725
… Content-Length for 304 responses Reviewed-by: Nathan Cutler <ncutler@suse.com>
@Vicente-Cheng Please cherry-pick fc38346 into this PR (see http://tracker.ceph.com/issues/16327) |
Fixes: http://tracker.ceph.com/issues/16327 Signed-off-by: Nathan Cutler <ncutler@suse.com> (cherry picked from commit fc38346) Conflicts: src/rgw/rgw_rest_s3.cc use ret instead of op_ret to check op result
@smithfarm sorry about late update. thanks |
… Content-Length for 304 responses Reviewed-by: Nathan Cutler <ncutler@suse.com>
… Content-Length for 304 responses Reviewed-by: Nathan Cutler <ncutler@suse.com>
… Content-Length for 304 responses Reviewed-by: Nathan Cutler <ncutler@suse.com>
@oritwas This PR passed an rgw suite with some valgrind-related failures that appear harmless - see http://tracker.ceph.com/issues/15895#note-19 Do you think this PR is ready to merge? |
@oritwas Ping for permission to merge. |
lgtm |
http://tracker.ceph.com/issues/15283