Skip to content

Commit f64d7bc

Browse files
Al2Klimovnilmerg
authored andcommitted
Don't limit browser_session.user_agent to 4096 chars
1 parent 9f9e2c6 commit f64d7bc

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

library/Notifications/Daemon/Server.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,7 @@ protected function authenticate(Connection $connection, array $cookies, array $h
406406

407407
if ($browserSession !== null) {
408408
if (isset($headers['User-Agent'][0])) {
409-
// limit user-agent to 4k chars
410-
$userAgent = substr(trim($headers['User-Agent'][0]), 0, 4096);
409+
$userAgent = trim($headers['User-Agent'][0]);
411410
} else {
412411
$userAgent = 'default';
413412
}

library/Notifications/ProvidedHook/SessionStorage.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ public function onLogin(User $user): void
3939
// user successfully authenticated
4040
$rawUserAgent = (new UserAgent())->getAgent();
4141
if ($rawUserAgent) {
42-
// limit user-agent to 4k chars
43-
$userAgent = substr(trim($rawUserAgent), 0, 4096);
42+
$userAgent = trim($rawUserAgent);
4443
} else {
4544
$userAgent = 'default';
4645
}
@@ -124,8 +123,7 @@ public function onLogout(User $user): void
124123

125124
$rawUserAgent = (new UserAgent())->getAgent();
126125
if ($rawUserAgent) {
127-
// limit user-agent to 4k chars
128-
$userAgent = substr(trim($rawUserAgent), 0, 4096);
126+
$userAgent = trim($rawUserAgent);
129127
} else {
130128
$userAgent = 'default';
131129
}

0 commit comments

Comments
 (0)