Encode user agent as latin1 #60
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FMM has a Bundle Identifier that's made up of arabic characters. I found an example of their iOS app sending requests to mobile proxy by deploying a branch with enhanced logging to one west coast pixel server. In this request the user agent header was an empty string. Since our SDK builds the user agent header without user intervention this lead me to believe that Tornado was dropping the header because of the utf8 characters.
HTTP headers are required to use ASCII-compatible encodings. By encoding the provided string in latin1 no UTF8 characters would be transmitted and the traffic should be attributed to the correct channel.
I spent about two hours trying different approaches to mocking the Bundle class in a unit test. Then I gave up and deployed the enhanced logging branch back to a single pixel server, pointed the demo app in this repository at that single pixel server and changed the demo app bundle identifier to the string of arabic characters from the linked issue. I saw the header come through as expected.
Should resolve: https://github.com/Parsely/web/issues/10482