You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
An application name outside Latin-1 loses every event to the User-Agent header #30
An application name that a header cannot carry causes every event to be dropped, even though the JSON body could carry the name without trouble.
_send puts the application in the User-Agent header (trace_client/trace_client.py:311). http.client encodes header values as Latin-1 and refuses a bare line break, so urlopen raises before anything is sent. The failure is caught and logged at DEBUG, so report() stays quiet, the client still says enabled, and nothing ever reaches the server.
Reproduced on Python 3.8.10 against a loopback server:
application
Result
MyGame
delivered
Zürich
delivered
ゲーム
not delivered: 'latin-1' codec can't encode characters in position 27-29
emoji🎲
not delivered: 'latin-1' codec can't encode character
Line\nBreak
not delivered: Invalid header value
The promise is that a failing server costs a report. A program's name should not cost all of them. test_non_ascii_names_and_tags_arrive_intact_as_utf8_json covers event names and tags but uses the ASCII application Spiel, so this path has no test.
Suggested fix: replace only the characters a header cannot carry with ? in the User-Agent. The body keeps the exact name, and names that are delivered today keep the header they send today.
A key outside Latin-1 fails the same way, but such a key cannot be valid, so no change is proposed for it.
Activity