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
I spotted a recent uptick of some errors in the web server logs due to specific requests failing to go into the analytics database. The issue was related to requests that had multiple User-Agent HTTP headers present, like:
User-Agent is not a HTTP header that technically supports multiple values (other headers do), but if two separate User-Agent headers were given, we were parsing that as an array of multiple values, which confused some subsequent processing that was expecting a string value.
The text was updated successfully, but these errors were encountered:
This also fixes other possible problems with logging that may have cropped up if multiple values were present on any other HTTP headers (although, I'm not aware of any of the other headers having caused problems). We now ensure that we're always logging a single string value for each HTTP header, rather than possibly having an array of multiple values. But the string value may differ slightly for some headers according to these rules:
For certain HTTP headers that explicitly don't support multiple values (User-Agent being one of them), we only take the first HTTP header value seen.
For all other HTTP headers, we comma-separate multiple values into a single string.
This logic seems to be the standard way to handle header parsing, which I took from Node.js's HTTP parser (which in turn took it from Firefox).
I spotted a recent uptick of some errors in the web server logs due to specific requests failing to go into the analytics database. The issue was related to requests that had multiple
User-Agent
HTTP headers present, like:User-Agent
is not a HTTP header that technically supports multiple values (other headers do), but if two separateUser-Agent
headers were given, we were parsing that as an array of multiple values, which confused some subsequent processing that was expecting a string value.The text was updated successfully, but these errors were encountered: