Project

General

Profile

Bug #15119

Civetweb responds with Content-Type with a 304 Not Modified response

Added by Wido den Hollander over 6 years ago. Updated over 6 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Target version:
-
% Done:

0%

Source:
other
Tags:
rgw,varnish,civetweb,rfc,http
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

When a conditional request is done towards RGW with Civetweb and the content is not modified it responds with a Content-Type header set to 'binary/octet-stream'.

For example, this is what I see coming back from Varnish:

-   BerespProtocol HTTP/1.1
-   BerespStatus   304
-   BerespReason   Not Modified
-   BerespHeader   Bucket: cdn01
-   BerespHeader   x-amz-request-id: tx000000000000003bffeb1-0056e6d1eb-ca00be-ams02
-   BerespHeader   Content-type: binary/octet-stream
-   BerespHeader   Content-Length: 0
-   BerespHeader   Date: Mon, 14 Mar 2016 14:59:55 GMT

Looking at RFC7232 I found this: https://tools.ietf.org/html/rfc7232#page-18

The server generating a 304 response MUST generate any of the following header fields that would have been sent in a 200 (OK) response to the same request: Cache-Control, Content-Location, Date, ETag, Expires, and Vary.

This doesn't say that we have to respond with a Content-Type header.

IF we respond with a Content-Type header, we should at least respond with the proper mimetype.

I think these two headers should not be returned on a 304 Not Modified:

- Content-Type
- Content-Length


Related issues

Duplicates rgw - Bug #14005: RGW shouldn't send Content-Type nor Content-Length for 304 responses Resolved 12/07/2015

Associated revisions

Revision 471fa29e (diff)
Added by Wido den Hollander over 6 years ago

rgw: Do not send a Content-Type on a '304 Not Modified' response

When we say the Content has not changed we should not respond
with a content type which defaults to binary/octet stream.

Fixes: #15119

Signed-off-by: Wido den Hollander <>

Revision fb4e5cc5 (diff)
Added by Wido den Hollander over 6 years ago

rgw: Do not send a Content-Length header on a 304 response

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

Revision e53751d0 (diff)
Added by Wido den Hollander over 6 years ago

rgw: Do not send a Content-Type on a '304 Not Modified' response

When we say the Content has not changed we should not respond
with a content type which defaults to binary/octet stream.

Fixes: #15119

Signed-off-by: Wido den Hollander <>
(cherry picked from commit 471fa29e643fcfd5e1383fb987f99b5b21038ed7)

Revision 20f300e2 (diff)
Added by Wido den Hollander over 6 years ago

rgw: Do not send a Content-Length header on a 304 response

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 <>
(cherry picked from commit fb4e5cc5d6adc82423d294496855f56e43e8c11d)

History

#1 Updated by Yehuda Sadeh over 6 years ago

  • Status changed from New to Duplicate

Duplicate of #14005

#2 Updated by Wei-Chung Cheng over 6 years ago

  • Related to Bug #14005: RGW shouldn't send Content-Type nor Content-Length for 304 responses added

#3 Updated by Wei-Chung Cheng over 6 years ago

  • Related to deleted (Bug #14005: RGW shouldn't send Content-Type nor Content-Length for 304 responses)

#4 Updated by Wei-Chung Cheng over 6 years ago

  • Duplicates Bug #14005: RGW shouldn't send Content-Type nor Content-Length for 304 responses added

Also available in: Atom PDF