cpprestsdk icon indicating copy to clipboard operation
cpprestsdk copied to clipboard

Proxy support for OSX

Open mivasi opened this issue 10 years ago • 7 comments

I have a question if someone is interested in proxy support on OSX. I saw that you integrated basic linux proxy support which works on OSX too, but as I saw it has only basic authentication support. For our project it is not enough so we wrote native OSX transport layer which now supports basic and digest authentication and we are heading toward NTLM authentication type.

mivasi avatar Mar 04 '16 17:03 mivasi

Yes, I am interested in proxy support with basic authentication on OSX.

On Fri, Mar 4, 2016 at 10:38 PM, Michal Vašíček [email protected] wrote:

I have a question if someone is interested in proxy support on OSX. I saw that you integrated basic linux proxy support which works on OSX too, but as I saw it has only basic authentication support. For our project it is not enough so we wrote native OSX transport layer which now supports basic and digest authentication and we are heading toward NTLM authentication type.

— Reply to this email directly or view it on GitHub https://github.com/Microsoft/cpprestsdk/issues/83.

PremanandPatil avatar Mar 04 '16 17:03 PremanandPatil

Yes, this sounds like a solid feature. Can this be implemented under the existing public APIs, or would it need new ones?

ras0219-msft avatar Mar 04 '16 22:03 ras0219-msft

It is implemented in existing public API. It is implemented the same way as WIN transport layer. I added new file http_client_apple.cpp which is used on OSX (by CMAKE) instead of http_client_asio.cpp. It can be seen at https://github.com/mivasi/cpprestsdk/tree/macosx_client. There is still some minimal work to be done, because I disabled about 5 tests which do not pass yet. Also there are still some questions to be answered. For example, how to write proxy authentication tests for everyone. For now I wrote those tests depending on my local proxy server, but they fail to anyone else.

mivasi avatar Mar 04 '16 22:03 mivasi

Slightly off topic, but we also need to support NTLM (+negotiate) on windows for proxy authentication. Http requests are fine, however the WebSocket does not work (Websocketpp) on Windows 7. I've been working on a solution for this in WebSocketpp - it will also mean some small changes to cpprestsdk to make it fit (API change needed because some proxies require a re connection during the auth flow). Anyway, I'm writing a pluggable 'proxy_authenticator' object within WebSocket to achieve this. This object manages extraction of auth challenges + calculation of the next auth token. The Auth token calculation part itself is again a pluggable interface (security_context), which will be specific to each platform - on Windows I'm simply using the Windows SSPI API - so it's a pretty small object. I should be ready to issue a pull request within the next week - I'll post the link here, and we can see it there's any possibility for re-use somewhere.

coliemcgarry avatar Mar 05 '16 08:03 coliemcgarry

Forgot to follow up, regardless, here's that link to my pull request within WebSocket++ (Pluggable Authenticated Proxy Support - with an implementation for Windows, supporting NTLM+Negotiate):

https://github.com/zaphoyd/websocketpp/pull/535

coliemcgarry avatar Apr 12 '16 14:04 coliemcgarry

@mivasi Did you consider contributing this as a pull request? A native OSX client would be a great addition.

deeringc avatar Oct 31 '16 12:10 deeringc

@deeringc I am sorry I still can't get all automations to pass which is the reason why I didn't make pull request yet. If someone can help me with that it would be great. I think code is ready and we are using it in production version of our product, but there are some minor automation failures I do not know what to do with them.

mivasi avatar Oct 31 '16 18:10 mivasi