From 7682e5d7814344ccf2effb92c5612ffe5ec646d2 Mon Sep 17 00:00:00 2001 From: George Wang Date: Thu, 28 Mar 2024 11:20:09 -0400 Subject: [PATCH] Check in 1.7.19.3 --- src/extensions/proxy/proxyconn.cpp | 2 ++ src/http/httpreq.cpp | 9 ++++++++- src/http/httpvhost.cpp | 4 ++-- src/http/stderrlogger.cpp | 2 +- src/main/httpserver.cpp | 2 +- src/main/lshttpdmain.cpp | 2 +- src/main/plainconf.cpp | 2 +- src/modules/cache/cache.cpp | 18 +++++++++++++----- src/modules/modsecurity-ls/CMakeLists.txt | 2 +- src/modules/modsecurity-ls/Makefile.f | 2 +- test/CMakeLists.txt | 2 +- 11 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/extensions/proxy/proxyconn.cpp b/src/extensions/proxy/proxyconn.cpp index cb79f0637..6510d3ee1 100644 --- a/src/extensions/proxy/proxyconn.cpp +++ b/src/extensions/proxy/proxyconn.cpp @@ -250,6 +250,8 @@ int ProxyConn::sendReqHeader() if (pSession->shouldIncludePeerAddr()) headerLen = addForwardedFor(pBegin); + if (pReq->isHeaderSet(HttpHeader::H_TRANSFER_ENCODING)) + pReq->dropReqHeader(HttpHeader::H_TRANSFER_ENCODING); #if 1 //always set "Accept-Encoding" header to "gzip" char *pAE = (char *)pReq->getHeader(HttpHeader::H_ACC_ENCODING); diff --git a/src/http/httpreq.cpp b/src/http/httpreq.cpp index 764b311bc..06fad3cb7 100644 --- a/src/http/httpreq.cpp +++ b/src/http/httpreq.cpp @@ -898,6 +898,11 @@ int HttpReq::processHeaderLines() { if (index == HttpHeader::H_HOST) *((char *)pLineBegin + 3) = '2'; + else if (index == HttpHeader::H_TRANSFER_ENCODING) + { + LS_INFO(getLogSession(), "Remove duplicate transfer-encoding header!"); + memset((void *)pLineBegin, 'x', nameLen); + } index = HttpHeader::H_HEADER_END; } } @@ -1133,7 +1138,8 @@ int HttpReq::processHeader(int index) LS_INFO(getLogSession(), "Status 400: bad Transfer-Encoding starts with ','!"); return SC_400; } - if (strncasecmp(pCur, "chunked", 7) == 0) + if (strncasecmp(pCur, "chunked", 7) == 0 + && m_commonHeaderLen[index] == 7) { if (getMethod() <= HttpMethod::HTTP_HEAD) return SC_400; @@ -2759,6 +2765,7 @@ void HttpReq::tranEncodeToContentLen() pBegin + 16 - m_headerBuf.begin(); m_commonHeaderLen[ HttpHeader::H_CONTENT_LENGTH] = n - 16; m_lEntityLength = m_lEntityFinished; + m_commonHeaderOffset[HttpHeader::H_TRANSFER_ENCODING] = 0; } diff --git a/src/http/httpvhost.cpp b/src/http/httpvhost.cpp index d1e816e1b..4c59a63d9 100644 --- a/src/http/httpvhost.cpp +++ b/src/http/httpvhost.cpp @@ -1961,7 +1961,7 @@ int HttpVHost::configNodeJsStarter(char *pRunnerCmd, int cmdLen, const char *pBinPath) { const char *defaultBin[2] = { "/usr/local/bin/node", "/usr/bin/node" }; - if (!pBinPath) + if (!pBinPath || !*pBinPath) { for (int i = 0; i < 2; ++i) { @@ -1972,7 +1972,7 @@ int HttpVHost::configNodeJsStarter(char *pRunnerCmd, int cmdLen, } } } - if (!pBinPath) + if (!pBinPath || !*pBinPath) { LS_NOTICE("[%s] Cannot find node interpreter, node easy configuration " "is turned off", TmpLogId::getLogId()); diff --git a/src/http/stderrlogger.cpp b/src/http/stderrlogger.cpp index 0d80ad7b6..9a0088374 100644 --- a/src/http/stderrlogger.cpp +++ b/src/http/stderrlogger.cpp @@ -121,7 +121,7 @@ int StdErrLogger::setLogFileName(const char *pName) const char *StdErrLogger::getLogFileName() const -{ return m_pAppender->getName(); } +{ return m_pAppender ? m_pAppender->getName() : NULL; } int StdErrLogger::initLogger(Multiplexer *pMultiplexer) diff --git a/src/main/httpserver.cpp b/src/main/httpserver.cpp index 4e8dc9ce6..1deb2dd21 100644 --- a/src/main/httpserver.cpp +++ b/src/main/httpserver.cpp @@ -4220,7 +4220,7 @@ int HttpServerImpl::initQuic(const XmlNode *pNode) settings.es_max_sfcw = GET_VAL(pNode, "quicMaxSfcw", 64 * 1024, 128 * 1024 * 1024, 0); settings.es_max_streams_in - = GET_VAL(pNode, "quicMaxIncomingStreams", + = GET_VAL(pNode, "quicMaxStreams", 10, 1000, 500); settings.es_init_max_streams_bidi = GET_VAL(pNode, "quicInitMaxIncomingStreamsBidi", diff --git a/src/main/lshttpdmain.cpp b/src/main/lshttpdmain.cpp index e2997eeb5..7e9f860a2 100644 --- a/src/main/lshttpdmain.cpp +++ b/src/main/lshttpdmain.cpp @@ -81,7 +81,7 @@ /*** * Do not change the below format, it will be set correctly while packing the code */ -#define BUILDTIME "built: Mon Feb 5 23:11:12 UTC 2024" +#define BUILDTIME "built: Thu Mar 28 14:44:42 UTC 2024" static const char s_pVersionFull[] = "LiteSpeed/" PACKAGE_VERSION " Open (" LS_MODULE_VERSION_INFO_ONELINE ") BUILD (" BUILDTIME ")"; diff --git a/src/main/plainconf.cpp b/src/main/plainconf.cpp index a44f20558..e6417f540 100644 --- a/src/main/plainconf.cpp +++ b/src/main/plainconf.cpp @@ -431,7 +431,7 @@ plainconfKeywords plainconf::sKeywords[] = {"quicmaxcfcw", NULL}, {"quicsfcw", NULL}, {"quicmaxsfcw", NULL}, - {"quicmaxincomingstreams", NULL}, + {"quicmaxstreams", NULL}, {"quicInitMaxIncomingStreamsBidi", NULL}, {"quichandshaketimeout", NULL}, {"quicidletimeout", NULL}, diff --git a/src/modules/cache/cache.cpp b/src/modules/cache/cache.cpp index 2d516877e..eeb8ae926 100644 --- a/src/modules/cache/cache.cpp +++ b/src/modules/cache/cache.cpp @@ -262,8 +262,8 @@ static void house_keeping_cb(const void *p) { pStore->houseKeeping(); pStore->cleanByTracking(100, 100); - g_api->log(NULL, LSI_LOG_DEBUG, "[%s]house_keeping_cb with store %p.\n", - ModuleNameStr, pStore); + //g_api->log(NULL, LSI_LOG_DEBUG, "[%s]house_keeping_cb with store %p.\n", + // ModuleNameStr, pStore); } } @@ -834,7 +834,15 @@ static int32_t getVaryFlag(const lsi_session_t *session, CacheConfig *pConfig) ModuleNameStr, (*iter)->len(), (*iter)->c_str()); continue; } - flag |= (1 << index); + if (index == LSI_HDR_COOKIE) + g_api->log(session, LSI_LOG_DEBUG, "[%s] skip vary on full cookie header", + ModuleNameStr); + else + { g_api->log(session, LSI_LOG_DEBUG, "[%s] add vary request header" + " \"%.*s\" with index %d.\n", + ModuleNameStr, (*iter)->len(), (*iter)->c_str(), index); + flag |= (1 << index); + } } } @@ -2820,8 +2828,8 @@ static int checkAssignHandler(lsi_param_t *rec) rec->session, &MNAME); if (!pConfig) { - g_api->log(rec->session, LSI_LOG_ERROR, - "[%s] checkAssignHandler config error.\n", ModuleNameStr); + g_api->log(rec->session, LSI_LOG_DEBUG, + "[%s] checkAssignHandler no configuration.\n", ModuleNameStr); return bypassUrimapHook(rec, myData); } diff --git a/src/modules/modsecurity-ls/CMakeLists.txt b/src/modules/modsecurity-ls/CMakeLists.txt index 680a89bcb..13e7eb0c9 100644 --- a/src/modules/modsecurity-ls/CMakeLists.txt +++ b/src/modules/modsecurity-ls/CMakeLists.txt @@ -30,7 +30,7 @@ add_library(mod_security SHARED target_link_libraries(mod_security libmodsecurity.a -nodefaultlibs libstdc++.a - pthread rt -llmdb -lxml2 -lcurl -lGeoIP -lssl -lcrypto -lz -lpcre -lyajl + pthread rt -llmdb -lxml2 -lcurl -lssl -lcrypto -lz -lpcre -lyajl ${LIBSAN} crypt m gcc_eh c c_nonshared gcc) set_target_properties(mod_security PROPERTIES PREFIX "") diff --git a/src/modules/modsecurity-ls/Makefile.f b/src/modules/modsecurity-ls/Makefile.f index cf4828a95..ad22f5be8 100644 --- a/src/modules/modsecurity-ls/Makefile.f +++ b/src/modules/modsecurity-ls/Makefile.f @@ -4,7 +4,7 @@ LIBFLAGS := $(shell pwd)/ModSecurity/src/.libs/libmodsecurity.a -lxml2 -lcurl -lyajl ifeq ($(BUILDSTATIC), 1) - ALLLIB := -nodefaultlibs $(shell g++ -print-file-name='libstdc++.a') -lm -lc -lssl -lcrypto -lpthread -lGeoIP -lz -lpcre -lyajl -lgcc_eh -lc_nonshared -lgcc + ALLLIB := -nodefaultlibs $(shell g++ -print-file-name='libstdc++.a') -lm -lc -lssl -lcrypto -lpthread -lz -lpcre -lyajl -lgcc_eh -lc_nonshared -lgcc LIBFLAGS := -L$(shell pwd)/../../../../../../thirdparty/lib -lmodsecurity -lxml2 -lcurl -lyajl endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6de7778fd..b5fb0e74d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -162,7 +162,7 @@ set ( libUnitTest UnitTest++ ) SET( unittestlib modgzip cache lsiapi main http lsiapi ssi registry cgi fcgi jk extensions lsapi proxy - socket sslpp lsshm thread log4cxx GeoIP adns + socket sslpp lsshm thread log4cxx adns quic h2 lsquic bcrypt -Wl,--whole-archive util lsr -Wl,--no-whole-archive edio udns pthread rt ${CMAKE_DL_LIBS} ${libUnitTest} ${BSSL_ADD_LIB}