]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Do not send a Content-Length header on a 304 response 8253/head
authorWido den Hollander <wido@42on.com>
Tue, 22 Mar 2016 10:35:05 +0000 (11:35 +0100)
committerWido den Hollander <wido@42on.com>
Tue, 22 Mar 2016 10:35:05 +0000 (11:35 +0100)
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: #15119
Signed-off-by: Wido den Hollander <wido@42on.com>
src/rgw/rgw_civetweb.cc

index 8f755d89fb969c7aa2bd750500e35ac7508e2f88..d4a03e109d4b6675d1f0972a7fe1c385cee0460a 100644 (file)
@@ -53,8 +53,15 @@ int RGWMongoose::complete_request()
       /*
        * Status 204 should not include a content-length header
        * RFC7230 says so
+       *
+       * Same goes for status 304: Not Modified
+       *
+       * '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.'
+       *
        */
-      if (status_num == 204) {
+      if (status_num == 204 || status_num == 304) {
         has_content_length = true;
       } else if (0 && data.length() == 0) {
         has_content_length = true;