add support for socks5, socks4, and http proxies

This commit is contained in:
ading2210 2024-07-19 00:47:14 -04:00
parent 9f033fc848
commit 4d64b27a82
9 changed files with 58 additions and 5 deletions

View file

@ -17,8 +17,15 @@ class TLSSocket extends CurlSession {
this.connected = false;
this.recv_loop = null;
this.set_connections(1, 0);
this.connect();
try {
check_proxy(this.options.proxy);
this.set_connections(1, 0);
this.connect();
}
catch (e) {
this.cleanup(true);
throw e;
}
}
connect() {
@ -40,6 +47,9 @@ class TLSSocket extends CurlSession {
this.http_handle = this.create_request(this.url, data_callback, finish_callback, headers_callback);
_tls_socket_set_options(this.http_handle, +this.options.verbose);
if (this.options.proxy) {
c_func_str(_request_set_proxy, [this.http_handle, this.options.proxy]);
}
this.start_request(this.http_handle);
}