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

seeds SetSSLContextCallback #178

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aryanbdps9
Copy link

@aryanbdps9 aryanbdps9 commented Jun 22, 2022

There should be a way to set SSL context callback function (CURLOPT_SSL_CTX_FUNCTION). Personally, I needed to call SSL_CTX_set_default_verify_paths inside this callback, but it could be useful to others as well.

Sample code:

static CURLcode sslctx_fn(CURL *curl, void *sslctx, void *parm)
{
  // Do whatever you want, for example:
  // SSL_CTX_set_default_verify_paths(static_cast<SSL_CTX*>(sslctx));

  // Return CURLE_OK if everything looks fine.
  return CURLE_OK;
}

void foo()
{
  ...

  conn->SetVerifyPeer(true);
  conn->SetSSLContextCallback(*sslctx_fn);
  RestClient::Response res = conn->get("/get");
  EXPECT_EQ(200, res.code);
}

Checklist

Not all of these might apply to your change but the more you are able to check
the easier it will be to get your contribution merged.

  • CI passes
  • Description of proposed change
  • Existing issue is referenced if there is one
  • Documentation (README, code doc blocks, etc) is updated
  • Unit tests for the proposed change

@aryanbdps9
Copy link
Author

When I try to build gtest, it fails in the autoreconf -i step:

<project-root>/vendor/gtest-1.7.0$ autoreconf -i
Makefile.am:183: error: Libtool library used but 'LIBTOOL' is undefined
Makefile.am:183:   The usual way to define 'LIBTOOL' is to add 'LT_INIT'
Makefile.am:183:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
Makefile.am:183:   If 'LT_INIT' is in 'configure.ac', make sure
Makefile.am:183:   its definition is in aclocal's search path.
autoreconf: automake failed with exit status: 1

P.S.: I tried with this change on our client code. It's working.

@aryanbdps9 aryanbdps9 marked this pull request as ready for review June 22, 2022 20:31
@aryanbdps9
Copy link
Author

This example shows a sample use case of calling SSL_CTX_set_default_verify_paths (although it's boost, but I hope you get the idea).

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.

1 participant