Skip to content

Conversation

@MichaIng
Copy link
Contributor

Similar to the URL length, also the user agent string length is limited to 100 bytes/characters. But it is currently not assured that this limit is kept before the database query is done.

There are user agents with much longer strings, e.g. "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1 (compatible; Baiduspider-render/2.0; +http://www.baidu.com/search/spider.html" with 211 characters. Similar to the URL, such strings are now truncated before the database query is done. This must not be done earlier, since the $ua variable is used for user agent ID estimation, where the identifying pattern must not be truncated.

This is a quick fix, while there might be smarter solutions, like increasing the allowed size of the useragent field, or removing specific parts from the string, which are known to be less relevant. E.g. with this solution, the above example would not contain the identifying "Baiduspider-render" anymore.

Similar to the URL length, also the user agent string length is limited to 100 bytes/characters. But it is currently not assured that this limit is kept before the database query is done.

There are user agents with much longer strings, e.g. "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1 (compatible; Baiduspider-render/2.0; +http://www.baidu.com/search/spider.html" with 211 characters. Similar to the URL, such strings are now truncated before the database query is done. This must not be done earlier, since the $ua variable is used for user agent ID estimation, where the identifying pattern must not be truncated.

This is a quick fix, while there might be smarter solutions, like increasing the allowed size of the useragent field, or removing specific parts from the string, which are known to be less relevant. E.g. with this solution, the above example would not contain the identifying "Baiduspider-render" anymore.

Signed-off-by: MichaIng <micha@dietpi.com>
@Thomas--F Thomas--F merged commit da9719f into Thomas--F:4.x-dev May 29, 2021
@MichaIng MichaIng deleted the patch-1 branch May 29, 2021 18:11
Thomas--F added a commit that referenced this pull request May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants