Project

General

Profile

Bug #10661

RGW swift API: Response header of POST request for object does not contain content-length and x-trans-id headers

Added by Ahmad Faheem about 9 years ago. Updated almost 9 years ago.

Status:
Resolved
Priority:
Normal
Target version:
-
% Done:

0%

Source:
Q/A
Tags:
Backport:
hammer
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Steps to reproduce:

1. swift post container
2. curl -i https://object.jiocloud.com:80/swift/v1/container/test -X PUT -H "X-Auth-Token: b0fc9e40be454205b290ea6768f2c1b2" -H "content-length: 0"
3. curl -i https://object.jiocloud.com:80/swift/v1/container/test -X POST -H "X-Auth-Token: b0fc9e40be454205b290ea6768f2c1b2"

HTTP/1.1 202 Accepted
Date: Wed, 28 Jan 2015 05:50:23 GMT
Server: Apache/2.4.7 (Ubuntu)
Content-Type: application/octet-stream
Connection: close
Transfer-Encoding: chunked

in swift the response header returned is:
curl -i http://10.0.2.15:8080/v1/AUTH_b2419ea9588d49ddbd8c006b5eb199ff/container/test -X POST -H "X-Auth-Token: b8d0bac45c7343ae84705ceab696809c"

HTTP/1.1 202 Accepted
Content-Length: 76
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txf097d3b0fdee4b3d96457-0054c7ebb1
Date: Tue, 27 Jan 2015 19:49:06 GMT

Associated revisions

Revision fd0c612c (diff)
Added by Radoslaw Zarzynski about 9 years ago

rgw: enforce Content-Length in response for POST on Swift cont/obj.

Fixes: #10661
Backport: hammer
Signed-off-by: Radoslaw Zarzynski <>

Revision 2cb5d600 (diff)
Added by Radoslaw Zarzynski almost 9 years ago

rgw: enforce Content-Length in response for POST on Swift cont/obj.

Fixes: #10661
Backport: hammer
Signed-off-by: Radoslaw Zarzynski <>
(cherry picked from commit fd0c612cf867d2e99e74820130357e63305970fb)

History

#1 Updated by Dmytro Yurchenko about 9 years ago

The documentation seems to be a little bit controversial
http://docs.openstack.org/api/openstack-object-storage/1.0/content/POST_updateObjectMeta__v1__account___container___object__storage_object_services.html

It says: Content-Length If the operation succeeds, this value is zero (0). If the operation fails, this value is the length of the error text in the response body.

But at the same time both examples do not return Content-Length: 0 on success

curl -i $publicURL/marktwain/goodbye -X POST -H "X-Auth-Token: $token" -H "X-Object-Meta-Book: GoodbyeColumbus"

HTTP/1.1 202 Accepted
Content-Length: 76
Content-Type: text/html; charset=UTF-8
X-Trans-Id: txb5fb5c91ba1f4f37bb648-0052d84b3f
Date: Thu, 16 Jan 2014 21:12:31 GMT

<html><h1>Accepted</h1><p>The request is accepted for processing.</p></html>

curl -i $publicURL/marktwain/goodbye -X POST -H "X-Auth-Token: $token" -H "X-Object-Meta-Book: GoodbyeOldFriend"

HTTP/1.1 202 Accepted
Content-Length: 76
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx5ec7ab81cdb34ced887c8-0052d84ca4
Date: Thu, 16 Jan 2014 21:18:28 GMT

<html><h1>Accepted</h1><p>The request is accepted for processing.</p></html>

One thing is for sure, that Content-Length has to be present.

When I use built-in civetweb frontend:

$ curl -I "http://localhost:8000/swift/v1/cont1/file1" -X POST -H "Content-Type: application/json" -H "X-Auth-Token: $token"

HTTP/1.1 202 Accepted
Content-type: text/plain; charset=utf-8
Content-Length: 0

$ curl -I "http://localhost:8000/swift/v1/cont1/non-existent-file" -X POST -H "Content-Type: application/json" -H "X-Auth-Token: $token"

HTTP/1.1 404 Not Found
Content-Length: 9
Accept-Ranges: bytes
Content-type: text/plain; charset=utf-8

But when I use fcgi frontend behind nginx:

$ curl -I "http://localhost:8080/swift/v1/cont1/file1" -X POST -H "Content-Type: application/json" -H "X-Auth-Token: $token"

HTTP/1.1 202 Accepted
Server: nginx/1.4.6 (Ubuntu)
Date: Wed, 04 Feb 2015 13:46:59 GMT
Content-Type: text/plain; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive

$ curl -I "http://localhost:8080/swift/v1/cont1/non-existent-file" -X POST -H "Content-Type: application/json" -H "X-Auth-Token: $token"

HTTP/1.1 404 Not Found
Server: nginx/1.4.6 (Ubuntu)
Date: Wed, 04 Feb 2015 13:48:54 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 9
Connection: keep-alive
Accept-Ranges: bytes

It seems like nginx thinks "Content-Length: 0" is useless and threw it away while preserving content-length greater than 0.

Please, check if it is an issue caused by Apache.

#2 Updated by Dmytro Yurchenko about 9 years ago

  • Assignee set to Dmytro Yurchenko

Radoslaw Zarzynski is working on it.

#3 Updated by Radoslaw Zarzynski about 9 years ago

I'm working on this issue.

After initial analysis it looks like the civetweb frontend generates the "Content-Length" header in behalf of the RGWPutMetadata_ObjStore_SWIFT::send_response(). Please refer the RGWMongoose::complete_header() and RGWMongoose::complete_request() methods. The FCGI frontend lacks this feature.

#5 Updated by Yehuda Sadeh about 9 years ago

  • Status changed from New to Pending Backport
  • Backport set to hammer

#7 Updated by Loïc Dachary almost 9 years ago

  • Status changed from Pending Backport to Resolved
  • Regression set to No

Also available in: Atom PDF