mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Handle whitespace in no_proxy environment variable (#7072)
De facto standard format of no_proxy enivronment variable allows whitespace around the host names. Make it work. Closes #6339
This commit is contained in:
@@ -4374,10 +4374,14 @@ pub fn trim(slice: anytype, comptime values_to_strip: []const u8) @TypeOf(slice)
|
||||
return slice[begin..end];
|
||||
}
|
||||
|
||||
pub const whitespace_chars = [_]u8{ ' ', '\t', '\n', '\r', std.ascii.control_code.vt, std.ascii.control_code.ff };
|
||||
|
||||
pub fn lengthOfLeadingWhitespaceASCII(slice: string) usize {
|
||||
for (slice) |*c| {
|
||||
switch (c.*) {
|
||||
' ', '\t', '\n', '\r', std.ascii.control_code.vt, std.ascii.control_code.ff => {},
|
||||
whitespace: {
|
||||
inline for (whitespace_chars) |wc| break :whitespace wc;
|
||||
} => {},
|
||||
else => {
|
||||
return @intFromPtr(c) - @intFromPtr(slice.ptr);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user