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

Allow specifying (at least) the basic auth scheme in WinHTTP implementation #996

Open
vadz opened this issue Dec 13, 2018 · 0 comments
Open

Comments

@vadz
Copy link
Contributor

vadz commented Dec 13, 2018

Currently HTTP clients using cpprest SDK perform 2 HTTP requests when retrieving URLs requiring authentication when using WinHTTP-based implementation under Windows: the first one without any auth info, resulting in 401 response, and the second one with the auth info, (hopefully) resulting in 200. This is not catastrophic but a bit annoying, especially when the program knows in advance that it does need authentication and also because this does not happen under Linux with the ASIO-based, where generate_basic_auth_header() is always called if credentials are specified.

This is clearly not done intentionally in WinHTTP code in order to select the most suitable auth scheme in ChooseAuthScheme() and I'm not going to argue with this decision. However I think that adding some http_client_config::use_basic_auth(bool) would be useful in order to at least allow opting in into Linux/ASIO-like behaviour. What do you think about this and would a PR adding such method be accepted?

Note that this issue is in some sense more general than #2, as it's about all requests, not only those using proxies, but in some sense less general than it too, as I'm only interested in (optionally) having the same behaviour with WinHTTP as with ASIO and not allow preselecting any auth scheme as seems to be the case there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant