Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object PUT requires Content-Length header #74

Closed
valerytschopp opened this issue Jan 12, 2017 · 1 comment
Closed

Object PUT requires Content-Length header #74

valerytschopp opened this issue Jan 12, 2017 · 1 comment

Comments

@valerytschopp
Copy link
Contributor

Some implementation of the Swift object storage require the PUT request to include a valid header 'Content-Length'.

It is typically the case of the Ceph RADOS Gateway.

If the Swift client doesn't sent the Content-Length header in the PUT request, it will fail with the following error:

(sampleenv) [email protected]:~/projects/openstack/django-storage-swift-quickstart/sampleproj$ python manage.py collectstatic --noinput -v3 --clear
Copying '/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/django/contrib/admin/static/admin/css/base.css'
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 193, in handle
    collected = self.collect()
  File "/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 124, in collect
    handler(path, prefixed_path, storage)
  File "/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 359, in copy_file
    self.storage.save(prefixed_path, source_file)
  File "/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/django/core/files/storage.py", line 54, in save
    return self._save(name, content)
  File "/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/swift/storage.py", line 272, in _save
    headers=headers)
  File "/Users/tschopp/projects/openstack/django-storage-swift-quickstart/sampleenv/lib/python2.7/site-packages/swiftclient/client.py", line 1322, in put_object
    raise ClientException.from_response(resp, 'Object PUT failed', body)
swiftclient.exceptions.ClientException: Object PUT failed: https://os.zhdk.cloud.switch.ch/swift/v1/valery-test-django-static/admin/css/base.css 411 Length Required  [first 60 chars of response] <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>\n<title>411 Length Required</title>\n</head><body>\n<h1>Length Required</h1>\n<p>A request of the requested method PUT requires a valid Content-length.<br/>

I have open the pull request #73 to address this issue.

@dennisv
Copy link
Owner

dennisv commented Jan 16, 2017

I've just merged #73

@dennisv dennisv closed this as completed Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants