mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 09:35:59 -04:00
Config: bring back validateUserAgent
This commit is contained in:
@@ -653,3 +653,15 @@ pub fn parseArgs(allocator: Allocator) !Config {
|
||||
const exec_name, const command = try Commands.parse(allocator);
|
||||
return .init(allocator, exec_name, command);
|
||||
}
|
||||
|
||||
pub fn validateUserAgent(ua: []const u8) !void {
|
||||
for (ua) |c| {
|
||||
if (!std.ascii.isPrint(c)) {
|
||||
return error.NonPrintable;
|
||||
}
|
||||
}
|
||||
|
||||
if (std.ascii.indexOfIgnoreCase(ua, "mozilla") != null) {
|
||||
return error.Reserved;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user