HEAD doesn't return Content-Length header due to catch_errors middleware
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
New
|
Undecided
|
Unassigned |
Bug Description
Hello,
I am using CloudBerry to connect to my swift cluster running stable/rocky.
The PUT using cloudberry keeps failing with error (with use Native multi part enabled):
"The server committed a protocol violation. Section=
The tcpdump shows, that the HEAD response doesn't have Content-Length:0 instead it returns some weird 0 after the headers
HEAD /bucket1/readme.txt HTTP/1.1
User-Agent: CloudBerryLab.
x-amz-content-
x-amz-date: 20191213T105213Z
Authorization: AWS4-HMAC-SHA256 Credential=
Host: xxxxxxxxxxxxxxx
Connection: Keep-Alive
HTTP/1.1 404 Not Found
x-amz-id-2: tx8a57cd0835314
x-amz-request-id: tx8a57cd0835314
Content-Type: application/xml
X-Trans-Id: tx8a57cd0835314
X-Openstack-
Date: Fri, 13 Dec 2019 10:52:13 GMT
Transfer-Encoding: chunked
Connection: keep-alive
0
Upon looking further into this, it looks like this is happening due to the catch_errors.py middleware
probably due to the following (and related) commit https:/
If I disable the enforce_byte_count logic then I get a response with Content-Length header
--- a/swift/
+++ b/swift/
@@ -100,10 +100,11 @@ class CatchErrorsCont
# the socket. In that case, we truncate the response body at N bytes
# and raise an exception to stop any more bytes from being
# generated and also to kill the TCP connection.
- if env['REQUEST_
- resp = enforce_
+ #if env['REQUEST_
+ # resp = enforce_
- elif self._response_
+ #elif self._response_
+ if self._response_
if len(content_
Response as captured by tcpdump
HEAD /bucket1/
User-Agent: CloudBerryLab.
x-amz-content-
x-amz-date: 20191213T102421Z
Authorization: AWS4-HMAC-SHA256 Credential=
Host: xxxxxxxxxxxxxxx
Connection: Keep-Alive
HTTP/1.1 404 Not Found
x-amz-id-2: tx318cf1a828b54
x-amz-request-id: tx318cf1a828b54
Content-Type: application/xml
X-Trans-Id: tx318cf1a828b54
X-Openstack-
Content-Length: 0
Date: Fri, 13 Dec 2019 10:24:21 GMT
Connection: keep-alive
Any pointers why the Content-Length header is missing and what is the 0 in the response?
Regards,
Bhaskar
description: | updated |
description: | updated |
description: | updated |
Changed in swift: | |
status: | Incomplete → New |
The response is coming back as Transfer-Encoding: chunked - the 0 in the body is part of the transfer encoding chunked protocol indicating the length of the chunk is 0 (i.e. the body is empty)
I wasn't able to duplicate a transfer encoding chunked response on object 404 in-response to HEAD using the boto client on master or swift 2.18 (rocky release)
Can you provide more info
1) Does using another client (boto, aws cli, s3cmd, etc) to preform a similar request (HEAD to object that responds 404) results in the same transfer-encoding chunked response on this cluster?
2) Is the CloudBerry client sending any additional Content-Encoding aws-chunked request metdata or headers?