Bug #47781
closedrgw: regression for headers in RGWListBucket
0%
Description
Ceph version 15.2.4
This is a regression of the similar Swift API bug that was reported in https://tracker.ceph.com/issues/10666 that was fixed by https://github.com/ceph/ceph/pull/3740/commits/8b762e3435937f11a73f19e269afa88d156eb7db
When issuing a GET on the container to show details and list objects in a container the HTTP headers returned for X-Container-Object-Count, X-Container-Bytes-Used-Actual and X-Container-Object-Count is all 0 while the Swift V1 documentation [1] says that both X-Container-Object-Count and X-Container-Bytes-Used should be set and populated.
If you instead issue a HEAD on the container you will get a response that has HTTP headers X-Container-Object-Count, X-Container-Bytes-Used-Actual and X-Container-Object-Count set and populated with a value that is correct.
Reproduce:
$python3 reproduce.py Headers: {'X-Storage-Class': 'STANDARD', 'X-Container-Bytes-Used-Actual': '0', 'X-Timestamp': '1601303433.45565', 'Last-Modified': 'Mon, 28 Sep 2020 14:30:33 GMT', 'X-Storage-Policy': 'mypolicy', 'Content-Length': '17', 'X-Openstack-Request-Id': 'tx00000000000000003566c-005f7dd19f-24fccde-zone1', 'Accept-Ranges': 'bytes', 'X-Container-Bytes-Used': '0', 'Date': 'Wed, 07 Oct 2020 14:33:03 GMT', 'X-Container-Object-Count': '0', 'X-Trans-Id': 'tx00000000000000003566c-005f7dd19f-24fccde-zone1', 'Content-Type': 'text/plain; charset=utf-8'} Num headers: 13 Response: test.zip test.txt ----- Headers: {'X-Storage-Class': 'STANDARD', 'X-Container-Bytes-Used-Actual': '104861696', 'X-Timestamp': '1601303433.45565', 'Last-Modified': 'Mon, 28 Sep 2020 14:30:33 GMT', 'X-Storage-Policy': 'mypolicy', 'X-Openstack-Request-Id': 'tx000000000000000035668-005f7dd19f-241ad88-zone1', 'Accept-Ranges': 'bytes', 'X-Container-Bytes-Used': '104857617', 'Date': 'Wed, 07 Oct 2020 14:33:03 GMT', 'X-Container-Object-Count': '2', 'X-Trans-Id': 'tx000000000000000035668-005f7dd19f-241ad88-zone1', 'Content-Type': 'text/plain; charset=utf-8'} Num headers: 12 Response:
And the code:
import requests
headers = {
'X-Auth-Token': 'my auth token',
}
r = requests.get('https://endpoint/swift/v1/AUTH_18df6a12658a4af5a2786a424100e5fd/test2', headers=headers)
r2 = requests.head('https://endpoint/swift/v1/AUTH_18df6a12658a4af5a2786a424100e5fd/test2', headers=headers)
print('Headers: %s' % str(r.headers))
print('Num headers: %i' % len(r.headers))
print('Response: %s' % str(r.text))
print('-----')
print('Headers: %s' % str(r2.headers))
print('Num headers: %i' % len(r2.headers))
print('Response: %s' % str(r2.text))
Updated by Casey Bodley over 3 years ago
- Assignee set to Or Friedmann
- Tags set to swift
Updated by Casey Bodley over 3 years ago
- Has duplicate Bug #47861: swift rest api on GET returns X-Container-* headers with zero value added