microsoft / typed-rest-client

Node Rest and Http Clients with typings for use with TypeScript
Other
675 stars 118 forks source link

Proxy doesn't work when password has url sensitive characters #49

Closed omeshp closed 6 years ago

omeshp commented 6 years ago

Environment

Node version: 6.x Npm version: OS and version: typed-rest-client version: 0.15.1

Issue Description

If password has characters like ':' '\' proxy doesn't work, since we are url encoding the password at https://github.com/Microsoft/typed-rest-client/blob/93448b8ffdf5183cddb710d0fde99d7e697026f1/lib/HttpClient.ts#L408

Expected behaviour

Proxy should work when password has url sensitive characters.

Actual behaviour

Error: tunneling socket could not be established, statusCode=407

TingluoHuang commented 6 years ago

@omeshp we need encodeURIComponent because we want to allow proxy password contains reserved chars. ;,/?:@&=+$

omeshp commented 6 years ago

@TingluoHuang password is sent as a part of header so they shouldn't be URL encoded. Currently reserved characters aren't working with proxy, this fix is to make them work.

TingluoHuang commented 6 years ago

@omeshp Got it. Thanks for finding and fixing this. Changes looks good to me.