Add header normalization and fetching for hosting service HTTP support.
Review Request #11199 — Created Sept. 24, 2020 and submitted — Latest diff uploaded
We've had some annoyances with properly looking up headers from an HTTP
response in hosting service implementations in a consistent manner
across versions of Review Board, and across versions of Python. Work has
been done to fix this for GitHub, where this was more immediately
noticed.This change works to standardize how we store headers, both for requests
and responses, in the new hosting service HTTP implementation. We now
store all headers as lowercase, and normalize on lookup.
HostingServiceHTTPResponse
now has aget_header()
method, just like
HostingServiceHTTPRequest
. This is now preferred over accessing
headers
directly, and will handle normalization on the caller's
behalf. This is future-proof and avoids any further confusion around
headers.
Unit tests pass on Python 2.7 and 3.6 through 3.8.