Skip to content

Commit

Permalink
Fix pac+ prefixed protocol URIs (#220)
Browse files Browse the repository at this point in the history
Fixes #219.
  • Loading branch information
TooTallNate committed Jul 13, 2023
1 parent 08487f0 commit 999dd9d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .changeset/plenty-spoons-repair.md
@@ -0,0 +1,6 @@
---
'proxy-agent': patch
'pac-proxy-agent': patch
---

Fix `pac+` prefixed protocol URIs
12 changes: 6 additions & 6 deletions packages/pac-proxy-agent/src/index.ts
Expand Up @@ -55,12 +55,12 @@ export type PacProxyAgentOptions<T> = http.AgentOptions &
* - "pac+https", "https" - refers to an HTTPS endpoint
*/
export class PacProxyAgent<Uri extends string> extends Agent {
static readonly protocols: `pac-${Protocols}`[] = [
'pac-data',
'pac-file',
'pac-ftp',
'pac-http',
'pac-https',
static readonly protocols: `pac+${Protocols}`[] = [
'pac+data',
'pac+file',
'pac+ftp',
'pac+http',
'pac+https',
];

uri: URL;
Expand Down
2 changes: 1 addition & 1 deletion packages/pac-proxy-agent/test/test.ts
Expand Up @@ -280,7 +280,7 @@ describe('PacProxyAgent', () => {
return 'HTTPS localhost:PORT;';
}

const uri = `data:,${encodeURIComponent(
const uri = `pac+data:,${encodeURIComponent(
FindProxyForURL.toString().replace(
'PORT',
proxyHttpsServerUrl.port
Expand Down
10 changes: 5 additions & 5 deletions packages/proxy-agent/src/index.ts
Expand Up @@ -36,11 +36,11 @@ export const proxies: {
socks4a: [SocksProxyAgent, SocksProxyAgent],
socks5: [SocksProxyAgent, SocksProxyAgent],
socks5h: [SocksProxyAgent, SocksProxyAgent],
'pac-data': [PacProxyAgent, PacProxyAgent],
'pac-file': [PacProxyAgent, PacProxyAgent],
'pac-ftp': [PacProxyAgent, PacProxyAgent],
'pac-http': [PacProxyAgent, PacProxyAgent],
'pac-https': [PacProxyAgent, PacProxyAgent],
'pac+data': [PacProxyAgent, PacProxyAgent],
'pac+file': [PacProxyAgent, PacProxyAgent],
'pac+ftp': [PacProxyAgent, PacProxyAgent],
'pac+http': [PacProxyAgent, PacProxyAgent],
'pac+https': [PacProxyAgent, PacProxyAgent],
};

function isValidProtocol(v: string): v is ValidProtocol {
Expand Down

1 comment on commit 999dd9d

@vercel
Copy link

@vercel vercel bot commented on 999dd9d Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

proxy-agents – ./

proxy-agents.vercel.app
proxy-agents-git-main-tootallnate.vercel.app
proxy-agents-tootallnate.vercel.app

Please sign in to comment.