Fix duplicate headers when dispatching WebHooks.

Review Request #11613 — Created May 24, 2021 and submitted

Information

Review Board
release-4.0.x

Reviewers

When building a request during WebHook dispatch, we were using legacy
byte strings for headers. This almost sort of worked on Python 3, except
that duplicate Content-Type and Content-Length headers would appear,
and this would generally break request handling on the target server.

We needed to use native strings instead, to get the right behavior on
Python 2 and 3. This change updates request building to do this
correctly, and to updates tests to properly check the headers against
the right types.

Unit tests pass on Python 2.7 and 3.x.

Confirmed the bug against a WebHook endpoint on requestbin.net, and
confirmed the fix worked against the same endpoint, without any
duplicate headers.

Summary ID
Fix duplicate headers when dispatching WebHooks.
When building a request during WebHook dispatch, we were using legacy byte strings for headers. This almost sort of worked on Python 3, except that duplicate `Content-Type` and `Content-Length` headers would appear, and this would generally break request handling on the target server. We needed to use native strings instead, to get the right behavior on Python 2 and 3. This change updates request building to do this correctly, and to updates tests to properly check the headers against the right types. Fixes bug #4923.
04e0cec766df623f52326c20d5a69d2512fc80c2
david
  1. Ship It!
  2. 
      
chipx86
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (66edba4)
Loading...