GET on Static Large Object returns Content-Type application/json
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
Expired
|
Undecided
|
Unassigned |
Bug Description
When doing a GET on an SLO, the content-type returned is application/json even though the body contains the binary content of the object. Headers/body from such a request in a devstack run can be seen here:
But here are the headers:
{'X-Static-
It probably doesn't surface for many people, but shade happens to have an auto-decode json step if the content-type is application/json so that the calling function gets the python object rather than the json string. We've added a workaround in shade, so it's not a big deal for us - but it does seem like cognitive dissonance at the very least.
I think this is related to used content-type when uploading the manifest. If I upload a manifest with content-type set to "application/ octet-stream" I get the same back when downloading the object.
This is also the default when uploading a SLO using the swift CLI. For example:
[me@fedora ~]# dd if=/dev/zero of=bigobj bs=1k count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 0.00026279 s, 3.9 MB/s
[me@fedora ~]# swift upload -S 400 --use-slo cont bigobj slo/1485165429. 181910/ 1024/400/ 00000001 slo/1485165429. 181910/ 1024/400/ 00000002 slo/1485165429. 181910/ 1024/400/ 00000000
bigobj segment 1
bigobj segment 0
bigobj segment 2
bigobj/
bigobj/
bigobj/
bigobj
[me@fedora ~]# swift --debug download cont bigobj nt:RESP HEADERS: {u'Content-Length': u'1024', u'Content-Type': u'application/ octet-stream' , u'Accept-Ranges': u'bytes', u'Last-Modified': u'Mon, 23 Jan 2017 10:00:54 GMT', u'Etag': u'"63e9547bb7d6 a21b44e58280793 96dbc"' , u'X-Timestamp': u'1485165653. 57339', u'X-Trans-Id': u'txfc77183eab7 649b79805b- 005885d459' , u'Date': u'Mon, 23 Jan 2017 10:00:57 GMT', u'X-Static- Large-Object' : u'True', u'X-Object- Meta-Mtime' : u'1485165648. 789943' , u'X-Openstack- Request- Id': u'txfc77183eab7 649b79805b- 005885d459' }
...
DEBUG:swiftclie
bigobj [auth 0.011s, headers 0.034s, total 0.035s, 0.043 MB/s]
So I guess the content-type was set to JSON when uploading?