Add header normalization and fetching for hosting service HTTP support.

Review Request #11199 — Created Sept. 24, 2020 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

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 a get_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.

Diff Revision 2

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

orig
1
2
3

Commits

First Last Summary ID Author
Add header normalization and fetching for hosting service HTTP support.
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 a `get_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.
97757595f1dde8a8ee7f606c0350e74d2170bcb3 Christian Hammond
reviewboard/hostingsvcs/service.py
reviewboard/hostingsvcs/tests/test_client.py
Loading...