mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
@@ -58,7 +58,7 @@ const SOCKSReply = enum(u8) {
|
||||
pub fn create(allocator: std.mem.Allocator, proxy_url: URL, destination_host: []const u8, destination_port: u16) !*SOCKSProxy {
|
||||
// Clone the destination_host to ensure memory safety
|
||||
const cloned_host = try allocator.dupe(u8, destination_host);
|
||||
|
||||
|
||||
const socks_proxy = bun.new(SOCKSProxy, .{
|
||||
.ref_count = .init(),
|
||||
.proxy_url = proxy_url,
|
||||
@@ -83,12 +83,12 @@ pub fn sendAuthHandshake(this: *SOCKSProxy, comptime is_ssl: bool, socket: NewHT
|
||||
// Buffer the write in case it's incomplete
|
||||
this.write_buffer.clearRetainingCapacity();
|
||||
try this.write_buffer.appendSlice(&auth_request);
|
||||
|
||||
|
||||
const bytes_written = socket.write(this.write_buffer.items);
|
||||
if (bytes_written != this.write_buffer.items.len) {
|
||||
return error.IncompleteWrite;
|
||||
}
|
||||
|
||||
|
||||
this.state = .auth_handshake;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ pub fn sendConnectRequest(this: *SOCKSProxy, comptime is_ssl: bool, socket: NewH
|
||||
if (bytes_written != this.write_buffer.items.len) {
|
||||
return error.IncompleteWrite;
|
||||
}
|
||||
|
||||
|
||||
this.state = .connect_request;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { tempDirWithFiles, bunExe, bunEnv } from "harness";
|
||||
import { bunEnv, bunExe, tempDirWithFiles } from "harness";
|
||||
|
||||
describe("SOCKS proxy environment variables", () => {
|
||||
test("should read SOCKS proxy from http_proxy environment variable", async () => {
|
||||
@@ -100,4 +100,4 @@ describe("SOCKS proxy environment variables", () => {
|
||||
|
||||
expect(stdout.trim()).toBe("INVALID_PROXY_ERROR");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { tempDirWithFiles, bunExe, bunEnv } from "harness";
|
||||
import { bunEnv, bunExe, tempDirWithFiles } from "harness";
|
||||
|
||||
describe("SOCKS proxy", () => {
|
||||
test("should detect SOCKS5 proxy URLs in environment variables", async () => {
|
||||
@@ -109,4 +109,4 @@ describe("SOCKS proxy", () => {
|
||||
expect(output).toContain("socks5-attempted");
|
||||
expect(output).toContain("socks5h-attempted");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user