Skip to content

[FIXED] SSL callback #858

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

[FIXED] SSL callback #858

wants to merge 4 commits into from

Conversation

mtmk
Copy link
Member

@mtmk mtmk commented Mar 6, 2025

Remove openssl dependency in nats.h.

Remove openssl dependency in nats.h.
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.35%. Comparing base (1553d4a) to head (8b1e1ac).
Report is 58 commits behind head on main.

Files with missing lines Patch % Lines
src/conn.c 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #858      +/-   ##
==========================================
+ Coverage   68.71%   70.35%   +1.64%     
==========================================
  Files          39       47       +8     
  Lines       15207    15429     +222     
  Branches     3143     3167      +24     
==========================================
+ Hits        10449    10855     +406     
+ Misses       1700     1527     -173     
+ Partials     3058     3047      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for a nit, LGTM. But I don't remember a case where we had to remove an API, but deprecating the existing one is not possible since it uses an SSL structure in the definition, so I guess we have no choice. Will let @levb decide if we go with this approach.

src/conn.c Outdated
SSL_set_verify(ssl, SSL_VERIFY_PEER, nc->opts->sslCtx->callback != NULL ? nc->opts->sslCtx->callback : _collectSSLErr);
{
if (nc->opts->sslCtx->callback != NULL)
nc->opts->sslCtx->callback(ssl);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I guess it should be (void*)ssl to comply with the callback definition.

This is to comply with the callback definition.
@levb levb marked this pull request as ready for review March 12, 2025 17:20
# Conflicts:
#	src/conn.c
#	src/nats.h
#	src/natsp.h
@mtmk
Copy link
Member Author

mtmk commented Apr 17, 2025

@lev @kozlovic @ckasabula
I would like to put this proposal on the table again for the next minor version:

  • Removes Experimental API tag making it available for vcpkg users
  • Simple change removes openssl.h dependency from nats.h
  • Similar to cURL library API
  • @ckasabula's original API proposal which especially creates a very convenient way of dealing with certs can still be added on top of this later (Add SSL cert validation callback #825)

@mtmk mtmk requested a review from levb April 17, 2025 22:27
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