Fix a Python 3 string and mimetype issues in SCMClient.get_file_http().

Review Request #11663 — Created June 20, 2021 and submitted — Latest diff uploaded

Review Board

SCMTool.get_file_http() had a couple of Python 3 incompatibility
issues, one dealing with wrong string types when adding the
Authorization header, and one dealing with access to the response

The authorization header was assuming Unicode strings, both when
encoding to Base64 and when adding to the header. We needed to feed a
byte string into b64encode(), then feed native strings into

For the mimetype, we were using a legacy function to fetch the mimetype
of a response, which didn't work on Python 3. This affected querying
both Git and Mercurial over HTTP. While there are replacement functions,
it's just safer to compare the Content-Type header directly, which
this change does.

Unit tests were added to cover all the get_file_http() logic, which
will help us avoid issues in the future.

Unit tests passed on Python 2 and 3.

Tested in production with a customer who hit this issue initially.