should accept raw wsgi environ not just headers

Bug #1579772 reported by Chris Dent
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
microversion-parse
Fix Released
Medium
Chris Dent

Bug Description

Currently the parse routine expects a data structure that can be interpreted as a collection of headers and their values. This means that the raw WSGI environ has to be processed into some kind of object (eg a webob or flask request object).

This is quite the limitation when making microversion processing middleware that is just plain WSGI.

Chris Dent (cdent)
Changed in microversion-parse:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to microversion-parse (master)

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

Changed in microversion-parse:
assignee: nobody → Chris Dent (cdent)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to microversion-parse (master)

Reviewed: https://review.openstack.org/495356
Committed: https://git.openstack.org/cgit/openstack/microversion-parse/commit/?id=bd003b52a5076905ceadf514c4d360fee545bfc5
Submitter: Zuul
Branch: master

commit bd003b52a5076905ceadf514c4d360fee545bfc5
Author: Chris Dent <email address hidden>
Date: Fri Aug 18 16:42:20 2017 +0100

    Provide a helper method to get headers from environ

    The get_version method accepts a dict or list of tuples that
    represent HTTP request headers that will be processed to find a
    microversion header. Sometimes, for example in some middlewares,
    direct access to a headers dict will not be available and only the
    WSGI environ will be present.

    This change provides a utility method which creates a new dict of
    headers: headers_from_wsgi_environ. This mode was chosen to make it
    clear that a copy of the environ is being made, not the environ
    itself as we really don't want to be passing that as some values in
    it will not be simple objects (strings and numbers) and we do not
    know what other middleware might have done or want to do with it.

    Internal to get_version any attempt to get a header named 'FOO' will
    fall back to looking for the WSGI equivalent of 'HTTP_FOO'.

    README.rst has been updated to indicate the new style.

    This change is backwards compatible, existing clients will not
    notice.

    Change-Id: I5262031d9cde0378eabe342c1913091658c3bf9b
    Closes-Bug: #1579772

Changed in microversion-parse:
status: In Progress → Fix Released
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.