Author: dsahlberg
Date: Thu Jan 1 10:39:04 2026
New Revision: 1931030
Log:
In the SERF-195 branch:
Catchup merge from trunk @1931029
Modified:
serf/branches/SERF-195/ (props changed)
serf/branches/SERF-195/CMakeLists.txt
serf/branches/SERF-195/buckets/hpack_huffman.py
serf/branches/SERF-195/build/FindBrotli.cmake
serf/branches/SERF-195/test/serf_get.c
serf/branches/SERF-195/test/test_ssl.c
Modified: serf/branches/SERF-195/CMakeLists.txt
==============================================================================
--- serf/branches/SERF-195/CMakeLists.txt Thu Jan 1 08:30:20 2026
(r1931029)
+++ serf/branches/SERF-195/CMakeLists.txt Thu Jan 1 10:39:04 2026
(r1931030)
@@ -391,11 +391,11 @@ CheckFunction("SSL_library_init" "" "SER
CheckHeader("stdbool.h" "HAVE_STDBOOL_H=1")
CheckType("OSSL_HANDSHAKE_STATE" "openssl/ssl.h"
"SERF_HAVE_OSSL_HANDSHAKE_STATE" ${OPENSSL_INCLUDE_DIR})
if(Brotli_FOUND)
- CheckType("BrotliDecoderResult" "brotli/decode.h"
"SERF_HAVE_BROTLI_DECODER_RESULT" ${BROTLI_INCLUDES})
+ CheckType("BrotliDecoderResult" "brotli/decode.h"
"SERF_HAVE_BROTLI_DECODER_RESULT" ${BROTLI_INCLUDE_DIR})
# Check for the function only if the type check succeeded.
if("SERF_HAVE_BROTLI_DECODER_RESULT" IN_LIST SERF_C_DEFINES)
CheckFunction("BrotliDecoderTakeOutput" "NULL, NULL" "SERF_HAVE_BROTLI"
- "brotli/decode.h" ${BROTLI_INCLUDES}
+ "brotli/decode.h" ${BROTLI_INCLUDE_DIR}
Brotli::Decode ${SERF_STANDARD_LIBRARIES})
endif()
endif()
Modified: serf/branches/SERF-195/buckets/hpack_huffman.py
==============================================================================
--- serf/branches/SERF-195/buckets/hpack_huffman.py Thu Jan 1 08:30:20
2026 (r1931029)
+++ serf/branches/SERF-195/buckets/hpack_huffman.py Thu Jan 1 10:39:04
2026 (r1931030)
@@ -391,13 +391,13 @@ for line in rfc_text.split('\n'):
bits = int(m.group(4))
if len(bitvals) != bits:
- print '%d vs %d (%s)' %(len(bitvals), bits, bitvals)
+ print('%d vs %d (%s)' % (len(bitvals), bits, bitvals))
continue
shift = hex << (32 - bits)
if '{0:032b}'.format(shift)[0:bits] != bitvals:
- print '%s vs %s' % ('{0:032b}'.format(shift)[0:bits], bitvals)
+ print('%s vs %s' % ('{0:032b}'.format(shift)[0:bits], bitvals))
continue
mask = 0
@@ -411,19 +411,19 @@ items = sorted(items, key=lambda x:x[1])
if len(items) != 257:
raise Exception('There should be exactly 257 items')
-print '/*****************************************************'
-print ' * Generated code *'
-print ' *****************************************************'
-print ' * Please edit hpack_huffman.py instead of this file *'
-print ' * to recreate this file *'
-print ' *****************************************************/'
-print ''
-print 'static const struct serf_hpack_huffman_item_t {'
-print ' apr_uint32_t hval; /* Huffman code shifted to most left bit */'
-print ' apr_uint32_t hmask; /* Mask of bits used in this code */'
-print ' apr_int16_t bits; /* Nr of bits used */'
-print ' apr_int16_t cval; /* The character value of this code */'
-print '} serf_hpack_hm_map[] = {'
+print('/*****************************************************')
+print(' * Generated code *')
+print(' *****************************************************')
+print(' * Please edit hpack_huffman.py instead of this file *')
+print(' * to recreate this file *')
+print(' *****************************************************/')
+print('')
+print('static const struct serf_hpack_huffman_item_t {')
+print(' apr_uint32_t hval; /* Huffman code shifted to most left bit */')
+print(' apr_uint32_t hmask; /* Mask of bits used in this code */')
+print(' apr_int16_t bits; /* Nr of bits used */')
+print(' apr_int16_t cval; /* The character value of this code */')
+print('} serf_hpack_hm_map[] = {')
n = 1
map = {}
for i in items:
@@ -431,25 +431,25 @@ for i in items:
comma = ','
else:
comma = ' '
- print ' { 0x%08x, 0x%08x, %2d, %3d }%s /* %s */' % \
- (i[0], i[1], i[2], i[3], comma, i[4])
+ print(' { 0x%08x, 0x%08x, %2d, %3d }%s /* %s */'
+ % (i[0], i[1], i[2], i[3], comma, i[4]))
map[i[3]] = n-1
n += 1
-print '};'
-print ''
+print('};')
+print('')
-print '/* Maps chars to records in serf_hpack_hm_map. */'
-print 'static const apr_int16_t serf_hpack_hm_rmap[] = {'
+print('/* Maps chars to records in serf_hpack_hm_map. */')
+print('static const apr_int16_t serf_hpack_hm_rmap[] = {')
for i in range(0,257):
if i < 256:
comma = ','
else:
comma = ''
if i % 8 != 7:
- print ' %3d%s' % (map[i], comma),
+ print(' %3d%s' % (map[i], comma), end=" ")
else:
- print ' %3d%s' % (map[i], comma)
-print ''
-print '};'
-print ''
+ print(' %3d%s' % (map[i], comma))
+print('')
+print('};')
+print('')
Modified: serf/branches/SERF-195/build/FindBrotli.cmake
==============================================================================
--- serf/branches/SERF-195/build/FindBrotli.cmake Thu Jan 1 08:30:20
2026 (r1931029)
+++ serf/branches/SERF-195/build/FindBrotli.cmake Thu Jan 1 10:39:04
2026 (r1931030)
@@ -53,7 +53,7 @@ function(_get_brotli_includes_libs)
find_library(encode_lib NAMES "brotlienc"
PATH_SUFFIXES "lib" "${CMAKE_INSTALL_LIBDIR}")
- set(BROTLI_INCLUDES "${includes}" PARENT_SCOPE)
+ set(BROTLI_INCLUDE_DIR "${includes}" PARENT_SCOPE)
set(BROTLI_COMMON_LIBRARY "${common_lib}" PARENT_SCOPE)
set(BROTLI_DECODE_LIBRARY "${decode_lib}" PARENT_SCOPE)
set(BROTLI_ENCODE_LIBRARY "${encode_lib}" PARENT_SCOPE)
@@ -65,9 +65,9 @@ endif()
_get_brotli_version()
_get_brotli_includes_libs()
-if(NOT EXISTS "${BROTLI_INCLUDES}/brotli/decode.h"
- OR NOT EXISTS "${BROTLI_INCLUDES}/brotli/encode.h"
- OR NOT EXISTS "${BROTLI_INCLUDES}/brotli/types.h")
+if(NOT EXISTS "${BROTLI_INCLUDE_DIR}/brotli/decode.h"
+ OR NOT EXISTS "${BROTLI_INCLUDE_DIR}/brotli/encode.h"
+ OR NOT EXISTS "${BROTLI_INCLUDE_DIR}/brotli/types.h")
message(STATUS "Could NOT find Brotli (missing headers)")
else()
include(FindPackageHandleStandardArgs)
@@ -75,23 +75,23 @@ else()
REQUIRED_VARS BROTLI_COMMON_LIBRARY
BROTLI_DECODE_LIBRARY
BROTLI_ENCODE_LIBRARY
- BROTLI_INCLUDES
+ BROTLI_INCLUDE_DIR
VERSION_VAR BROTLI_VERSION)
if(Brotli_FOUND)
add_library(Brotli::Common UNKNOWN IMPORTED)
set_target_properties(Brotli::Common PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}"
IMPORTED_LOCATION "${BROTLI_COMMON_LIBRARY}")
add_library(Brotli::Decode UNKNOWN IMPORTED)
set_target_properties(Brotli::Decode PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES Brotli::Common
IMPORTED_LOCATION "${BROTLI_DECODE_LIBRARY}")
add_library(Brotli::Encode UNKNOWN IMPORTED)
set_target_properties(Brotli::Encode PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDES}"
+ INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES Brotli::Common
IMPORTED_LOCATION "${BROTLI_ENCODE_LIBRARY}")
endif()
Modified: serf/branches/SERF-195/test/serf_get.c
==============================================================================
--- serf/branches/SERF-195/test/serf_get.c Thu Jan 1 08:30:20 2026
(r1931029)
+++ serf/branches/SERF-195/test/serf_get.c Thu Jan 1 10:39:04 2026
(r1931030)
@@ -590,6 +590,9 @@ int main(int argc, const char **argv)
apr_getopt_t *opt;
int opt_c;
const char *opt_arg;
+ unsigned int prev_min_pending = 0;
+ unsigned int prev_max_pending = UINT_MAX;
+ unsigned int prev_all_pending = 0;
apr_initialize();
atexit(apr_terminate);
@@ -834,7 +837,7 @@ int main(int argc, const char **argv)
/* ### Connection or Context should have an allocator? */
app_ctx.bkt_alloc = bkt_alloc;
- connections = apr_pcalloc(pool, conn_count * sizeof(serf_connection_t*));
+ connections = apr_pcalloc(pool, conn_count * sizeof(*connections));
for (i = 0; i < conn_count; i++)
{
conn_baton_t *conn_ctx = apr_pcalloc(pool, sizeof(*conn_ctx));
@@ -910,6 +913,30 @@ int main(int argc, const char **argv)
break;
}
/* Debugging purposes only! */
+ if (debug) {
+ unsigned int min_pending = UINT_MAX;
+ unsigned int max_pending = 0;
+ unsigned int all_pending = 0;
+ for (i = 0; i < conn_count; i++) {
+ serf_connection_t *conn = connections[i];
+ unsigned int pending = (serf_connection_pending_requests(conn)
+ -
serf_connection_queued_requests(conn));
+ all_pending += pending;
+ if (min_pending > pending) min_pending = pending;
+ if (max_pending < pending) max_pending = pending;
+ }
+ if (prev_min_pending != min_pending
+ || prev_max_pending != max_pending
+ || prev_all_pending != all_pending)
+ {
+ fprintf(stderr, ">pending: %u [avg=%0.1f min=%u max=%u]\n",
+ all_pending, (double)all_pending/conn_count,
+ min_pending, max_pending);
+ prev_min_pending = min_pending;
+ prev_max_pending = max_pending;
+ prev_all_pending = all_pending;
+ }
+ }
serf_debug__closed_conn(app_ctx.bkt_alloc);
}
Modified: serf/branches/SERF-195/test/test_ssl.c
==============================================================================
--- serf/branches/SERF-195/test/test_ssl.c Thu Jan 1 08:30:20 2026
(r1931029)
+++ serf/branches/SERF-195/test/test_ssl.c Thu Jan 1 10:39:04 2026
(r1931030)
@@ -1394,12 +1394,22 @@ static void test_ssl_revoked_server_cert
certificate. OpenSSL may call the application multiple times per depth,
e.g. once to tell that the cert is revoked, and a second time to tell
that the certificate itself is valid. */
+#if defined(OPENSSL_VERSION_PREREQ) && OPENSSL_VERSION_PREREQ(3, 6)
+ /* In OpenSSL 3.6, error handling changed so that only the
+ first instance of CERT_UNABLE_TO_GET_CRL is reported. */
+ CuAssertStrEquals(tc,
+ "cert_cb: failures = CERT_REVOKED, cert = (CN=localhost, depth=0)\n"
+ "cert_cb: failures = CERT_UNABLE_TO_GET_CRL, cert = (CN=Serf CA,
depth=1)\n"
+ "cert_cb: failures = NONE, cert = (CN=localhost, depth=0)\n",
+ tb->user_baton);
+#else
CuAssertStrEquals(tc,
"cert_cb: failures = CERT_REVOKED, cert = (CN=localhost, depth=0)\n"
"cert_cb: failures = CERT_UNABLE_TO_GET_CRL, cert = (CN=Serf CA,
depth=1)\n"
"cert_cb: failures = CERT_UNABLE_TO_GET_CRL, cert = (CN=Serf Root CA,
depth=2)\n"
"cert_cb: failures = NONE, cert = (CN=localhost, depth=0)\n",
tb->user_baton);
+#endif
}
/* Test if serf is sets up an SSL tunnel to the proxy and doesn't contact the
@@ -2784,7 +2794,7 @@ static void test_ssl_ocsp_verify_respons
{
#ifndef OPENSSL_NO_OCSP
apr_status_t status = verify_ocsp_response(tc, 1, 0, 0, 0);
-#if OPENSSL_VERSION_NUMBER >= (3 << 28) /* OpenSSL 3.0.0 */
+#if defined(OPENSSL_VERSION_PREREQ) && OPENSSL_VERSION_PREREQ(3, 0)
/* OCSP responses MUST be signed, and on newer versions of OpenSSL we
can't even create one without a signature. This error doesn't come
from response validation but because OCSP_response_create() fails. */