diff -u -r -N squid-6.0.3/ChangeLog squid-6.1/ChangeLog --- squid-6.0.3/ChangeLog 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/ChangeLog 2023-07-06 17:15:40.000000000 +1200 @@ -1,3 +1,11 @@ +Changes in squid-6.1 (06 Jul 2023): + + - Bug 5278: Log %err_code for "early" request handling errors + - Do not cache (and do not serve cached) cache manager responses + - Fix key equality comparison in LookupTable map + - Honor DNS RR TTLs larger than negative_dns_ttl + - ... and some documentation changes + Changes in squid-6.0.3 (07 Jun 2023): - Bug 5148: Log %Ss of failed tunnels as TCP_TUNNEL diff -u -r -N squid-6.0.3/configure squid-6.1/configure --- squid-6.0.3/configure 2023-06-07 06:49:22.000000000 +1200 +++ squid-6.1/configure 2023-07-06 17:28:38.000000000 +1200 @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Revision. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for Squid Web Proxy 6.0.3. +# Generated by GNU Autoconf 2.71 for Squid Web Proxy 6.1. # # Report bugs to . # @@ -626,8 +626,8 @@ # Identity of this package. PACKAGE_NAME='Squid Web Proxy' PACKAGE_TARNAME='squid' -PACKAGE_VERSION='6.0.3' -PACKAGE_STRING='Squid Web Proxy 6.0.3' +PACKAGE_VERSION='6.1' +PACKAGE_STRING='Squid Web Proxy 6.1' PACKAGE_BUGREPORT='http://bugs.squid-cache.org/' PACKAGE_URL='' @@ -1696,7 +1696,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Squid Web Proxy 6.0.3 to adapt to many kinds of systems. +\`configure' configures Squid Web Proxy 6.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1767,7 +1767,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Squid Web Proxy 6.0.3:";; + short | recursive ) echo "Configuration of Squid Web Proxy 6.1:";; esac cat <<\_ACEOF @@ -2187,7 +2187,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Squid Web Proxy configure 6.0.3 +Squid Web Proxy configure 6.1 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -3200,7 +3200,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Squid Web Proxy $as_me 6.0.3, which was +It was created by Squid Web Proxy $as_me 6.1, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -4692,7 +4692,7 @@ # Define the identity of the package. PACKAGE='squid' - VERSION='6.0.3' + VERSION='6.1' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -56854,7 +56854,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Squid Web Proxy $as_me 6.0.3, which was +This file was extended by Squid Web Proxy $as_me 6.1, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -56922,7 +56922,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -Squid Web Proxy config.status 6.0.3 +Squid Web Proxy config.status 6.1 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff -u -r -N squid-6.0.3/configure.ac squid-6.1/configure.ac --- squid-6.0.3/configure.ac 2023-06-07 06:49:22.000000000 +1200 +++ squid-6.1/configure.ac 2023-07-06 17:28:38.000000000 +1200 @@ -5,7 +5,7 @@ ## Please see the COPYING and CONTRIBUTORS files for details. ## -AC_INIT([Squid Web Proxy],[6.0.3],[http://bugs.squid-cache.org/],[squid]) +AC_INIT([Squid Web Proxy],[6.1],[http://bugs.squid-cache.org/],[squid]) AC_PREREQ(2.61) AC_CONFIG_HEADERS([include/autoconf.h]) AC_CONFIG_AUX_DIR(cfgaux) diff -u -r -N squid-6.0.3/doc/release-notes/release-6.html squid-6.1/doc/release-notes/release-6.html --- squid-6.0.3/doc/release-notes/release-6.html 2023-06-07 06:53:17.000000000 +1200 +++ squid-6.1/doc/release-notes/release-6.html 2023-07-06 17:32:46.000000000 +1200 @@ -1,12 +1,12 @@ - + - Squid 6.0.3 release notes + Squid 6.1 release notes -

Squid 6.0.3 release notes

+

Squid 6.1 release notes

Squid Developers

@@ -59,7 +59,7 @@


1. Notice

-

The Squid Team are pleased to announce the release of Squid-6.0.3 for testing.

+

The Squid Team are pleased to announce the release of Squid-6.1 for testing.

This new release is available for download from http://www.squid-cache.org/Versions/v6/ or the mirrors.

diff -u -r -N squid-6.0.3/include/version.h squid-6.1/include/version.h --- squid-6.0.3/include/version.h 2023-06-07 06:49:22.000000000 +1200 +++ squid-6.1/include/version.h 2023-07-06 17:28:38.000000000 +1200 @@ -10,7 +10,7 @@ #define SQUID_VERSION_H #ifndef SQUID_RELEASE_TIME -#define SQUID_RELEASE_TIME 1686077352 +#define SQUID_RELEASE_TIME 1688621308 #endif /* diff -u -r -N squid-6.0.3/RELEASENOTES.html squid-6.1/RELEASENOTES.html --- squid-6.0.3/RELEASENOTES.html 2023-06-07 06:53:17.000000000 +1200 +++ squid-6.1/RELEASENOTES.html 2023-07-06 17:32:46.000000000 +1200 @@ -1,12 +1,12 @@ - + - Squid 6.0.3 release notes + Squid 6.1 release notes -

Squid 6.0.3 release notes

+

Squid 6.1 release notes

Squid Developers

@@ -59,7 +59,7 @@


1. Notice

-

The Squid Team are pleased to announce the release of Squid-6.0.3 for testing.

+

The Squid Team are pleased to announce the release of Squid-6.1 for testing.

This new release is available for download from http://www.squid-cache.org/Versions/v6/ or the mirrors.

diff -u -r -N squid-6.0.3/src/acl/external/delayer/ext_delayer_acl.8 squid-6.1/src/acl/external/delayer/ext_delayer_acl.8 --- squid-6.0.3/src/acl/external/delayer/ext_delayer_acl.8 2023-06-07 06:53:22.000000000 +1200 +++ squid-6.1/src/acl/external/delayer/ext_delayer_acl.8 2023-07-06 17:32:52.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "EXT_DELAYER_ACL 8" -.TH EXT_DELAYER_ACL 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH EXT_DELAYER_ACL 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-6.0.3/src/acl/external/kerberos_sid_group/ext_kerberos_sid_group_acl.8 squid-6.1/src/acl/external/kerberos_sid_group/ext_kerberos_sid_group_acl.8 --- squid-6.0.3/src/acl/external/kerberos_sid_group/ext_kerberos_sid_group_acl.8 2023-06-07 06:53:22.000000000 +1200 +++ squid-6.1/src/acl/external/kerberos_sid_group/ext_kerberos_sid_group_acl.8 2023-07-06 17:32:52.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "EXT_KERBEROS_SID_GROUP_ACL 8" -.TH EXT_KERBEROS_SID_GROUP_ACL 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH EXT_KERBEROS_SID_GROUP_ACL 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-6.0.3/src/acl/external/SQL_session/ext_sql_session_acl.8 squid-6.1/src/acl/external/SQL_session/ext_sql_session_acl.8 --- squid-6.0.3/src/acl/external/SQL_session/ext_sql_session_acl.8 2023-06-07 06:53:22.000000000 +1200 +++ squid-6.1/src/acl/external/SQL_session/ext_sql_session_acl.8 2023-07-06 17:32:52.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "EXT_SQL_SESSION_ACL 8" -.TH EXT_SQL_SESSION_ACL 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH EXT_SQL_SESSION_ACL 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-6.0.3/src/acl/external/wbinfo_group/ext_wbinfo_group_acl.8 squid-6.1/src/acl/external/wbinfo_group/ext_wbinfo_group_acl.8 --- squid-6.0.3/src/acl/external/wbinfo_group/ext_wbinfo_group_acl.8 2023-06-07 06:53:22.000000000 +1200 +++ squid-6.1/src/acl/external/wbinfo_group/ext_wbinfo_group_acl.8 2023-07-06 17:32:52.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "EXT_WBINFO_GROUP_ACL 8" -.TH EXT_WBINFO_GROUP_ACL 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH EXT_WBINFO_GROUP_ACL 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-6.0.3/src/auth/basic/DB/basic_db_auth.8 squid-6.1/src/auth/basic/DB/basic_db_auth.8 --- squid-6.0.3/src/auth/basic/DB/basic_db_auth.8 2023-06-07 06:53:23.000000000 +1200 +++ squid-6.1/src/auth/basic/DB/basic_db_auth.8 2023-07-06 17:32:53.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BASIC_DB_AUTH 8" -.TH BASIC_DB_AUTH 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH BASIC_DB_AUTH 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-6.0.3/src/auth/basic/POP3/basic_pop3_auth.8 squid-6.1/src/auth/basic/POP3/basic_pop3_auth.8 --- squid-6.0.3/src/auth/basic/POP3/basic_pop3_auth.8 2023-06-07 06:53:23.000000000 +1200 +++ squid-6.1/src/auth/basic/POP3/basic_pop3_auth.8 2023-07-06 17:32:53.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BASIC_POP3_AUTH 8" -.TH BASIC_POP3_AUTH 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH BASIC_POP3_AUTH 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-6.0.3/src/base/LookupTable.h squid-6.1/src/base/LookupTable.h --- squid-6.0.3/src/base/LookupTable.h 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/base/LookupTable.h 2023-07-06 17:15:40.000000000 +1200 @@ -70,7 +70,7 @@ } private: - typedef std::unordered_map lookupTable_t; + using lookupTable_t = std::unordered_map; lookupTable_t lookupTable; EnumType invalidValue; }; diff -u -r -N squid-6.0.3/src/cache_manager.cc squid-6.1/src/cache_manager.cc --- squid-6.0.3/src/cache_manager.cc 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/cache_manager.cc 2023-07-06 17:15:40.000000000 +1200 @@ -17,6 +17,7 @@ #include "error/ExceptionErrorDetail.h" #include "errorpage.h" #include "fde.h" +#include "HttpHdrCc.h" #include "HttpReply.h" #include "HttpRequest.h" #include "mgr/Action.h" @@ -38,6 +39,7 @@ #include "wordlist.h" #include +#include /// \ingroup CacheManagerInternal #define MGR_PASSWD_SZ 128 @@ -369,14 +371,9 @@ */ rep->header.putAuth("Basic", actionName); #endif - // Allow cachemgr and other XHR scripts access to our version string - if (request->header.has(Http::HdrType::ORIGIN)) { - rep->header.putExt("Access-Control-Allow-Origin",request->header.getStr(Http::HdrType::ORIGIN)); -#if HAVE_AUTH_MODULE_BASIC - rep->header.putExt("Access-Control-Allow-Credentials","true"); -#endif - rep->header.putExt("Access-Control-Expose-Headers","Server"); - } + + const auto originOrNil = request->header.getStr(Http::HdrType::ORIGIN); + PutCommonResponseHeaders(*rep, originOrNil); /* store the reply */ entry->replaceHttpReply(rep); @@ -404,14 +401,10 @@ HttpReply *rep = err.BuildHttpReply(); if (strncmp(rep->body.content(),"Internal Error:", 15) == 0) rep->sline.set(Http::ProtocolVersion(1,1), Http::scNotFound); - // Allow cachemgr and other XHR scripts access to our version string - if (request->header.has(Http::HdrType::ORIGIN)) { - rep->header.putExt("Access-Control-Allow-Origin",request->header.getStr(Http::HdrType::ORIGIN)); -#if HAVE_AUTH_MODULE_BASIC - rep->header.putExt("Access-Control-Allow-Credentials","true"); -#endif - rep->header.putExt("Access-Control-Expose-Headers","Server"); - } + + const auto originOrNil = request->header.getStr(Http::HdrType::ORIGIN); + PutCommonResponseHeaders(*rep, originOrNil); + entry->replaceHttpReply(rep); entry->complete(); return; @@ -475,6 +468,27 @@ return nullptr; } +void +CacheManager::PutCommonResponseHeaders(HttpReply &response, const char *httpOrigin) +{ + // Allow cachemgr and other XHR scripts access to our version string + if (httpOrigin) { + response.header.putExt("Access-Control-Allow-Origin", httpOrigin); +#if HAVE_AUTH_MODULE_BASIC + response.header.putExt("Access-Control-Allow-Credentials", "true"); +#endif + response.header.putExt("Access-Control-Expose-Headers", "Server"); + } + + std::unique_ptr cc(new HttpHdrCc()); + // this is honored by more caches but allows pointless revalidation; + // revalidation will always fail because we do not support it (yet?) + cc->noCache(String()); + // this is honored by fewer caches but prohibits pointless revalidation + cc->noStore(true); + response.putCc(cc.release()); +} + CacheManager* CacheManager::GetInstance() { diff -u -r -N squid-6.0.3/src/CacheManager.h squid-6.1/src/CacheManager.h --- squid-6.0.3/src/CacheManager.h 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/CacheManager.h 2023-07-06 17:15:40.000000000 +1200 @@ -20,6 +20,7 @@ #include class HttpRequest; +class HttpReply; /** * a CacheManager - the menu system for interacting with squid. @@ -49,6 +50,11 @@ static CacheManager* GetInstance(); const char *ActionProtection(const Mgr::ActionProfilePointer &profile); + /// Add HTTP response headers specific/common to all cache manager replies, + /// including cache manager errors and Action reports. + /// \param httpOrigin the value of Origin header in the trigger HTTP request (or nil) + static void PutCommonResponseHeaders(HttpReply &, const char *httpOrigin); + protected: CacheManager() {} ///< use Instance() instead diff -u -r -N squid-6.0.3/src/cf.data.pre squid-6.1/src/cf.data.pre --- squid-6.0.3/src/cf.data.pre 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/cf.data.pre 2023-07-06 17:15:40.000000000 +1200 @@ -4300,9 +4300,11 @@ The directory must exist and be writable by the Squid process. Squid will NOT create this directory for you. - In SMP configurations, cache_dir must not precede the workers option - and should use configuration macros or conditionals to give each - worker interested in disk caching a dedicated cache directory. + Rock is currently the only SMP-aware cache_dir type. Using other + store types in configurations with multiple workers is not + supported and may lead to HTTP violations or undefined behavior, + even when each such cache_dir is given a dedicated worker using + configuration conditionals. ==== The ufs store type ==== diff -u -r -N squid-6.0.3/src/client_side.cc squid-6.1/src/client_side.cc --- squid-6.0.3/src/client_side.cc 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/client_side.cc 2023-07-06 17:15:40.000000000 +1200 @@ -1654,10 +1654,16 @@ http->setLogUriToRequestUri(); } else debugs(33, 2, "internal URL found: " << request->url.getScheme() << "://" << request->url.authority(true) << " (not this proxy)"); + + if (ForSomeCacheManager(request->url.path())) + request->flags.disableCacheUse("cache manager URL"); } request->flags.internal = http->flags.internal; + if (request->url.getScheme() == AnyP::PROTO_CACHE_OBJECT) + request->flags.disableCacheUse("cache_object URL scheme"); + if (!isFtp) { // XXX: for non-HTTP messages instantiate a different Http::Message child type // for now Squid only supports HTTP requests diff -u -r -N squid-6.0.3/src/client_side_reply.cc squid-6.1/src/client_side_reply.cc --- squid-6.0.3/src/client_side_reply.cc 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/client_side_reply.cc 2023-07-06 17:15:40.000000000 +1200 @@ -1527,6 +1527,9 @@ // client sent CC:no-cache or some other condition has been // encountered which prevents delivering a public/cached object. + // XXX: The above text does not match the condition below. It might describe + // the opposite condition, but the condition itself should be adjusted + // (e.g., to honor flags.noCache in cache manager requests). if (!r->flags.noCache || r->flags.internal) { const auto e = storeGetPublicByRequest(r); identifyFoundObject(e, storeLookupString(bool(e))); diff -u -r -N squid-6.0.3/src/errorpage.cc squid-6.1/src/errorpage.cc --- squid-6.0.3/src/errorpage.cc 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/errorpage.cc 2023-07-06 17:15:40.000000000 +1200 @@ -1352,6 +1352,11 @@ request->detailError(type, detail); else request->detailError(type, SysErrorDetail::NewIfAny(xerrno)); + } else if (ale) { + if (detail) + ale->updateError(Error(type, detail)); + else + ale->updateError(Error(type, SysErrorDetail::NewIfAny(xerrno))); } return rep; diff -u -r -N squid-6.0.3/src/http/url_rewriters/LFS/url_lfs_rewrite.8 squid-6.1/src/http/url_rewriters/LFS/url_lfs_rewrite.8 --- squid-6.0.3/src/http/url_rewriters/LFS/url_lfs_rewrite.8 2023-06-07 06:53:25.000000000 +1200 +++ squid-6.1/src/http/url_rewriters/LFS/url_lfs_rewrite.8 2023-07-06 17:32:54.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "URL_LFS_REWRITE 8" -.TH URL_LFS_REWRITE 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH URL_LFS_REWRITE 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-6.0.3/src/internal.cc squid-6.1/src/internal.cc --- squid-6.0.3/src/internal.cc 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/internal.cc 2023-07-06 17:15:40.000000000 +1200 @@ -10,6 +10,7 @@ #include "squid.h" #include "AccessLogEntry.h" +#include "base/Assure.h" #include "CacheManager.h" #include "comm/Connection.h" #include "errorpage.h" @@ -32,12 +33,15 @@ internalStart(const Comm::ConnectionPointer &clientConn, HttpRequest * request, StoreEntry * entry, const AccessLogEntry::Pointer &ale) { ErrorState *err; + + Assure(request); const SBuf upath = request->url.path(); debugs(76, 3, clientConn << " requesting '" << upath << "'"); + Assure(request->flags.internal); + static const SBuf netdbUri("/squid-internal-dynamic/netdb"); static const SBuf storeDigestUri("/squid-internal-periodic/store_digest"); - static const SBuf mgrPfx("/squid-internal-mgr/"); if (upath == netdbUri) { netdbBinaryExchange(entry); @@ -54,8 +58,8 @@ entry->replaceHttpReply(reply); entry->append(msgbuf, strlen(msgbuf)); entry->complete(); - } else if (upath.startsWith(mgrPfx)) { - debugs(17, 2, "calling CacheManager due to URL-path " << mgrPfx); + } else if (ForSomeCacheManager(upath)) { + debugs(17, 2, "calling CacheManager due to URL-path"); CacheManager::GetInstance()->start(clientConn, request, entry, ale); } else { debugObj(76, 1, "internalStart: unknown request:\n", @@ -79,6 +83,13 @@ return urlPath.startsWith(InternalStaticPfx); } +bool +ForSomeCacheManager(const SBuf &urlPath) +{ + static const SBuf mgrPfx("/squid-internal-mgr"); + return urlPath.startsWith(mgrPfx); +} + /* * makes internal url with a given host and port (remote internal url) */ diff -u -r -N squid-6.0.3/src/internal.h squid-6.1/src/internal.h --- squid-6.0.3/src/internal.h 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/internal.h 2023-07-06 17:15:40.000000000 +1200 @@ -29,5 +29,9 @@ const char *internalHostname(void); int internalHostnameIs(const char *); +/// whether the given request URL path points to a cache manager (not +/// necessarily running on this Squid instance) +bool ForSomeCacheManager(const SBuf &); + #endif /* SQUID_INTERNAL_H_ */ diff -u -r -N squid-6.0.3/src/ipcache.cc squid-6.1/src/ipcache.cc --- squid-6.0.3/src/ipcache.cc 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/ipcache.cc 2023-07-06 17:15:40.000000000 +1200 @@ -543,8 +543,15 @@ Config.positiveDnsTtl); // largest value allowed const time_t rrExpires = squid_curtime + ttl; - if (rrExpires < expires) + if (addrs.size() <= 1) { + debugs(14, 5, "use first " << ttl << " from RR TTL " << rrTtl); expires = rrExpires; + } else if (rrExpires < expires) { + debugs(14, 5, "use smaller " << ttl << " from RR TTL " << rrTtl << "; was: " << (expires - squid_curtime)); + expires = rrExpires; + } else { + debugs(14, 7, "ignore " << ttl << " from RR TTL " << rrTtl << "; keep: " << (expires - squid_curtime)); + } } /// \ingroup IPCacheInternal diff -u -r -N squid-6.0.3/src/log/DB/log_db_daemon.8 squid-6.1/src/log/DB/log_db_daemon.8 --- squid-6.0.3/src/log/DB/log_db_daemon.8 2023-06-07 06:53:25.000000000 +1200 +++ squid-6.1/src/log/DB/log_db_daemon.8 2023-07-06 17:32:54.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "LOG_DB_DAEMON 8" -.TH LOG_DB_DAEMON 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH LOG_DB_DAEMON 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-6.0.3/src/mgr/Action.cc squid-6.1/src/mgr/Action.cc --- squid-6.0.3/src/mgr/Action.cc 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/mgr/Action.cc 2023-07-06 17:15:40.000000000 +1200 @@ -9,6 +9,7 @@ /* DEBUG: section 16 Cache Manager API */ #include "squid.h" +#include "CacheManager.h" #include "comm/Connection.h" #include "HttpReply.h" #include "ipc/Port.h" @@ -103,15 +104,11 @@ if (writeHttpHeader) { HttpReply *rep = new HttpReply; rep->setHeaders(Http::scOkay, nullptr, contentType(), -1, squid_curtime, squid_curtime); - // Allow cachemgr and other XHR scripts access to our version string - const ActionParams ¶ms = command().params; - if (params.httpOrigin.size() > 0) { - rep->header.putExt("Access-Control-Allow-Origin", params.httpOrigin.termedBuf()); -#if HAVE_AUTH_MODULE_BASIC - rep->header.putExt("Access-Control-Allow-Credentials","true"); -#endif - rep->header.putExt("Access-Control-Expose-Headers","Server"); - } + + const auto &origin = command().params.httpOrigin; + const auto originOrNil = origin.size() ? origin.termedBuf() : nullptr; + CacheManager::PutCommonResponseHeaders(*rep, originOrNil); + entry->replaceHttpReply(rep); } diff -u -r -N squid-6.0.3/src/mgr/Inquirer.cc squid-6.1/src/mgr/Inquirer.cc --- squid-6.0.3/src/mgr/Inquirer.cc 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/mgr/Inquirer.cc 2023-07-06 17:15:40.000000000 +1200 @@ -11,6 +11,7 @@ #include "squid.h" #include "AccessLogEntry.h" #include "base/TextException.h" +#include "CacheManager.h" #include "comm.h" #include "comm/Connection.h" #include "comm/Write.h" @@ -73,6 +74,9 @@ Must(Comm::IsConnOpen(conn)); Must(aggrAction != nullptr); + const auto &origin = aggrAction->command().params.httpOrigin; + const auto originOrNil = origin.size() ? origin.termedBuf() : nullptr; + std::unique_ptr replyBuf; if (strands.empty()) { const char *url = aggrAction->command().params.httpUri.termedBuf(); @@ -80,10 +84,12 @@ auto *req = HttpRequest::FromUrlXXX(url, mx); ErrorState err(ERR_INVALID_URL, Http::scNotFound, req, nullptr); std::unique_ptr reply(err.BuildHttpReply()); + CacheManager::PutCommonResponseHeaders(*reply, originOrNil); replyBuf.reset(reply->pack()); } else { std::unique_ptr reply(new HttpReply); reply->setHeaders(Http::scOkay, nullptr, "text/plain", -1, squid_curtime, squid_curtime); + CacheManager::PutCommonResponseHeaders(*reply, originOrNil); reply->header.putStr(Http::HdrType::CONNECTION, "close"); // until we chunk response replyBuf.reset(reply->pack()); } diff -u -r -N squid-6.0.3/src/RequestFlags.h squid-6.1/src/RequestFlags.h --- squid-6.0.3/src/RequestFlags.h 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/RequestFlags.h 2023-07-06 17:15:40.000000000 +1200 @@ -72,8 +72,14 @@ /// This applies to TPROXY traffic that has not had spoofing disabled through /// the spoof_client_ip squid.conf ACL. bool spoofClientIp = false; - /** set if the request is internal (\see ClientHttpRequest::flags.internal)*/ + + /// whether the request targets a /squid-internal- resource (e.g., a MIME + /// icon or a cache manager page) served by this Squid instance + /// \sa ClientHttpRequest::flags.internal + /// TODO: Rename to avoid a false implication that this flag is true for + /// requests for /squid-internal- resources served by other Squid instances. bool internal = false; + /** if set, request to try very hard to keep the connection alive */ bool mustKeepalive = false; /** set if the request wants connection oriented auth */ diff -u -r -N squid-6.0.3/src/sbuf/Algorithms.h squid-6.1/src/sbuf/Algorithms.h --- squid-6.0.3/src/sbuf/Algorithms.h 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/sbuf/Algorithms.h 2023-07-06 17:15:40.000000000 +1200 @@ -112,18 +112,25 @@ }; } -/** hash functor for SBufs, meant so support case-insensitive std::unordered_map - * - * Typical use: - * \code - * auto m = std::unordered_map(); - * \endcode - */ +/// hash functor for case-insensitive SBufs +/// \sa std::hash class CaseInsensitiveSBufHash { public: std::size_t operator()(const SBuf &) const noexcept; }; +/// equality functor for case-insensitive SBufs +/// \sa std::equal_to +class CaseInsensitiveSBufEqual +{ +public: + bool operator()(const SBuf &lhs, const SBuf &rhs) const + { + // Optimization: Do not iterate strings of different lengths. + return lhs.length() == rhs.length() && (lhs.compare(rhs, caseInsensitive) == 0); + } +}; + #endif /* SQUID_SBUFALGOS_H_ */ diff -u -r -N squid-6.0.3/src/security/cert_validators/fake/security_fake_certverify.8 squid-6.1/src/security/cert_validators/fake/security_fake_certverify.8 --- squid-6.0.3/src/security/cert_validators/fake/security_fake_certverify.8 2023-06-07 06:53:26.000000000 +1200 +++ squid-6.1/src/security/cert_validators/fake/security_fake_certverify.8 2023-07-06 17:32:55.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "SECURITY_FAKE_CERTVERIFY 8" -.TH SECURITY_FAKE_CERTVERIFY 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH SECURITY_FAKE_CERTVERIFY 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-6.0.3/src/store/id_rewriters/file/storeid_file_rewrite.8 squid-6.1/src/store/id_rewriters/file/storeid_file_rewrite.8 --- squid-6.0.3/src/store/id_rewriters/file/storeid_file_rewrite.8 2023-06-07 06:53:23.000000000 +1200 +++ squid-6.1/src/store/id_rewriters/file/storeid_file_rewrite.8 2023-07-06 17:32:52.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "STOREID_FILE_REWRITE 8" -.TH STOREID_FILE_REWRITE 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH STOREID_FILE_REWRITE 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff -u -r -N squid-6.0.3/src/tests/stub_cache_manager.cc squid-6.1/src/tests/stub_cache_manager.cc --- squid-6.0.3/src/tests/stub_cache_manager.cc 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/tests/stub_cache_manager.cc 2023-07-06 17:15:40.000000000 +1200 @@ -26,4 +26,5 @@ void Mgr::RegisterAction(char const *, char const *, Mgr::ClassActionCreationHandler *, int, int) {} Mgr::Action::Pointer CacheManager::createRequestedAction(const Mgr::ActionParams &) STUB_RETVAL(nullptr) +void CacheManager::PutCommonResponseHeaders(HttpReply &, const char *) STUB diff -u -r -N squid-6.0.3/src/tests/testLookupTable.cc squid-6.1/src/tests/testLookupTable.cc --- squid-6.0.3/src/tests/testLookupTable.cc 2023-06-07 06:34:33.000000000 +1200 +++ squid-6.1/src/tests/testLookupTable.cc 2023-07-06 17:15:40.000000000 +1200 @@ -48,6 +48,11 @@ CPPUNIT_ASSERT_EQUAL(lt.lookup(SBuf("six")), ENUM_6); CPPUNIT_ASSERT_EQUAL(lt.lookup(SBuf("seven")), ENUM_7); + // element found despite a different key spelling + CPPUNIT_ASSERT_EQUAL(lt.lookup(SBuf("One")), ENUM_1); + CPPUNIT_ASSERT_EQUAL(lt.lookup(SBuf("fOUr")), ENUM_4); + CPPUNIT_ASSERT_EQUAL(lt.lookup(SBuf("seveN")), ENUM_7); + // element not found CPPUNIT_ASSERT_EQUAL(lt.lookup(SBuf("eleventy")), ENUM_INVALID); } diff -u -r -N squid-6.0.3/tools/helper-mux/helper-mux.8 squid-6.1/tools/helper-mux/helper-mux.8 --- squid-6.0.3/tools/helper-mux/helper-mux.8 2023-06-07 06:53:26.000000000 +1200 +++ squid-6.1/tools/helper-mux/helper-mux.8 2023-07-06 17:32:55.000000000 +1200 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "HELPER-MUX 8" -.TH HELPER-MUX 8 "2023-06-06" "perl v5.36.0" "User Contributed Perl Documentation" +.TH HELPER-MUX 8 "2023-07-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l