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

update SSL options for windows #6

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

Conversation

leobm
Copy link

@leobm leobm commented Mar 9, 2021

Hi Sean,

I have discovered another problem under windows. HTTPS calls did not work. I had not tested this :(

Now I have set the CURLOPT_SSL_OPTIONS to CURLSSLOPT_NATIVE_CA for this.
Maybe you can test if this has an effect in a Linux environment? Actually this option should only matter for Windows,
if I understood the documentation correctly.

That is one option, the other option would be to set the CURLOPT_CAINFO option and to set the path to the curl-ca-bundle.crt file.
First I also copied this curl-ca-bundle.crt to the JANET_BINPATH and set the options to this path. But this would be more cumbersome, because I would have to do a special handling for Windows again.


Unfortunately I discovered another serious problem under windows. It has nothing to do with SSL. Unfortunately I haven't found a solution yet.

The problem is, when I call the c_send_request function for the second time, the program crashes on the second call of curl_global_cleanup();
If I comment out this function call, the c_send_request this function runs as expected.
But that can't be the right way :( Unfortunately I don't have a solution for it yet.

The documentation for libcurl has the following note:
"curl_global_cleanup does not block waiting for any libcurl-created threads to terminate (such as threads used for name resolving). If a module containing libcurl is dynamically unloaded while libcurl-created threads are still running then your program may crash or other corruption may occur. We recommend you do not run libcurl from any module that may be unloaded dynamically. This behavior may be addressed in the future. "

I think somehow here is the problem?

Edit:
Here is also another ticket about a similar problem? Maybe the same?
curl/curl#997 (comment)

Maybe don't merge this pull request after all.
I will try a reproduce the problem in the next days, without a dependency to Janet.
Maybe the problem has nothing to do with Janet itself.
I think I also need to understand the Microsoft compiler and linker a bit better.
libcurl can somehow be linked statically or danamically (libcurl.a (for static linking) and libcurldll.a (for dynamic linking)).

Sorry, I thought it would be easier.

Greetings

Jan-Felix

@swlkr
Copy link
Contributor

swlkr commented Mar 16, 2021

Hm, well let me know if you get it sorted, I'll leave this open for now

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.

None yet

2 participants