Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anonymize proxy throw hostname and port error when they are present #123

Closed
joaobortolozzo opened this issue Apr 6, 2021 · 0 comments · Fixed by #124
Closed

Anonymize proxy throw hostname and port error when they are present #123

joaobortolozzo opened this issue Apr 6, 2021 · 0 comments · Fixed by #124
Assignees
Labels
bug Something isn't working.

Comments

@joaobortolozzo
Copy link

Hi,

From version 0.4.8 and on I can't anonymize URLs like http://proxy:proxy321@my.domain.com, http://proxy:proxy321@my.domain.com:80 due to a change on /src/tools.js:parseUrl. This is happening because new URL(...) omit the default protocol port causing the anonymizeProxy(...) to throw an error Invalid "proxyUrl" option: the URL must contain both hostname and port..

> new URL('http://proxy:proxy321@my.domain.com:80')
URL {
  href: 'http://proxy:proxy321@my.domain.com/',
  origin: 'http://my.domain.com',
  protocol: 'http:',
  username: 'proxy',
  password: 'proxy321',
  host: 'my.domain.com',
  hostname: 'my.domain.com',
  port: '', // Empty port event when it is present
  pathname: '/',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
}

A possible fix here would be set the default http port on anonymizeProxy when parsedProxyUrl.protocol === 'http:' and port is empty. Thoughts?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants