"application/json" instead of "text/json"

Bug #843226 reported by Dolph Mathews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Yogeshwar

Bug Description

There are a few places in Keystone middleware pieces (token_auth.py, etc), where the "Accept": "text/json" should be "Accept": "application/json". -Liem Nguyen

Dolph Mathews (dolph)
Changed in keystone:
status: New → Confirmed
Changed in keystone:
status: Confirmed → Fix Committed
Joe Savak (jsavak)
Changed in keystone:
importance: Undecided → Medium
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → essex-1
Changed in keystone:
assignee: nobody → Yogeshwar (yogesh-srikrishnan)
Revision history for this message
Yogeshwar (yogesh-srikrishnan) wrote :

Looks like there is a new quatum_auth_token.py which uses incorrect behavior and is been found and fixed by Dolph.

This is how our code looks
def is_xml_response(req):
    """Returns True when the request wants an XML response, False otherwise"""
    return "Accept" in req.headers and "application/xml" in req.accept

if result:
        if is_xml_response(req):
            content = result.to_xml()
            resp.headers['content-type'] = "application/xml"
        else:
            content = result.to_json()
            resp.headers['content-type'] = "application/json"

So any content type other than application/xml was treated as application/json and the bug never caused issues as we defauted to json for incorrect accepts.

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/1533
Committed: http://github.com/openstack/keystone/commit/f3d497b241c4685c5429866b6d3176f0faadf904
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit f3d497b241c4685c5429866b6d3176f0faadf904
Author: Dolph Mathews <email address hidden>
Date: Thu Nov 10 20:12:35 2011 -0600

    'text/json' should be 'application/json' (bug 843226)

    Change-Id: Ic0a6c211a078a43160d4193d6fe3aaa2c4b18b66

Thierry Carrez (ttx)
Changed in keystone:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: essex-1 → 2012.1
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.