[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2025-07-20 07:27:13 +00:00
committed by GitHub
parent c14b979792
commit 786ca6e769
3 changed files with 8 additions and 8 deletions

View File

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

View File

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

View File

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