Keystone API is forcing Content-Transfer: chunked on responses

Bug #1016171 reported by Tomasz Paszkowski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Wishlist
Dolph Mathews

Bug Description

Hi,

I'am implementing CORS support for Keystone. Everything is working except that on response I'am setting Content-Length header to 0 but response is sent to user using Tramsfer-Encoding: chunked.

Code added to PublicRouter class:

       # Cors Operations
        cors_controller = CorsController()
        mapper.connect('/tokens',
                       controller=cors_controller,
                       action='get_options',
                       conditions=dict(method=['OPTIONS']))

CorsCotroller class is as follows:

class CorsController(wsgi.Application):
    def __init__(self):
        super(CorsController, self).__init__()
    def get_options(self, context):
        headers = [('Access-Control-Allow-Headers', 'origin,content-type,accept,x-auth-token')]
        headers.append(('Access-Control-Allow-Methods', 'POST'))
        headers.append(('Access-Control-Allow-Origin', 'https://178.239.138.10:8433'))
        headers.append(('Access-Control-Max-Age', '60'))
        headers.append(('Content-Length', '0'))
        return wsgi.render_response(status=(200, 'OK'),
                                    headers=headers)

Everything seems to be working:
echo -e 'OPTIONS /v2.0/tokens HTTP/1.1\r\n' | nc 10.76.0.206 5000
HTTP/1.1 200 OK
Access-Control-Allow-Headers: origin,content-type,accept,x-auth-token
Access-Control-Allow-Methods: POST
Access-Control-Allow-Origin: https://178.239.138.10:8433
Access-Control-Max-Age: 1728000
Content-Type: text/html; charset=UTF-8
Date: Thu, 21 Jun 2012 17:52:29 GMT
Transfer-Encoding: chunked

0

B

Revision history for this message
Dolph Mathews (dolph) wrote :

I'm not sure it's fair to qualify this as a "bug" considering you're logging it against new development that hasn't been committed... but the "solution" is to provide webob with a complete response object.

Changed in keystone:
assignee: nobody → Dolph Mathews (dolph)
importance: Undecided → Wishlist
milestone: none → folsom-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/8818

Changed in keystone:
status: New → In Progress
Joseph Heck (heckj)
Changed in keystone:
milestone: folsom-2 → none
milestone: none → folsom-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/8818
Committed: http://github.com/openstack/keystone/commit/4b97716e4a68cb55652fe2bfd62373adf2b417c5
Submitter: Jenkins
Branch: master

commit 4b97716e4a68cb55652fe2bfd62373adf2b417c5
Author: Dolph Mathews <email address hidden>
Date: Thu Jun 21 13:29:00 2012 -0500

    Webob needs body to calc Content-Length (bug 1016171)

    - Refactored render_response() and added relevant tests

    Change-Id: I121e8cc641fe11a036106cbfd206f0aa1f6da560

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: folsom-3 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.