Skip to content

Added MACRO for server_certificate_verification #674

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

Closed
wants to merge 1 commit into from
Closed

Added MACRO for server_certificate_verification #674

wants to merge 1 commit into from

Conversation

gtnardy
Copy link

@gtnardy gtnardy commented Sep 29, 2020

If I have a request (made with universal interface httplib::Client) which redirects (set_follow_location) from HTTP to HTTPS and I had server_certificate_verification_ set to false, the redirection won't copy my server_certificate_verification_ setting and will make an erroneous request.

This solution allows me to keep server_certificate_verification configuration_ = false for my whole code and surrounds my problem.

Also, setting server_certificate_verification_ in the universal interface won't have effect (before it had been redirected from HTTP to HTTPS) and SSLClient instance had been created.

If I have a request (made with universal interface httplib::Client) which redirects (set_follow_location) from HTTP to HTTPS and I had server_certificate_verification_ set to false, the redirection won't copy my server_certificate_verification_ setting and will make an erroneous request.

This solution allows me to keep server_certificate_verification configuration_ = false for my whole code and surrounds my problem.

Also, setting server_certificate_verification_ in the universal interface won't have effect (before it had been redirected from HTTP to HTTPS) and SSLClient instance had been created.
@yhirose
Copy link
Owner

yhirose commented Sep 29, 2020

@gtnardy, thanks for the pull request. It seems "the redirection won't copy my server_certificate_verification_ setting" is a bug. I am thinking to fix the bug instead of introducing CPPHTTPLIB_SERVER_CERTIFICATE_VERIFICATION macro.

@yhirose yhirose closed this in e2c4e9d Sep 29, 2020
@yhirose
Copy link
Owner

yhirose commented Sep 29, 2020

@gtnardy, could you test with the latest httplib.h? It now copies server_certificate_verification_ setting properly. Thanks for your help!

@gtnardy
Copy link
Author

gtnardy commented Sep 30, 2020

Works like a charm! Thank you!

@yhirose
Copy link
Owner

yhirose commented Sep 30, 2020

@gtnardy, thanks for testing it!

omjego pushed a commit to omjego/cpp-httplib that referenced this pull request Oct 2, 2020
yhirose added a commit that referenced this pull request Oct 2, 2020
* Fix memory leak due caused due to X509_STORE

* Add test for repro and address sanitizer to compiler flags

* Add comment

* Sync

* Associate ca_store with ssl context within set_ca_cert_store()

* Split SlowPost test

* Fix #674

Co-authored-by: yhirose <yuji.hirose.bug@gmail.com>
ExclusiveOrange pushed a commit to ExclusiveOrange/cpp-httplib-exor that referenced this pull request May 2, 2023
ExclusiveOrange pushed a commit to ExclusiveOrange/cpp-httplib-exor that referenced this pull request May 2, 2023
* Fix memory leak due caused due to X509_STORE

* Add test for repro and address sanitizer to compiler flags

* Add comment

* Sync

* Associate ca_store with ssl context within set_ca_cert_store()

* Split SlowPost test

* Fix yhirose#674

Co-authored-by: yhirose <yuji.hirose.bug@gmail.com>
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

Successfully merging this pull request may close these issues.

2 participants