dodo / node-unicodetable

unicode lookup table
MIT License
42 stars 34 forks source link

Proxy Server does not work with Username and Password #20

Open starr749 opened 9 years ago

starr749 commented 9 years ago

The Regex used to to parse the process.env.http_proxy only works when the env variable is in the http://proxyurl:port format.

For those of us stuck behind the corporate firewall: http://username:password@proxyurl:port, the regex does not parse the url correctly.

The line in question being: var proxyVars = proxyServer.match(/^([^:/]*:[/]{2})?([^:/]+)(:([0-9]+))?/i);

This is really unfortunate for those of us on windows, because we have no place like "/usr/share/unicode/ to put the file either.

behboud commented 9 years ago

+1 any workaround? EDIT: this regex seems to work:

/^([^:/]*:[/]{2})?(([^:/]+)?:(([^:/]+)@))?([^:/]+)(:([0-9]+))?/i

and change lines 139,140 to

unicodedatafile.host = proxyVars[6];
unicodedatafile.port = proxyVars[8];
starr749 commented 9 years ago

If you're on Windows, and behind a corporate proxy, the only real workaround that I can think of would be to install something like Cntlm, setup a local proxy (without a username / password) that forwards to your corporate one with the correct credentials.

However, this may violate security rules, so you'd want to consult with your IT, go through proper channels etc.

Definitely not an ideal work around, but it's the only thing that I've found that might work on windows machines.

Even using Cygwin I was not able to download / read the unicode file.

spacemonkey commented 8 years ago

Solution offered by @behboud works for me as well - can someone do this, or do we need to submit a pull request?