Content-type should not be set to ""
Bug #1433767 reported by
Timur Alperovich
This bug affects 3 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-swiftclient |
Fix Released
|
Undecided
|
Timur Alperovich |
Bug Description
When performing an upload, the content-type may be set to an empty string (in client.py):
978 if content_type is not None:
979 headers[
980 else: # python-requests sets application/
981 headers[
This breaks against certain servers (I've found this to be a problem in Jersey), which return 400 error for an invalid content type (""). Can swiftclient default to a valid type, e.g. binary/
To post a comment you must log in.
Per RFC7231, the format of this field is
media-type = type "/" subtype *( OWS ";" OWS parameter )
type = token
subtype = token
https:/ /tools. ietf.org/ html/rfc7231# section- 3.1.1.1
Therefore, an empty string is *not* valid. As Timur says, this can cause issue with clients and servers that are proxying the requests.
An appropriate fix here is to default to "application/ octet-stream" .