Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@proxymesh/javascript-proxy-headers",
"version": "0.2.3",
"version": "0.2.4",
"license": "MIT",
"exports": "./mod.ts"
}
4 changes: 2 additions & 2 deletions lib/core/proxy-headers-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* and captures the proxy's response headers.
*/

import { Agent } from 'https';
import tls from 'tls';
import { Agent } from 'node:https';
import tls from 'node:tls';
import { parseProxyUrl, buildConnectRequest, createProxySocket, proxyReadyEvent } from './utils.js';
import { parseConnectResponse, hasCompleteHeaders, ConnectError } from './connect-parser.js';

Expand Down
8 changes: 4 additions & 4 deletions lib/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Utility functions for proxy header handling.
*/

import net from 'net';
import tls from 'tls';
import net from 'node:net';
import tls from 'node:tls';

const INVALID_HEADER_CHAR = /[\r\n\0]/;

Expand Down Expand Up @@ -79,8 +79,8 @@ export function parseTargetUrl(targetUrl) {
* Open a TCP or TLS socket to the proxy.
* HTTPS proxy URLs use tls.connect so Proxy-Authorization is not sent in the clear.
* @param {{ host: string, port: number, protocol: string }} proxyInfo
* @param {import('tls').ConnectionOptions} [proxyTlsOptions]
* @returns {import('net').Socket|import('tls').TLSSocket}
* @param {import('node:tls').ConnectionOptions} [proxyTlsOptions]
* @returns {import('node:net').Socket|import('node:tls').TLSSocket}
*/
export function createProxySocket(proxyInfo, proxyTlsOptions = {}) {
if (proxyInfo.protocol === 'https:') {
Expand Down
2 changes: 1 addition & 1 deletion lib/undici-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { parseConnectResponse, hasCompleteHeaders, ConnectError } from './core/c
* @param {Object} options.proxyHeaders - Headers to send to proxy
* @param {Object} [options.proxyTlsOptions] - TLS options for an https:// proxy
* @param {number} options.timeout - Timeout in ms
* @returns {Promise<{ socket: import('net').Socket, proxyHeaders: Map<string, string> }>}
* @returns {Promise<{ socket: import('node:net').Socket, proxyHeaders: Map<string, string> }>}
*/
async function createProxyTunnel(options) {
const { proxy, targetHost, targetPort, proxyHeaders = {}, proxyTlsOptions = {}, timeout = 30000 } = options;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "javascript-proxy-headers",
"version": "0.2.3",
"version": "0.2.4",
"description": "Extensions for JavaScript HTTP libraries to support sending and receiving custom proxy headers during HTTPS CONNECT tunneling",
"type": "module",
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* JavaScript Proxy Headers - TypeScript Definitions
*/

import { Agent } from 'https';
import { Agent } from 'node:https';

// =============================================================================
// Core Types
Expand Down