apify / proxy-chain

Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining.

Home Page:https://www.npmjs.com/package/proxy-chain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for passwords having ":" in upstream proxies

heydryft opened this issue · comments

I'm currently using proxyland.io, they're using : in password to separate sessions
the https-proxy-agent module supports : in passwords,
would be really glad if this request is possible

Note that we're using the official Node.js' URL class for parsing the URLs (added in #103), so if it doesn't support the ":" char in password, I'm afraid it would be difficult to add this

For some reason, the URL object escapes the :...

Screen Shot 2021-02-12 at 14 25 16

Hey @jancurn , can't you replace %3A with : on href and password?

A related problem. In a proxy URL such as this:

http://user:p%40ssword@proxy.com:8000

The password is not decoded somewhere down the line, which causes socket close errors.

RFC 1738 confirms that it's correct to encode those characters in section 3.1:

The user name (and password), if present, are followed by a commercial at-sign "@". Within the user and password field, any ":", "@", or "/" must be encoded.

So, we must make sure the user and password fields are properly decoded before they're used elsewhere (such as in the Authentication header).

Ok, RFC 3986 is quite clear in section 3.2.1 that usernames and passwords can have any percent encoded characters, so I think we can safely decode them, because it is the expected behavior.

Fixed in #110, will release soon

Fixed in #110