feat(net, veb): add OpenSSL-based HTTPS server support#27480
Open
guweigang wants to merge 1 commit into
Open
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements OpenSSL-based HTTPS server capabilities in
net.openssland integrates it into thevebweb framework. Previously,vebonly supported running HTTPS servers usingnet.mbedtls. When compiling with-d use_openssl,vebHTTPS servers were unavailable and would return a compile/runtime error.Details of Changes
net.openssl:C.TLS_server_method,C.SSL_CTX_check_private_key,C.SSL_accept, andC.ERR_print_errors_fp.SSLListeneralong withnew_ssl_listener(saddr, config)andshutdown().accept_without_handshake()andaccept_handshake(). This allows V's concurrent applications (likeveb) to accept sockets on the main thread and perform slow TLS handshakes concurrently in spawned coroutines, avoiding blocking the main event loop.net.ssl:SSLListenerandnew_ssl_listenerdynamically in bothssl_d_use_openssl.vandssl_notd_use_openssl.vto keep the unified wrapper layer consistent.veb:vlib/veb/ssl_d_use_openssl.vto utilize the newopenssl.SSLListener. When compiled with-d use_openssl,vebnow properly runs HTTPS servers using OpenSSL while completely excluding any link dependencies tombedtls.accept_handshake().Tests:
vlib/net/openssl/openssl_sslconn_shutdown_does_not_panic_test.vto verify OpenSSL server binding, client dialing, handshaking, and clean connection shutdowns without panicking or double-freeing.ssl_test.vinto two platform-specific/define-specific test files:ssl_test_d_use_openssl.v(for testing OpenSSL HTTPS) andssl_test_notd_use_openssl.v(for testing MbedTLS HTTPS) to avoid unknown module compiler issues.Checklist
v fmt -w.Tests Run
All tests passed successfully on local machine.