delvedor / hpagent

A ready to use http and https agent for working with proxies that keeps connections alive!
MIT License
181 stars 37 forks source link

handle proxy username which hava semicolon would be wrong #77

Closed ZhechenLi closed 2 years ago

ZhechenLi commented 2 years ago

when I use HttpsProxyAgent with got, and pass a proxy with some stuff like ${username};${parms}@${password} to auth a proxy. it would get 407 errors every time.

import {HttpsProxyAgent} from "hpagent";
import got from "got";

const proxyStatus = (await got("https://lumtest.com/myip.json", {
  resolveBodyOnly: true,
  agent: {
    https: new HttpsProxyAgent({
      proxy: `http://username;refreshSeconds=180:password@domain:port`,
    }),
  },
})) as unknown as {
  ip: string;
  country: string;
};

the same proxy scheme is working fine on 'http-agent' or on a python request module.