[PATCH 3 of 3] Win32: fixed build on Windows with OpenSSL 3.0.x (ticket #2379)

Maxim Dounin mdounin at mdounin.ru
Thu Sep 1 16:49:07 UTC 2022


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1662050858 -10800
#      Thu Sep 01 19:47:38 2022 +0300
# Node ID d73286c43b44f3161ca4de1d9d1cbb070c6da4a7
# Parent  63a4b5ffd440c526bc96c6879dc1b6b489975d98
Win32: fixed build on Windows with OpenSSL 3.0.x (ticket #2379).

SSL_sendfile() expects integer file descriptor as an argument, but nginx
uses OS file handles (HANDLE) to work with files on Windows, and passing
HANDLE instead of an integer correctly results in build failure.  Since
SSL_sendfile() is not expected to work on Windows anyway, the code is now
disabled on Windows with appropriate compile-time checks.

diff -r 63a4b5ffd440 -r d73286c43b44 src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c	Thu Sep 01 19:45:22 2022 +0300
+++ b/src/event/ngx_event_openssl.c	Thu Sep 01 19:47:38 2022 +0300
@@ -1770,7 +1770,7 @@ ngx_ssl_handshake(ngx_connection_t *c)
 #endif
 #endif
 
-#ifdef BIO_get_ktls_send
+#if (defined BIO_get_ktls_send && !NGX_WIN32)
 
         if (BIO_get_ktls_send(SSL_get_wbio(c->ssl->connection)) == 1) {
             ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
@@ -1915,7 +1915,7 @@ ngx_ssl_try_early_data(ngx_connection_t 
         c->read->ready = 1;
         c->write->ready = 1;
 
-#ifdef BIO_get_ktls_send
+#if (defined BIO_get_ktls_send && !NGX_WIN32)
 
         if (BIO_get_ktls_send(SSL_get_wbio(c->ssl->connection)) == 1) {
             ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
@@ -2944,7 +2944,7 @@ ngx_ssl_write_early(ngx_connection_t *c,
 static ssize_t
 ngx_ssl_sendfile(ngx_connection_t *c, ngx_buf_t *file, size_t size)
 {
-#ifdef BIO_get_ktls_send
+#if (defined BIO_get_ktls_send && !NGX_WIN32)
 
     int        sslerr, flags;
     ssize_t    n;



More information about the nginx-devel mailing list