Config: bring back validateUserAgent

This commit is contained in:
Halil Durak
2026-04-17 17:32:05 +03:00
parent 5e0c046e96
commit 29d8e0c9b7

View File

@@ -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;
}
}