Skip to content
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

Merged
merged 6 commits into from Jul 29, 2016

Conversation

Vicente-Cheng
Copy link
Contributor

@tchaikov tchaikov added this to the hammer milestone Mar 31, 2016
@tchaikov tchaikov added the rgw label Mar 31, 2016
@tchaikov
Copy link
Contributor

just not sure if we add the notes in the cherry-picked commits

Fixes: #14005
Backport: hammer

Signed-off-by: Vicente Cheng <freeze.bilsted@gmail.com>

@Vicente-Cheng
Copy link
Contributor Author

@tchaikov Yes, I am not sure, too.
or just add backport information is enough?

wido and others added 5 commits March 31, 2016 17:29
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)
@ghost ghost self-assigned this Mar 31, 2016
@ghost
Copy link

ghost commented Mar 31, 2016

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]);
  }

ghost pushed a commit that referenced this pull request Apr 5, 2016
… 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) {
Copy link
Contributor

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

Copy link

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smithfarm added a commit that referenced this pull request Jun 1, 2016
… Content-Length for 304 responses

Reviewed-by: Nathan Cutler <ncutler@suse.com>
@oritwas oritwas self-assigned this Jun 14, 2016
@smithfarm
Copy link
Contributor

@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
@Vicente-Cheng
Copy link
Contributor Author

@smithfarm
hi Nathan,

sorry about late update.
already done this cherry-pick commit.
retest it please.

thanks

smithfarm added a commit that referenced this pull request Jun 27, 2016
… Content-Length for 304 responses

Reviewed-by: Nathan Cutler <ncutler@suse.com>
smithfarm added a commit that referenced this pull request Jul 18, 2016
… Content-Length for 304 responses

Reviewed-by: Nathan Cutler <ncutler@suse.com>
smithfarm added a commit that referenced this pull request Jul 24, 2016
… Content-Length for 304 responses

Reviewed-by: Nathan Cutler <ncutler@suse.com>
@smithfarm
Copy link
Contributor

smithfarm commented Jul 28, 2016

@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?

@smithfarm
Copy link
Contributor

@oritwas Ping for permission to merge.

@oritwas
Copy link
Member

oritwas commented Jul 28, 2016

lgtm

@smithfarm smithfarm merged commit f9e8dc8 into ceph:hammer Jul 29, 2016
@smithfarm smithfarm changed the title hammer: RGW shouldn't send Content-Type nor Content-Length for 304 responses hammer: rgw: refrain from sending Content-Type/Content-Length for 304 responses Aug 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants