@ffflorian/https-proxy 1.19.0 → 1.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,3 @@
1
- export interface Options {
2
- /** Default is `8080`. */
3
- port?: number;
4
- /** If not set, the requested URL will be used. */
5
- target?: string;
6
- }
7
1
  export interface AuthenticationOptions extends Options {
8
2
  /** If not set, no authentication will be required. */
9
3
  password: string;
@@ -14,12 +8,18 @@ export interface AuthenticationOptions extends Options {
14
8
  /** If not set, no authentication will be required. */
15
9
  username: string;
16
10
  }
11
+ export interface Options {
12
+ /** Default is `8080`. */
13
+ port?: number;
14
+ /** If not set, the requested URL will be used. */
15
+ target?: string;
16
+ }
17
17
  export declare class HttpsProxy {
18
18
  private readonly authenticationEnabled;
19
19
  private readonly logger;
20
20
  private readonly options;
21
21
  private readonly server;
22
- constructor(options?: Options | AuthenticationOptions);
22
+ constructor(options?: AuthenticationOptions | Options);
23
23
  start(): void;
24
24
  private getClosingProxyMessage;
25
25
  private readonly onConnect;
@@ -1,10 +1,10 @@
1
+ import basicAuth from 'basic-auth';
2
+ import { StatusCodes as HTTP_STATUS } from 'http-status-codes';
3
+ import logdown from 'logdown';
1
4
  import http from 'node:http';
2
5
  import net from 'node:net';
3
6
  import url from 'node:url';
4
- import basicAuth from 'basic-auth';
5
- import logdown from 'logdown';
6
7
  import compare from 'tsscmp';
7
- import { StatusCodes as HTTP_STATUS } from 'http-status-codes';
8
8
  const defaultOptions = {
9
9
  password: '',
10
10
  port: 8080,
@@ -30,7 +30,7 @@ export class HttpsProxy {
30
30
  return;
31
31
  }
32
32
  }
33
- const { port, hostname } = url.parse(this.options.target || `//${req.url}`, false, true);
33
+ const { hostname, port } = url.parse(this.options.target || `//${req.url}`, false, true);
34
34
  const parsedPort = parseInt(port || '443', 10);
35
35
  if (!hostname) {
36
36
  clientSocket.end('HTTP/1.1 400 Bad Request\r\n');
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import { program as commander } from 'commander';
2
3
  import fs from 'node:fs/promises';
3
4
  import path from 'node:path';
4
- import { program as commander } from 'commander';
5
5
  import { HttpsProxy } from './HttpsProxy.js';
6
6
  const __dirname = import.meta.dirname;
7
7
  const packageJsonPath = path.join(__dirname, '../package.json');
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "bin": "dist/cli.js",
4
4
  "dependencies": {
5
5
  "basic-auth": "2.0.1",
6
- "commander": "14.0.2",
6
+ "commander": "14.0.3",
7
7
  "http-status-codes": "2.3.0",
8
8
  "logdown": "3.3.1",
9
9
  "tsscmp": "1.0.6"
@@ -39,6 +39,6 @@
39
39
  "start": "tsx src/cli.ts"
40
40
  },
41
41
  "type": "module",
42
- "version": "1.19.0",
43
- "gitHead": "b968c846095113cbe57fbdd34e4593a4dea8a1c9"
42
+ "version": "1.19.2",
43
+ "gitHead": "59997e7c64b551213644945256b13ff3ba1ccfcd"
44
44
  }