diff --git a/.gitignore b/.gitignore index 944be22a32..ea91cfcb38 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ autom4te.cache /play *.orig /compile_commands.json +/src/cxx_supportlib/vendor-modified/test.cpp +/src/cxx_supportlib/vendor-modified/test-*.o.tmp diff --git a/CHANGELOG b/CHANGELOG index 92628582d9..3d952de772 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ Release 6.0.25 (Not yet released) * [Standalone] Adds a config option to specify the stop timeout for Passenger: `--stop-timeout 120` or `PASSENGER_STOP_TIMEOUT=120`. * [Standalone] Changes Passenger's (not apps') start timeout to 25s (from 15s), stop timeouts default to 60s. * [Ruby] Fixes an issue where Bundler would try to re-exec the process name instead of the script. Closes GH-2567 and GH-2577. + * Upgrades Boost from 1.86 → 1.87. * Updated various library versions used in precompiled binaries (used for e.g. gem installs): - cmake: 3.31.2 -> 3.31.3 - curl: 8.11.0 -> 8.11.1 diff --git a/build/support/cxx_dependency_map.rb b/build/support/cxx_dependency_map.rb index b8091c0e46..4f76465b9c 100644 --- a/build/support/cxx_dependency_map.rb +++ b/build/support/cxx_dependency_map.rb @@ -3,153 +3,6 @@ {"src/agent/AgentMain.cpp"=> ["src/agent/MainFunctions.h", "src/cxx_supportlib/Constants.h"], - "src/agent/Core/AdminPanelConnector.h"=> - ["src/agent/Core/ApplicationPool/AbstractSession.h", - "src/agent/Core/ApplicationPool/BasicGroupInfo.h", - "src/agent/Core/ApplicationPool/BasicProcessInfo.h", - "src/agent/Core/ApplicationPool/Common.h", - "src/agent/Core/ApplicationPool/Context.h", - "src/agent/Core/ApplicationPool/Group.h", - "src/agent/Core/ApplicationPool/Options.h", - "src/agent/Core/ApplicationPool/Pool.h", - "src/agent/Core/ApplicationPool/Process.h", - "src/agent/Core/ApplicationPool/Session.h", - "src/agent/Core/ApplicationPool/Socket.h", - "src/agent/Core/Controller.h", - "src/agent/Core/Controller/AppResponse.h", - "src/agent/Core/Controller/Client.h", - "src/agent/Core/Controller/Config.h", - "src/agent/Core/Controller/Request.h", - "src/agent/Core/Controller/TurboCaching.h", - "src/agent/Core/ResponseCache.h", - "src/agent/Core/SpawningKit/Config.h", - "src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h", - "src/agent/Core/SpawningKit/Context.h", - "src/agent/Core/SpawningKit/DirectSpawner.h", - "src/agent/Core/SpawningKit/DummySpawner.h", - "src/agent/Core/SpawningKit/Exceptions.h", - "src/agent/Core/SpawningKit/Factory.h", - "src/agent/Core/SpawningKit/Handshake/BackgroundIOCapturer.h", - "src/agent/Core/SpawningKit/Handshake/Perform.h", - "src/agent/Core/SpawningKit/Handshake/Prepare.h", - "src/agent/Core/SpawningKit/Handshake/Session.h", - "src/agent/Core/SpawningKit/Handshake/WorkDir.h", - "src/agent/Core/SpawningKit/Journey.h", - "src/agent/Core/SpawningKit/PipeWatcher.h", - "src/agent/Core/SpawningKit/Result.h", - "src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h", - "src/agent/Core/SpawningKit/SmartSpawner.h", - "src/agent/Core/SpawningKit/Spawner.h", - "src/agent/Core/SpawningKit/UserSwitchingRules.h", - "src/agent/Shared/ApplicationPoolApiKey.h", - "src/cxx_supportlib/Algorithms/Hasher.h", - "src/cxx_supportlib/Algorithms/MovingAverage.h", - "src/cxx_supportlib/AppLocalConfigFileUtils.h", - "src/cxx_supportlib/ConfigKit/AsyncUtils.h", - "src/cxx_supportlib/ConfigKit/Common.h", - "src/cxx_supportlib/ConfigKit/ConfigKit.h", - "src/cxx_supportlib/ConfigKit/DummyTranslator.h", - "src/cxx_supportlib/ConfigKit/Schema.h", - "src/cxx_supportlib/ConfigKit/SchemaUtils.h", - "src/cxx_supportlib/ConfigKit/Store.h", - "src/cxx_supportlib/ConfigKit/Translator.h", - "src/cxx_supportlib/ConfigKit/Utils.h", - "src/cxx_supportlib/Constants.h", - "src/cxx_supportlib/DataStructures/HashedStaticString.h", - "src/cxx_supportlib/DataStructures/LString.h", - "src/cxx_supportlib/DataStructures/StringKeyTable.h", - "src/cxx_supportlib/Exceptions.h", - "src/cxx_supportlib/FileDescriptor.h", - "src/cxx_supportlib/FileTools/FileManip.h", - "src/cxx_supportlib/FileTools/PathManip.h", - "src/cxx_supportlib/Hooks.h", - "src/cxx_supportlib/IOTools/BufferedIO.h", - "src/cxx_supportlib/IOTools/IOUtils.h", - "src/cxx_supportlib/IOTools/MessageIO.h", - "src/cxx_supportlib/IOTools/MessageSerialization.h", - "src/cxx_supportlib/InstanceDirectory.h", - "src/cxx_supportlib/Integrations/LibevJsonUtils.h", - "src/cxx_supportlib/JsonTools/JsonUtils.h", - "src/cxx_supportlib/LoggingKit/Assert.h", - "src/cxx_supportlib/LoggingKit/Config.h", - "src/cxx_supportlib/LoggingKit/Context.h", - "src/cxx_supportlib/LoggingKit/Forward.h", - "src/cxx_supportlib/LoggingKit/Logging.h", - "src/cxx_supportlib/LoggingKit/LoggingKit.h", - "src/cxx_supportlib/LveLoggingDecorator.h", - "src/cxx_supportlib/MemoryKit/mbuf.h", - "src/cxx_supportlib/MemoryKit/palloc.h", - "src/cxx_supportlib/ProcessManagement/Ruby.h", - "src/cxx_supportlib/ProcessManagement/Spawn.h", - "src/cxx_supportlib/ProcessManagement/Utils.h", - "src/cxx_supportlib/RandomGenerator.h", - "src/cxx_supportlib/ResourceLocator.h", - "src/cxx_supportlib/SafeLibev.h", - "src/cxx_supportlib/SecurityKit/MemZeroGuard.h", - "src/cxx_supportlib/ServerKit/Channel.h", - "src/cxx_supportlib/ServerKit/Client.h", - "src/cxx_supportlib/ServerKit/ClientRef.h", - "src/cxx_supportlib/ServerKit/Config.h", - "src/cxx_supportlib/ServerKit/Context.h", - "src/cxx_supportlib/ServerKit/CookieUtils.h", - "src/cxx_supportlib/ServerKit/Errors.h", - "src/cxx_supportlib/ServerKit/FdSinkChannel.h", - "src/cxx_supportlib/ServerKit/FdSourceChannel.h", - "src/cxx_supportlib/ServerKit/FileBufferedChannel.h", - "src/cxx_supportlib/ServerKit/FileBufferedFdSinkChannel.h", - "src/cxx_supportlib/ServerKit/HeaderTable.h", - "src/cxx_supportlib/ServerKit/Hooks.h", - "src/cxx_supportlib/ServerKit/HttpChunkedBodyParser.h", - "src/cxx_supportlib/ServerKit/HttpChunkedBodyParserState.h", - "src/cxx_supportlib/ServerKit/HttpClient.h", - "src/cxx_supportlib/ServerKit/HttpHeaderParser.h", - "src/cxx_supportlib/ServerKit/HttpHeaderParserState.h", - "src/cxx_supportlib/ServerKit/HttpRequest.h", - "src/cxx_supportlib/ServerKit/HttpRequestRef.h", - "src/cxx_supportlib/ServerKit/HttpServer.h", - "src/cxx_supportlib/ServerKit/Server.h", - "src/cxx_supportlib/ServerKit/llerrors.h", - "src/cxx_supportlib/ServerKit/llhttp.h", - "src/cxx_supportlib/ServerKit/url_parser.h", - "src/cxx_supportlib/StaticString.h", - "src/cxx_supportlib/StrIntTools/DateParsing.h", - "src/cxx_supportlib/StrIntTools/StrIntUtils.h", - "src/cxx_supportlib/StrIntTools/StringScanning.h", - "src/cxx_supportlib/SystemTools/ProcessMetricsCollector.h", - "src/cxx_supportlib/SystemTools/SystemMetricsCollector.h", - "src/cxx_supportlib/SystemTools/SystemTime.h", - "src/cxx_supportlib/SystemTools/UserDatabase.h", - "src/cxx_supportlib/Utils.h", - "src/cxx_supportlib/Utils/AnsiColorConstants.h", - "src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h", - "src/cxx_supportlib/Utils/FastStringStream.h", - "src/cxx_supportlib/Utils/HttpConstants.h", - "src/cxx_supportlib/Utils/IniFile.h", - "src/cxx_supportlib/Utils/Lock.h", - "src/cxx_supportlib/Utils/MessagePassing.h", - "src/cxx_supportlib/Utils/ScopeGuard.h", - "src/cxx_supportlib/Utils/SpeedMeter.h", - "src/cxx_supportlib/Utils/Timer.h", - "src/cxx_supportlib/Utils/VariantMap.h", - "src/cxx_supportlib/WebSocketCommandReverseServer.h", - "src/cxx_supportlib/WrapperRegistry/Entry.h", - "src/cxx_supportlib/WrapperRegistry/Registry.h", - "src/cxx_supportlib/oxt/backtrace.hpp", - "src/cxx_supportlib/oxt/detail/backtrace_disabled.hpp", - "src/cxx_supportlib/oxt/detail/backtrace_enabled.hpp", - "src/cxx_supportlib/oxt/detail/context.hpp", - "src/cxx_supportlib/oxt/detail/spin_lock_darwin.hpp", - "src/cxx_supportlib/oxt/detail/spin_lock_gcc_x86.hpp", - "src/cxx_supportlib/oxt/detail/spin_lock_portable.hpp", - "src/cxx_supportlib/oxt/detail/spin_lock_pthreads.hpp", - "src/cxx_supportlib/oxt/detail/tracable_exception_disabled.hpp", - "src/cxx_supportlib/oxt/detail/tracable_exception_enabled.hpp", - "src/cxx_supportlib/oxt/dynamic_thread_group.hpp", - "src/cxx_supportlib/oxt/macros.hpp", - "src/cxx_supportlib/oxt/spin_lock.hpp", - "src/cxx_supportlib/oxt/system_calls.hpp", - "src/cxx_supportlib/oxt/thread.hpp", - "src/cxx_supportlib/oxt/tracable_exception.hpp"], "src/agent/Core/ApiServer.h"=> ["src/agent/Core/ApplicationPool/AbstractSession.h", "src/agent/Core/ApplicationPool/BasicGroupInfo.h", @@ -3188,7 +3041,7 @@ "src/cxx_supportlib/oxt/system_calls.hpp", "src/cxx_supportlib/oxt/tracable_exception.hpp"], "src/agent/Core/Config.h"=> - ["src/agent/Core/AdminPanelConnector.h", + [ "src/agent/Core/ApiServer.h", "src/agent/Core/ApplicationPool/AbstractSession.h", "src/agent/Core/ApplicationPool/BasicGroupInfo.h", @@ -3327,7 +3180,6 @@ "src/cxx_supportlib/Utils/SpeedMeter.h", "src/cxx_supportlib/Utils/Timer.h", "src/cxx_supportlib/Utils/VariantMap.h", - "src/cxx_supportlib/WebSocketCommandReverseServer.h", "src/cxx_supportlib/WrapperRegistry/Entry.h", "src/cxx_supportlib/WrapperRegistry/Registry.h", "src/cxx_supportlib/oxt/backtrace.hpp", @@ -3347,7 +3199,7 @@ "src/cxx_supportlib/oxt/thread.hpp", "src/cxx_supportlib/oxt/tracable_exception.hpp"], "src/agent/Core/ConfigChange.cpp"=> - ["src/agent/Core/AdminPanelConnector.h", + [ "src/agent/Core/ApiServer.h", "src/agent/Core/ApplicationPool/AbstractSession.h", "src/agent/Core/ApplicationPool/BasicGroupInfo.h", @@ -3487,7 +3339,6 @@ "src/cxx_supportlib/Utils/SpeedMeter.h", "src/cxx_supportlib/Utils/Timer.h", "src/cxx_supportlib/Utils/VariantMap.h", - "src/cxx_supportlib/WebSocketCommandReverseServer.h", "src/cxx_supportlib/WrapperRegistry/Entry.h", "src/cxx_supportlib/WrapperRegistry/Registry.h", "src/cxx_supportlib/oxt/backtrace.hpp", @@ -5851,7 +5702,7 @@ "src/cxx_supportlib/oxt/thread.hpp", "src/cxx_supportlib/oxt/tracable_exception.hpp"], "src/agent/Core/CoreMain.cpp"=> - ["src/agent/Core/AdminPanelConnector.h", + [ "src/agent/Core/ApiServer.h", "src/agent/Core/ApplicationPool/AbstractSession.h", "src/agent/Core/ApplicationPool/BasicGroupInfo.h", @@ -6007,7 +5858,6 @@ "src/cxx_supportlib/Utils/SpeedMeter.h", "src/cxx_supportlib/Utils/Timer.h", "src/cxx_supportlib/Utils/VariantMap.h", - "src/cxx_supportlib/WebSocketCommandReverseServer.h", "src/cxx_supportlib/WrapperRegistry/Entry.h", "src/cxx_supportlib/WrapperRegistry/Registry.h", "src/cxx_supportlib/oxt/backtrace.hpp", @@ -7602,7 +7452,7 @@ "src/cxx_supportlib/oxt/thread.hpp", "src/cxx_supportlib/oxt/tracable_exception.hpp"], "src/agent/Watchdog/Config.h"=> - ["src/agent/Core/AdminPanelConnector.h", + [ "src/agent/Core/ApiServer.h", "src/agent/Core/ApplicationPool/AbstractSession.h", "src/agent/Core/ApplicationPool/BasicGroupInfo.h", @@ -7743,7 +7593,6 @@ "src/cxx_supportlib/Utils/SpeedMeter.h", "src/cxx_supportlib/Utils/Timer.h", "src/cxx_supportlib/Utils/VariantMap.h", - "src/cxx_supportlib/WebSocketCommandReverseServer.h", "src/cxx_supportlib/WrapperRegistry/Entry.h", "src/cxx_supportlib/WrapperRegistry/Registry.h", "src/cxx_supportlib/oxt/backtrace.hpp", @@ -7793,7 +7642,7 @@ "src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h", "src/cxx_supportlib/oxt/macros.hpp"], "src/agent/Watchdog/WatchdogMain.cpp"=> - ["src/agent/Core/AdminPanelConnector.h", + [ "src/agent/Core/ApiServer.h", "src/agent/Core/ApplicationPool/AbstractSession.h", "src/agent/Core/ApplicationPool/BasicGroupInfo.h", @@ -7948,7 +7797,6 @@ "src/cxx_supportlib/Utils/SpeedMeter.h", "src/cxx_supportlib/Utils/Timer.h", "src/cxx_supportlib/Utils/VariantMap.h", - "src/cxx_supportlib/WebSocketCommandReverseServer.h", "src/cxx_supportlib/WrapperRegistry/Entry.h", "src/cxx_supportlib/WrapperRegistry/Registry.h", "src/cxx_supportlib/oxt/backtrace.hpp", @@ -10539,36 +10387,6 @@ "src/cxx_supportlib/oxt/system_calls.hpp", "src/cxx_supportlib/oxt/thread.hpp", "src/cxx_supportlib/oxt/tracable_exception.hpp"], - "src/cxx_supportlib/WebSocketCommandReverseServer.h"=> - ["src/cxx_supportlib/Algorithms/Hasher.h", - "src/cxx_supportlib/ConfigKit/AsyncUtils.h", - "src/cxx_supportlib/ConfigKit/Common.h", - "src/cxx_supportlib/ConfigKit/ConfigKit.h", - "src/cxx_supportlib/ConfigKit/DummyTranslator.h", - "src/cxx_supportlib/ConfigKit/Schema.h", - "src/cxx_supportlib/ConfigKit/Store.h", - "src/cxx_supportlib/ConfigKit/Translator.h", - "src/cxx_supportlib/ConfigKit/Utils.h", - "src/cxx_supportlib/DataStructures/HashedStaticString.h", - "src/cxx_supportlib/DataStructures/StringKeyTable.h", - "src/cxx_supportlib/Exceptions.h", - "src/cxx_supportlib/FileTools/FileManip.h", - "src/cxx_supportlib/FileTools/PathManip.h", - "src/cxx_supportlib/LoggingKit/Assert.h", - "src/cxx_supportlib/LoggingKit/Forward.h", - "src/cxx_supportlib/LoggingKit/Logging.h", - "src/cxx_supportlib/LoggingKit/LoggingKit.h", - "src/cxx_supportlib/StaticString.h", - "src/cxx_supportlib/StrIntTools/StrIntUtils.h", - "src/cxx_supportlib/Utils.h", - "src/cxx_supportlib/Utils/FastStringStream.h", - "src/cxx_supportlib/oxt/backtrace.hpp", - "src/cxx_supportlib/oxt/detail/backtrace_disabled.hpp", - "src/cxx_supportlib/oxt/detail/backtrace_enabled.hpp", - "src/cxx_supportlib/oxt/detail/tracable_exception_disabled.hpp", - "src/cxx_supportlib/oxt/detail/tracable_exception_enabled.hpp", - "src/cxx_supportlib/oxt/macros.hpp", - "src/cxx_supportlib/oxt/tracable_exception.hpp"], "src/cxx_supportlib/WrapperRegistry/CBindings.cpp"=> ["src/cxx_supportlib/Algorithms/Hasher.h", "src/cxx_supportlib/Constants.h", @@ -10853,7 +10671,7 @@ "src/ruby_native_extension/passenger_native_support.c"=> [], "src/schema_printer/SchemaPrinterMain.cpp"=> - ["src/agent/Core/AdminPanelConnector.h", + [ "src/agent/Core/ApiServer.h", "src/agent/Core/ApplicationPool/AbstractSession.h", "src/agent/Core/ApplicationPool/BasicGroupInfo.h", @@ -10995,7 +10813,6 @@ "src/cxx_supportlib/Utils/SpeedMeter.h", "src/cxx_supportlib/Utils/Timer.h", "src/cxx_supportlib/Utils/VariantMap.h", - "src/cxx_supportlib/WebSocketCommandReverseServer.h", "src/cxx_supportlib/WrapperRegistry/Entry.h", "src/cxx_supportlib/WrapperRegistry/Registry.h", "src/cxx_supportlib/oxt/backtrace.hpp", diff --git a/dev/boost-patches/0003-drop-windows-headers-from-asio.patch b/dev/boost-patches/0003-drop-windows-headers-from-asio.patch index 8ce511346d..ee2e62dacf 100644 --- a/dev/boost-patches/0003-drop-windows-headers-from-asio.patch +++ b/dev/boost-patches/0003-drop-windows-headers-from-asio.patch @@ -9,8 +9,8 @@ Subject: [PATCH] drop windows headers from asio diff --git src/cxx_supportlib/vendor-modified/boost/asio.hpp src/cxx_supportlib/vendor-modified/boost/asio.hpp index 7b889de4a..b32ead6ae 100644 ---- src/cxx_supportlib/vendor-modified/boost/asio.hpp -+++ src/cxx_supportlib/vendor-modified/boost/asio.hpp +--- a/src/cxx_supportlib/vendor-modified/boost/asio.hpp ++++ b/src/cxx_supportlib/vendor-modified/boost/asio.hpp @@ -182,15 +182,6 @@ #include #include diff --git a/dev/configkit-schemas/index.json b/dev/configkit-schemas/index.json index a8d971f27d..857b762b75 100644 --- a/dev/configkit-schemas/index.json +++ b/dev/configkit-schemas/index.json @@ -1,109 +1,4 @@ { - "Passenger::Core::AdminPanelConnector::Schema" : { - "auth_type" : { - "default_value" : "basic", - "has_default_value" : "static", - "type" : "string" - }, - "close_timeout" : { - "default_value" : 10.0, - "has_default_value" : "static", - "type" : "float" - }, - "connect_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "data_debug" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - }, - "instance_dir" : { - "read_only" : true, - "type" : "string" - }, - "integration_mode" : { - "default_value" : "standalone", - "has_default_value" : "static", - "type" : "string" - }, - "log_prefix" : { - "type" : "string" - }, - "password" : { - "secret" : true, - "type" : "string" - }, - "password_file" : { - "type" : "string" - }, - "ping_interval" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "ping_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "proxy_password" : { - "secret" : true, - "type" : "string" - }, - "proxy_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "proxy_url" : { - "type" : "string" - }, - "proxy_username" : { - "type" : "string" - }, - "reconnect_timeout" : { - "default_value" : 5.0, - "has_default_value" : "static", - "type" : "float" - }, - "ruby" : { - "default_value" : "ruby", - "has_default_value" : "static", - "type" : "string" - }, - "standalone_engine" : { - "has_default_value" : "dynamic", - "type" : "string" - }, - "url" : { - "required" : true, - "type" : "string" - }, - "username" : { - "type" : "string" - }, - "web_server_module_version" : { - "read_only" : true, - "type" : "string" - }, - "web_server_version" : { - "read_only" : true, - "type" : "string" - }, - "websocketpp_debug_access" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - }, - "websocketpp_debug_error" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - } - }, "Passenger::Core::ApiServer::Schema" : { "accept_burst_count" : { "default_value" : 32, @@ -372,80 +267,6 @@ } }, "Passenger::Core::Schema" : { - "admin_panel_auth_type" : { - "default_value" : "basic", - "has_default_value" : "static", - "type" : "string" - }, - "admin_panel_close_timeout" : { - "default_value" : 10.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_connect_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_data_debug" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - }, - "admin_panel_password" : { - "secret" : true, - "type" : "string" - }, - "admin_panel_password_file" : { - "type" : "string" - }, - "admin_panel_ping_interval" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_ping_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_proxy_password" : { - "secret" : true, - "type" : "string" - }, - "admin_panel_proxy_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_proxy_url" : { - "type" : "string" - }, - "admin_panel_proxy_username" : { - "type" : "string" - }, - "admin_panel_reconnect_timeout" : { - "default_value" : 5.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_url" : { - "read_only" : true, - "type" : "string" - }, - "admin_panel_username" : { - "type" : "string" - }, - "admin_panel_websocketpp_debug_access" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - }, - "admin_panel_websocketpp_debug_error" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - }, "api_server_accept_burst_count" : { "default_value" : 32, "has_default_value" : "static", @@ -777,6 +598,7 @@ "integration_mode" : { "default_value" : "standalone", "has_default_value" : "static", + "read_only" : true, "type" : "string" }, "log_level" : { @@ -893,10 +715,6 @@ "read_only" : true, "type" : "string" }, - "standalone_engine" : { - "has_default_value" : "dynamic", - "type" : "string" - }, "stat_throttle_rate" : { "default_value" : 10, "has_default_value" : "static", @@ -971,10 +789,6 @@ "secret" : true, "type" : "string" }, - "web_server_module_version" : { - "read_only" : true, - "type" : "string" - }, "web_server_version" : { "read_only" : true, "type" : "string" @@ -1229,80 +1043,6 @@ } }, "Passenger::Watchdog::Schema" : { - "admin_panel_auth_type" : { - "default_value" : "basic", - "has_default_value" : "static", - "type" : "string" - }, - "admin_panel_close_timeout" : { - "default_value" : 10.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_connect_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_data_debug" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - }, - "admin_panel_password" : { - "secret" : true, - "type" : "string" - }, - "admin_panel_password_file" : { - "type" : "string" - }, - "admin_panel_ping_interval" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_ping_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_proxy_password" : { - "secret" : true, - "type" : "string" - }, - "admin_panel_proxy_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_proxy_url" : { - "type" : "string" - }, - "admin_panel_proxy_username" : { - "type" : "string" - }, - "admin_panel_reconnect_timeout" : { - "default_value" : 5.0, - "has_default_value" : "static", - "type" : "float" - }, - "admin_panel_url" : { - "read_only" : true, - "type" : "string" - }, - "admin_panel_username" : { - "type" : "string" - }, - "admin_panel_websocketpp_debug_access" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - }, - "admin_panel_websocketpp_debug_error" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - }, "app_output_log_level" : { "default_value" : "notice", "has_default_value" : "static", @@ -1661,6 +1401,7 @@ "integration_mode" : { "default_value" : "standalone", "has_default_value" : "static", + "read_only" : true, "type" : "string" }, "log_level" : { @@ -1779,10 +1520,6 @@ "read_only" : true, "type" : "string" }, - "standalone_engine" : { - "has_default_value" : "dynamic", - "type" : "string" - }, "startup_report_file" : { "type" : "string" }, @@ -1942,93 +1679,10 @@ "has_default_value" : "static", "type" : "boolean" }, - "web_server_module_version" : { - "read_only" : true, - "type" : "string" - }, "web_server_version" : { "read_only" : true, "type" : "string" } - }, - "Passenger::WebSocketCommandReverseServer::Schema" : { - "auth_type" : { - "default_value" : "basic", - "has_default_value" : "static", - "type" : "string" - }, - "close_timeout" : { - "default_value" : 10.0, - "has_default_value" : "static", - "type" : "float" - }, - "connect_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "data_debug" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - }, - "log_prefix" : { - "type" : "string" - }, - "password" : { - "secret" : true, - "type" : "string" - }, - "password_file" : { - "type" : "string" - }, - "ping_interval" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "ping_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "proxy_password" : { - "secret" : true, - "type" : "string" - }, - "proxy_timeout" : { - "default_value" : 30.0, - "has_default_value" : "static", - "type" : "float" - }, - "proxy_url" : { - "type" : "string" - }, - "proxy_username" : { - "type" : "string" - }, - "reconnect_timeout" : { - "default_value" : 5.0, - "has_default_value" : "static", - "type" : "float" - }, - "url" : { - "required" : true, - "type" : "string" - }, - "username" : { - "type" : "string" - }, - "websocketpp_debug_access" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - }, - "websocketpp_debug_error" : { - "default_value" : false, - "has_default_value" : "static", - "type" : "boolean" - } } } diff --git a/dev/copy_boost_headers b/dev/copy_boost_headers index 10102be6e8..c6e5bdb1c3 100755 --- a/dev/copy_boost_headers +++ b/dev/copy_boost_headers @@ -117,6 +117,7 @@ PROGRAM_SOURCE = %q{ #include #include #include + #include #include #include #include @@ -189,9 +190,8 @@ def copy_boost_files(patterns, exclude = nil) end def copy_essential_files - exclude = [] - EXCLUDE.each do |pattern| - exclude.concat(Dir["#{BOOST_DIR}/#{pattern}"]) + exclude = EXCLUDE.flat_map do |pattern| + Dir["#{BOOST_DIR}/#{pattern}"] end copy_boost_files(ESSENTIALS, exclude) end diff --git a/src/agent/Core/AdminPanelConnector.h b/src/agent/Core/AdminPanelConnector.h deleted file mode 100644 index 2d26e4b19d..0000000000 --- a/src/agent/Core/AdminPanelConnector.h +++ /dev/null @@ -1,680 +0,0 @@ -/* - * Phusion Passenger - https://www.phusionpassenger.com/ - * Copyright (c) 2017-2025 Asynchronous Holding B.V. - * - * "Passenger", "Phusion Passenger" and "Union Station" are registered - * trademarks of Asynchronous Holding B.V. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef _PASSENGER_ADMIN_PANEL_CONNECTOR_H_ -#define _PASSENGER_ADMIN_PANEL_CONNECTOR_H_ - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace Passenger { -namespace Core { - -using namespace std; -using namespace oxt; -namespace ASSU = AsyncSignalSafeUtils; - -class AdminPanelConnector { -public: - /** - * BEGIN ConfigKit schema: Passenger::Core::AdminPanelConnector::Schema - * (do not edit: following text is automatically generated - * by 'rake configkit_schemas_inline_comments') - * - * auth_type string - default("basic") - * close_timeout float - default(10.0) - * connect_timeout float - default(30.0) - * data_debug boolean - default(false) - * instance_dir string - read_only - * integration_mode string - default("standalone") - * log_prefix string - - - * password string - secret - * password_file string - - - * ping_interval float - default(30.0) - * ping_timeout float - default(30.0) - * proxy_password string - secret - * proxy_timeout float - default(30.0) - * proxy_url string - - - * proxy_username string - - - * reconnect_timeout float - default(5.0) - * ruby string - default("ruby") - * standalone_engine string - default - * url string required - - * username string - - - * web_server_module_version string - read_only - * web_server_version string - read_only - * websocketpp_debug_access boolean - default(false) - * websocketpp_debug_error boolean - default(false) - * - * END - */ - struct Schema: public WebSocketCommandReverseServer::Schema { - Schema() - : WebSocketCommandReverseServer::Schema(false) - { - using namespace ConfigKit; - - add("integration_mode", STRING_TYPE, OPTIONAL, DEFAULT_INTEGRATION_MODE); - addWithDynamicDefault("standalone_engine", STRING_TYPE, OPTIONAL, - ConfigKit::getDefaultStandaloneEngine); - add("instance_dir", STRING_TYPE, OPTIONAL | READ_ONLY); - add("web_server_version", STRING_TYPE, OPTIONAL | READ_ONLY); - add("web_server_module_version", STRING_TYPE, OPTIONAL | READ_ONLY); - add("ruby", STRING_TYPE, OPTIONAL, "ruby"); - - addValidator(ConfigKit::validateIntegrationMode); - addValidator(ConfigKit::validateStandaloneEngine); - - finalize(); - } - }; - - typedef WebSocketCommandReverseServer::ConfigChangeRequest ConfigChangeRequest; - - typedef WebSocketCommandReverseServer::ConnectionPtr ConnectionPtr; - typedef WebSocketCommandReverseServer::MessagePtr MessagePtr; - typedef boost::function ConfigGetter; - typedef vector Controllers; - -private: - WebSocketCommandReverseServer server; - dynamic_thread_group threads; - Json::Value globalPropertiesFromInstanceDir; - - bool onMessage(WebSocketCommandReverseServer *server, - const ConnectionPtr &conn, const MessagePtr &msg) - { - Json::Value doc; - - try { - doc = parseAndBasicValidateMessageAsJSON(msg->get_payload()); - } catch (const RuntimeException &e) { - Json::Value reply; - reply["result"] = "error"; - reply["request_id"] = doc["request_id"]; - reply["data"]["message"] = e.what(); - sendJsonReply(conn, reply); - return true; - } - - if (doc["action"] == "get") { - return onGetMessage(conn, doc); - } else { - return onUnknownMessageAction(conn, doc); - } - } - - - bool onGetMessage(const ConnectionPtr &conn, const Json::Value &doc) { - const string resource = doc["resource"].asString(); - - if (resource == "server_properties") { - return onGetServerProperties(conn, doc); - } else if (resource == "global_properties") { - return onGetGlobalProperties(conn, doc); - } else if (resource == "global_configuration") { - return onGetGlobalConfiguration(conn, doc); - } else if (resource == "global_statistics") { - return onGetGlobalStatistics(conn, doc); - } else if (resource == "application_properties") { - return onGetApplicationProperties(conn, doc); - } else if (resource == "application_configuration") { - return onGetApplicationConfig(conn, doc); - } else if (resource == "application_logs") { - return onGetApplicationLogs(conn, doc); - } else { - return onUnknownResource(conn, doc); - } - } - - bool onGetServerProperties(const ConnectionPtr &conn, const Json::Value &doc) { - threads.create_thread( - boost::bind(&AdminPanelConnector::onGetServerPropertiesBgJob, this, - conn, doc, server.getConfig()["ruby"].asString()), - "AdminPanelCommandServer: get_server_properties background job", - 128 * 1024); - return false; - } - - void onGetServerPropertiesBgJob(const ConnectionPtr &conn, const Json::Value &doc, - const string &ruby) - { - vector args; - args.push_back("passenger-config"); - args.push_back("system-properties"); - - int status = 0; - SubprocessOutput output; - try { - runInternalRubyTool(*resourceLocator, ruby, args, &status, &output); - } catch (const std::exception &e) { - server.getIoService().post(boost::bind( - &AdminPanelConnector::onGetServerPropertiesDone, this, - conn, doc, string(), -1, e.what() - )); - return; - } - - server.getIoService().post(boost::bind( - &AdminPanelConnector::onGetServerPropertiesDone, this, - conn, doc, output.data, status, string() - )); - } - - void onGetServerPropertiesDone(const ConnectionPtr &conn, const Json::Value &doc, - const string output, int status, const string &error) - { - Json::Value reply; - reply["request_id"] = doc["request_id"]; - if (error.empty()) { - if (status == 0 || status == -1) { - Json::Reader reader; - Json::Value dataDoc; - - if (output.empty()) { - reply["result"] = "error"; - reply["data"]["message"] = "Error parsing internal helper tool output"; - P_ERROR(getLogPrefix() << "Error parsing internal helper tool output.\n" << - "Raw data: \"\""); - } else if (reader.parse(output, dataDoc)) { - reply["result"] = "ok"; - reply["data"] = dataDoc; - } else { - reply["result"] = "error"; - reply["data"]["message"] = "Error parsing internal helper tool output"; - P_ERROR(getLogPrefix() << "Error parsing internal helper tool output.\n" << - "Error: " << reader.getFormattedErrorMessages() << "\n" - "Raw data: \"" << cEscapeString(output) << "\""); - } - } else { - int exitStatus = WEXITSTATUS(status); - reply["result"] = "error"; - reply["data"]["message"] = "Internal helper tool exited with status " - + toString(exitStatus); - P_ERROR(getLogPrefix() << "Internal helper tool exited with status " - << exitStatus << ". Raw output: \"" << cEscapeString(output) << "\""); - } - } else { - reply["result"] = "error"; - reply["data"]["message"] = error; - } - sendJsonReply(conn, reply); - server.doneReplying(conn); - } - - bool onGetGlobalProperties(const ConnectionPtr &conn, const Json::Value &doc) { - const ConfigKit::Store &config = server.getConfig(); - Json::Value reply, data; - reply["result"] = "ok"; - reply["request_id"] = doc["request_id"]; - - data = globalPropertiesFromInstanceDir; - data["version"] = PASSENGER_VERSION; - data["core_pid"] = Json::UInt(getpid()); - - string integrationMode = config["integration_mode"].asString(); - data["integration_mode"]["name"] = integrationMode; - if (!config["web_server_module_version"].isNull()) { - data["integration_mode"]["web_server_module_version"] = config["web_server_module_version"]; - } - if (integrationMode == "standalone") { - data["integration_mode"]["standalone_engine"] = config["standalone_engine"]; - } - if (!config["web_server_version"].isNull()) { - data["integration_mode"]["web_server_version"] = config["web_server_version"]; - } - - data["originally_packaged"] = resourceLocator->isOriginallyPackaged(); - if (!resourceLocator->isOriginallyPackaged()) { - data["packaging_method"] = resourceLocator->getPackagingMethod(); - } - - reply["data"] = data; - sendJsonReply(conn, reply); - return true; - } - - bool onGetGlobalConfiguration(const ConnectionPtr &conn, const Json::Value &doc) { - threads.create_thread( - boost::bind(&AdminPanelConnector::onGetGlobalConfigurationBgJob, this, - conn, doc), - "AdminPanelCommandServer: get_global_config background job", - 128 * 1024); - return false; - } - - void onGetGlobalConfigurationBgJob(const ConnectionPtr &conn, const Json::Value &input) { - Json::Value globalConfig = configGetter()["config_manifest"]["effective_value"]["global_configuration"]; - server.getIoService().post(boost::bind( - &AdminPanelConnector::onGetGlobalConfigDone, this, - conn, input, globalConfig - )); - } - - void onGetGlobalConfigDone(const ConnectionPtr &conn, const Json::Value &input, - Json::Value config) - { - Json::Value reply; - - reply["result"] = "ok"; - reply["request_id"] = input["request_id"]; - reply["data"]["options"] = config; - - sendJsonReply(conn, reply); - server.doneReplying(conn); - } - - bool onGetGlobalStatistics(const ConnectionPtr &conn, const Json::Value &doc) { - Json::Value reply; - reply["result"] = "ok"; - reply["request_id"] = doc["request_id"]; - reply["data"]["message"] = Json::arrayValue; - - for (unsigned int i = 0; i < controllers.size(); i++) { - reply["data"]["message"].append(controllers[i]->inspectStateAsJson()); - } - - sendJsonReply(conn, reply); - return true; - } - - bool onGetApplicationProperties(const ConnectionPtr &conn, const Json::Value &doc) { - ConfigKit::Schema argumentsSchema = - ApplicationPool2::Pool::ToJsonOptions::createSchema(); - Json::Value args(Json::objectValue), reply; - ApplicationPool2::Pool::ToJsonOptions inspectOptions = - ApplicationPool2::Pool::ToJsonOptions::makeAuthorized(); - - if (doc.isMember("arguments")) { - ConfigKit::Store store(argumentsSchema); - vector errors; - - if (store.update(doc["arguments"], errors)) { - inspectOptions.set(store.inspectEffectiveValues()); - } else { - reply["result"] = "error"; - reply["request_id"] = doc["request_id"]; - reply["data"]["message"] = "Invalid arguments: " + - ConfigKit::toString(errors); - sendJsonReply(conn, reply); - return true; - } - } - - reply["result"] = "ok"; - reply["request_id"] = doc["request_id"]; - reply["data"]["applications"] = appPool->inspectPropertiesInAdminPanelFormat( - inspectOptions); - sendJsonReply(conn, reply); - return true; - } - - static void modifyEnvironmentVariables(Json::Value &option) { - Json::Value::iterator it; - for (it = option.begin(); it != option.end(); it++) { - Json::Value &suboption = *it; - suboption["value"] = suboption["value"].toStyledString(); - } - } - - bool onGetApplicationConfig(const ConnectionPtr &conn, const Json::Value &doc) { - Json::Value appConfigsContainer = configGetter()["config_manifest"] - ["effective_value"]["application_configurations"]; - Json::Value appConfigsContainerOutput; - Json::Value reply; - - if (doc.isMember("arguments")) { - ConfigKit::Schema argumentsSchema = - ApplicationPool2::Pool::ToJsonOptions::createSchema(); - ConfigKit::Store store(argumentsSchema); - vector errors; - - if (!store.update(doc["arguments"], errors)) { - reply["result"] = "error"; - reply["request_id"] = doc["request_id"]; - reply["data"]["message"] = "Invalid arguments: " + - ConfigKit::toString(errors); - sendJsonReply(conn, reply); - return true; - } - - Json::Value allowedApplicationIds = - store.inspectEffectiveValues()["application_ids"]; - if (allowedApplicationIds.isNull()) { - appConfigsContainerOutput = appConfigsContainer; - } else { - appConfigsContainerOutput = filterJsonObject( - appConfigsContainer, - allowedApplicationIds); - } - } else { - appConfigsContainerOutput = appConfigsContainer; - } - - reply["result"] = "ok"; - reply["request_id"] = doc["request_id"]; - reply["data"]["options"] = appConfigsContainerOutput; - - sendJsonReply(conn, reply); - return true; - } - - void addWatchedFiles() { - Json::Value appConfigs = configGetter()["config_manifest"]["effective_value"]["application_configurations"]; - - // As a hack, we look up the watched files config (passenger monitor log file) in the manifest. The manifest - // is meant for users, which means that key names depend on the integration mode. In the future when - // component configuration more routed through ConfigKit we can get rid of the hack. - string integrationMode = server.getConfig()["integration_mode"].asString(); - string passengerMonitorLogFile; - string passengerAppRoot; - if (integrationMode == "apache") { - passengerMonitorLogFile = "PassengerMonitorLogFile"; - passengerAppRoot = "PassengerAppRoot"; - } else { - passengerMonitorLogFile = "passenger_monitor_log_file"; - passengerAppRoot = "passenger_app_root"; - // TODO: this probably doesn't give any results with the builtin engine (not supported in other places either) - } - - foreach (HashedStaticString key, appConfigs.getMemberNames()) { - Json::Value files = appConfigs[key]["options"][passengerMonitorLogFile]["value_hierarchy"][0]["value"]; - string appRoot = appConfigs[key]["options"][passengerAppRoot]["value_hierarchy"][0]["value"].asString(); - - pair ids; - try { - ids = appPool->getGroupRunUidAndGids(key); - } catch (const RuntimeException &) { - files = Json::nullValue; - } - if (!files.isNull()) { - string usernameOrUid = lookupSystemUsernameByUid(ids.first, true); - - foreach (Json::Value file, files) { - string f = file.asString(); - string maxLines = toString(LOG_MONITORING_MAX_LINES); - Pipe pipe = createPipe(__FILE__, __LINE__); - string agentExe = resourceLocator->findSupportBinary(AGENT_EXE); - vector execArgs; - - execArgs.push_back(agentExe.c_str()); - execArgs.push_back("exec-helper"); - if (geteuid() == 0) { - execArgs.push_back("--user"); - execArgs.push_back(usernameOrUid.c_str()); - } - execArgs.push_back("tail"); - execArgs.push_back("-n"); - execArgs.push_back(maxLines.c_str()); - execArgs.push_back(f.c_str()); - execArgs.push_back(NULL); - - pid_t pid = syscalls::fork(); - - if (pid == -1) { - int e = errno; - throw SystemException("Cannot fork a new process", e); - } else if (pid == 0) { - chdir(appRoot.c_str()); - - dup2(pipe.second, STDOUT_FILENO); - pipe.first.close(); - pipe.second.close(); - closeAllFileDescriptors(2); - - execvp(execArgs[0], const_cast(&execArgs[0])); - - int e = errno; - char buf[256]; - char *pos = buf; - const char *end = pos + 256; - - pos = ASSU::appendData(pos, end, "Cannot execute \""); - pos = ASSU::appendData(pos, end, agentExe.c_str()); - pos = ASSU::appendData(pos, end, "\": "); - pos = ASSU::appendData(pos, end, strerror(e)); - pos = ASSU::appendData(pos, end, " (errno="); - pos = ASSU::appendInteger(pos, end, e); - pos = ASSU::appendData(pos, end, ")\n"); - ASSU::writeNoWarn(STDERR_FILENO, buf, pos - buf); - _exit(1); - } else { - pipe.second.close(); - string out = readAll(pipe.first, - std::numeric_limits::max()).first; - LoggingKit::context->saveMonitoredFileLog(key, f.c_str(), f.size(), - out.data(), out.size()); - pipe.first.close(); - syscalls::waitpid(pid, NULL, 0); - } - } - } - } - } - - bool onGetApplicationLogs(const ConnectionPtr &conn, const Json::Value &doc) { - Json::Value reply; - reply["result"] = "ok"; - reply["request_id"] = doc["request_id"]; - - addWatchedFiles(); - - reply["data"]["logs"] = LoggingKit::context->convertLog(); - sendJsonReply(conn, reply); - return true; - } - - bool onUnknownResource(const ConnectionPtr &conn, const Json::Value &doc) { - Json::Value reply; - reply["result"] = "error"; - reply["request_id"] = doc["request_id"]; - reply["data"]["message"] = "Unknown resource '" + doc["resource"].asString() + "'"; - sendJsonReply(conn, reply); - return true; - } - - bool onUnknownMessageAction(const ConnectionPtr &conn, const Json::Value &doc) { - Json::Value reply; - reply["result"] = "error"; - reply["request_id"] = doc["request_id"]; - reply["data"]["message"] = "Unknown action '" + doc["action"].asString() + "'"; - sendJsonReply(conn, reply); - return true; - } - - - Json::Value parseAndBasicValidateMessageAsJSON(const string &msg) const { - Json::Value doc; - Json::Reader reader; - if (!reader.parse(msg, doc)) { - throw RuntimeException("Error parsing command JSON document: " - + reader.getFormattedErrorMessages()); - } - - if (!doc.isObject()) { - throw RuntimeException("Invalid command JSON document: must be an object"); - } - if (!doc.isMember("action")) { - throw RuntimeException("Invalid command JSON document: missing 'action' key"); - } - if (!doc["action"].isString()) { - throw RuntimeException("Invalid command JSON document: the 'action' key must be a string"); - } - if (!doc.isMember("request_id")) { - throw RuntimeException("Invalid command JSON document: missing 'request_id' key"); - } - if (!doc.isMember("resource")) { - throw RuntimeException("Invalid command JSON document: missing 'resource' key"); - } - if (!doc["resource"].isString()) { - throw RuntimeException("Invalid command JSON document: the 'resource' key must be a string"); - } - if (doc.isMember("arguments") && !doc["arguments"].isObject()) { - throw RuntimeException("Invalid command JSON document: the 'arguments' key, when present, must be an object"); - } - - return doc; - } - - void sendJsonReply(const ConnectionPtr &conn, const Json::Value &doc) { - Json::FastWriter writer; - string str = writer.write(doc); - WCRS_DEBUG_FRAME(&server, "Replying with:", str); - conn->send(str); - } - - void readInstanceDirProperties(const string &instanceDir) { - Json::Value doc; - Json::Reader reader; - - if (!reader.parse(unsafeReadFile(instanceDir + "/properties.json"), doc)) { - throw RuntimeException("Cannot parse " + instanceDir + "/properties.json: " - + reader.getFormattedErrorMessages()); - } - - globalPropertiesFromInstanceDir["instance_id"] = doc["instance_id"]; - globalPropertiesFromInstanceDir["watchdog_pid"] = doc["watchdog_pid"]; - } - - Json::Value filterJsonObject(const Json::Value &object, - const Json::Value &allowedKeys) const - { - Json::Value::const_iterator it, end = allowedKeys.end(); - Json::Value result(Json::objectValue); - - for (it = allowedKeys.begin(); it != end; it++) { - if (object.isMember(it->asString())) { - result[it->asString()] = object[it->asString()]; - } - } - - return result; - } - - void initializePropertiesWithoutInstanceDir() { - globalPropertiesFromInstanceDir["instance_id"] = - InstanceDirectory::generateInstanceId(); - } - - string getLogPrefix() const { - return server.getConfig()["log_prefix"].asString(); - } - - WebSocketCommandReverseServer::MessageHandler createMessageFunctor() { - return boost::bind(&AdminPanelConnector::onMessage, this, - boost::placeholders::_1, boost::placeholders::_2, - boost::placeholders::_3); - } - -public: - /******* Dependencies *******/ - - ResourceLocator *resourceLocator; - ApplicationPool2::PoolPtr appPool; - ConfigGetter configGetter; - Controllers controllers; - - - AdminPanelConnector(const Schema &schema, const Json::Value &config, - const ConfigKit::Translator &translator = ConfigKit::DummyTranslator()) - : server(schema, createMessageFunctor(), config, translator), - resourceLocator(NULL) - { - if (!config["instance_dir"].isNull()) { - readInstanceDirProperties(config["instance_dir"].asString()); - } else { - initializePropertiesWithoutInstanceDir(); - } - } - - void initialize() { - if (resourceLocator == NULL) { - throw RuntimeException("resourceLocator must be non-NULL"); - } - if (appPool == NULL) { - throw RuntimeException("appPool must be non-NULL"); - } - if (configGetter.empty()) { - throw RuntimeException("configGetter must be non-NULL"); - } - server.initialize(); - } - - void run() { - server.run(); - } - - void asyncPrepareConfigChange(const Json::Value &updates, - ConfigChangeRequest &req, - const ConfigKit::CallbackTypes::PrepareConfigChange &callback) - { - server.asyncPrepareConfigChange(updates, req, callback); - } - - void asyncCommitConfigChange(ConfigChangeRequest &req, - const ConfigKit::CallbackTypes::CommitConfigChange &callback) - BOOST_NOEXCEPT_OR_NOTHROW - { - server.asyncCommitConfigChange(req, callback); - } - - void asyncShutdown(const WebSocketCommandReverseServer::Callback &callback - = WebSocketCommandReverseServer::Callback()) - { - server.asyncShutdown(callback); - } -}; - -} // namespace Core -} // namespace Passenger - -#endif /* _PASSENGER_ADMIN_PANEL_CONNECTOR_H_ */ diff --git a/src/agent/Core/Config.h b/src/agent/Core/Config.h index c90b11ae6c..6e6719f3c5 100644 --- a/src/agent/Core/Config.h +++ b/src/agent/Core/Config.h @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include @@ -64,23 +63,6 @@ using namespace std; * (do not edit: following text is automatically generated * by 'rake configkit_schemas_inline_comments') * - * admin_panel_auth_type string - default("basic") - * admin_panel_close_timeout float - default(10.0) - * admin_panel_connect_timeout float - default(30.0) - * admin_panel_data_debug boolean - default(false) - * admin_panel_password string - secret - * admin_panel_password_file string - - - * admin_panel_ping_interval float - default(30.0) - * admin_panel_ping_timeout float - default(30.0) - * admin_panel_proxy_password string - secret - * admin_panel_proxy_timeout float - default(30.0) - * admin_panel_proxy_url string - - - * admin_panel_proxy_username string - - - * admin_panel_reconnect_timeout float - default(5.0) - * admin_panel_url string - read_only - * admin_panel_username string - - - * admin_panel_websocketpp_debug_access boolean - default(false) - * admin_panel_websocketpp_debug_error boolean - default(false) * api_server_accept_burst_count unsigned integer - default(32) * api_server_addresses array of strings - default([]),read_only * api_server_authorizations array - default("[FILTERED]"),secret @@ -149,7 +131,7 @@ using namespace std; * hook_queue_full_error string - read_only * hook_spawn_failed string - read_only * instance_dir string - read_only - * integration_mode string - default("standalone") + * integration_mode string - default("standalone"),read_only * log_level string - default("notice") * log_target any - default({"stderr": true}) * max_instances_per_app unsigned integer - read_only @@ -174,7 +156,6 @@ using namespace std; * single_app_mode_app_type string - read_only * single_app_mode_startup_file string - read_only * spawn_dir string - default,read_only - * standalone_engine string - default * stat_throttle_rate unsigned integer - default(10) * telemetry_collector_ca_certificate_path string - - * telemetry_collector_debug_curl boolean - default(false) @@ -191,7 +172,6 @@ using namespace std; * user_switching boolean - default(true) * vary_turbocache_by_cookie string - - * watchdog_fd_passing_password string - secret - * web_server_module_version string - read_only * web_server_version string - read_only * * END @@ -416,10 +396,6 @@ class Schema: public ConfigKit::Schema { ServerKit::Schema schema; ConfigKit::PrefixTranslator translator; } apiServerKit; - struct { - AdminPanelConnector::Schema schema; - ConfigKit::TableTranslator translator; - } adminPanelConnector; Schema(const WrapperRegistry::Registry *wrapperRegistry = NULL) : controllerSingleAppMode(wrapperRegistry) @@ -477,15 +453,7 @@ class Schema: public ConfigKit::Schema { addSubSchema(apiServerKit.schema, apiServerKit.translator); erase("api_server_secure_mode_password"); - // Add subschema: adminPanelConnector - addSubSchemaPrefixTranslations( - adminPanelConnector.translator, "admin_panel_"); - adminPanelConnector.translator.finalize(); - addSubSchema(adminPanelConnector.schema, adminPanelConnector.translator); - erase("admin_panel_log_prefix"); erase("ruby"); - - override("admin_panel_url", STRING_TYPE, OPTIONAL | READ_ONLY); override("instance_dir", STRING_TYPE, OPTIONAL | READ_ONLY); override("multi_app", BOOL_TYPE, OPTIONAL | READ_ONLY, false); overrideWithDynamicDefault("default_server_name", STRING_TYPE, OPTIONAL, getDefaultServerName); diff --git a/src/agent/Core/ConfigChange.cpp b/src/agent/Core/ConfigChange.cpp index 45340f6297..846d66e40c 100644 --- a/src/agent/Core/ConfigChange.cpp +++ b/src/agent/Core/ConfigChange.cpp @@ -54,7 +54,6 @@ struct ConfigChangeRequest { vector forController; ServerKit::ConfigChangeRequest forApiServerKit; ApiServer::ConfigChangeRequest forApiServer; - AdminPanelConnector::ConfigChangeRequest forAdminPanelConnector; ConfigChangeRequest() : counter(0) @@ -146,18 +145,6 @@ asyncPrepareConfigChangeForApiServer(const Json::Value &updates, ConfigChangeReq asyncPrepareConfigChangeCompletedOne(req); } -static void -asyncPrepareConfigChangeForAdminPanelConnectorDone(const vector &errors, - AdminPanelConnector::ConfigChangeRequest &_, ConfigChangeRequest *req) -{ - vector translatedErrors = coreSchema->adminPanelConnector.translator.reverseTranslate(errors); - boost::lock_guard l(workingObjects->configSyncher); - P_DEBUG("asyncPrepareConfigChangeForAdminPanelConnectorDone: counter " - << req->counter << " -> " << (req->counter - 1)); - req->errors.insert(req->errors.begin(), translatedErrors.begin(), translatedErrors.end()); - asyncPrepareConfigChangeCompletedOne(req); -} - // // @@ -212,15 +199,6 @@ asyncPrepareConfigChange(const Json::Value &updates, ConfigChangeRequest *req, asyncPrepareConfigChangeForApiServer, updates, req)); } - if (wo->adminPanelConnector != NULL) { - req->counter++; - wo->adminPanelConnector->asyncPrepareConfigChange( - coreSchema->adminPanelConnector.translator.translate(updates), - req->forAdminPanelConnector, - boost::bind(asyncPrepareConfigChangeForAdminPanelConnectorDone, - boost::placeholders::_1, boost::placeholders::_2, req)); - } - /***************/ /***************/ @@ -268,16 +246,6 @@ asyncCommitConfigChangeForApiServer(ConfigChangeRequest *req) { asyncCommitConfigChangeCompletedOne(req); } -static void -asyncCommitConfigChangeForAdminPanelConnectorDone(AdminPanelConnector::ConfigChangeRequest &_, - ConfigChangeRequest *req) -{ - boost::lock_guard l(workingObjects->configSyncher); - P_DEBUG("asyncCommitConfigChangeForAdminPanelConnectorDone: counter " - << req->counter << " -> " << (req->counter - 1)); - asyncCommitConfigChangeCompletedOne(req); -} - // // @@ -321,14 +289,6 @@ asyncCommitConfigChange(ConfigChangeRequest *req, const CommitConfigChangeCallba asyncCommitConfigChangeForApiServer, req)); } - if (wo->adminPanelConnector != NULL) { - req->counter++; - wo->adminPanelConnector->asyncCommitConfigChange( - req->forAdminPanelConnector, - boost::bind(asyncCommitConfigChangeForAdminPanelConnectorDone, - boost::placeholders::_1, req)); - } - /***************/ /***************/ @@ -361,7 +321,7 @@ manipulateLoggingKitConfig(const ConfigKit::Store &coreConfig, const Json::Value &loggingKitConfig) { Json::Value result = loggingKitConfig; - result["buffer_logs"] = !coreConfig["admin_panel_url"].isNull(); + result["buffer_logs"] = false; return result; } diff --git a/src/agent/Core/CoreMain.cpp b/src/agent/Core/CoreMain.cpp index 37c966ba51..2d394673a3 100644 --- a/src/agent/Core/CoreMain.cpp +++ b/src/agent/Core/CoreMain.cpp @@ -45,21 +45,17 @@ #include #include #include -#include #include #include #include -#include #include #include #include -#include #include #include #include #include -#include #include #include @@ -100,7 +96,6 @@ #include #include #include -#include using namespace boost; using namespace oxt; @@ -167,8 +162,6 @@ namespace Core { SecurityUpdateChecker *securityUpdateChecker; TelemetryCollector *telemetryCollector; - AdminPanelConnector *adminPanelConnector; - oxt::thread *adminPanelConnectorThread; WorkingObjects() : exitEvent(__FILE__, __LINE__, "WorkingObjects: exitEvent"), @@ -177,9 +170,7 @@ namespace Core { shutdownCounter(0), prestarterThread(NULL), securityUpdateChecker(NULL), - telemetryCollector(NULL), - adminPanelConnector(NULL), - adminPanelConnectorThread(NULL) + telemetryCollector(NULL) /*******************/ { for (unsigned int i = 0; i < SERVER_KIT_MAX_SERVER_ENDPOINTS; i++) { @@ -190,8 +181,6 @@ namespace Core { ~WorkingObjects() { delete prestarterThread; - delete adminPanelConnectorThread; - delete adminPanelConnector; delete securityUpdateChecker; delete telemetryCollector; @@ -898,46 +887,6 @@ initializeTelemetryCollector() { wo.shutdownCounter.fetch_add(1, boost::memory_order_relaxed); } -static void -runAdminPanelConnector(AdminPanelConnector *connector) { - connector->run(); - P_DEBUG("Admin panel connector shutdown finished"); - serverShutdownFinished(); -} - -static void -initializeAdminPanelConnector() { - TRACE_POINT(); - WorkingObjects &wo = *workingObjects; - - if (coreConfig->get("admin_panel_url").empty()) { - return; - } - - Json::Value config = coreConfig->inspectEffectiveValues(); - config["log_prefix"] = "AdminPanelConnector: "; - config["ruby"] = config["default_ruby"]; - - P_NOTICE("Initialize connection with " << PROGRAM_NAME " admin panel at " - << config["admin_panel_url"].asString()); - AdminPanelConnector *connector = new Core::AdminPanelConnector( - coreSchema->adminPanelConnector.schema, config, - coreSchema->adminPanelConnector.translator); - connector->resourceLocator = Agent::Fundamentals::context->resourceLocator; - connector->appPool = wo.appPool; - connector->configGetter = inspectConfig; - for (unsigned int i = 0; i < wo.threadWorkingObjects.size(); i++) { - ThreadWorkingObjects *two = &wo.threadWorkingObjects[i]; - connector->controllers.push_back(two->controller); - } - connector->initialize(); - wo.shutdownCounter.fetch_add(1, boost::memory_order_relaxed); - wo.adminPanelConnector = connector; - wo.adminPanelConnectorThread = new oxt::thread( - boost::bind(runAdminPanelConnector, connector), - "Admin panel connector main loop", 128 * 1024); -} - static void prestartWebApps() { TRACE_POINT(); @@ -1256,9 +1205,6 @@ waitForExitEvent() { if (wo->telemetryCollector != NULL) { asyncShutdownTelemetryCollector(); } - if (wo->adminPanelConnector != NULL) { - wo->adminPanelConnector->asyncShutdown(); - } UPDATE_TRACE_POINT(); FD_ZERO(&fds); @@ -1348,7 +1294,6 @@ runCore() { initializeNonPrivilegedWorkingObjects(); initializeSecurityUpdateChecker(); initializeTelemetryCollector(); - initializeAdminPanelConnector(); prestartWebApps(); UPDATE_TRACE_POINT(); diff --git a/src/agent/Core/OptionParser.h b/src/agent/Core/OptionParser.h index cf8ce83870..757045d7f9 100644 --- a/src/agent/Core/OptionParser.h +++ b/src/agent/Core/OptionParser.h @@ -35,7 +35,7 @@ #include #include #include - +#include #include namespace Passenger { @@ -212,9 +212,6 @@ coreUsage() { printf(" --cpu-affine Enable per-thread CPU affinity (Linux only)\n"); printf(" --core-file-descriptor-ulimit NUMBER\n"); printf(" Set custom file descriptor ulimit for the core\n"); - printf(" --admin-panel-url URL\n"); - printf(" Connect to an admin panel through this service\n"); - printf(" connector URL\n"); printf(" --ctl NAME=VALUE Set low-level config option directly\n"); printf(" -h, --help Show this help\n"); printf("\n"); @@ -420,9 +417,6 @@ parseCoreOption(int argc, const char *argv[], int &i, Json::Value &updates) { } else if (p.isValueFlag(argc, i, argv[i], '\0', "--core-file-descriptor-ulimit")) { updates["file_descriptor_ulimit"] = atoi(argv[i + 1]); i += 2; - } else if (p.isValueFlag(argc, i, argv[i], '\0', "--admin-panel-url")) { - updates["admin_panel_url"] = argv[i + 1]; - i += 2; } else if (p.isValueFlag(argc, i, argv[i], '\0', "--ctl")) { const char *sep = strchr(argv[i + 1], '='); if (sep == NULL) { diff --git a/src/agent/Watchdog/Config.h b/src/agent/Watchdog/Config.h index 06d7aed3fc..8d3ef51238 100644 --- a/src/agent/Watchdog/Config.h +++ b/src/agent/Watchdog/Config.h @@ -46,23 +46,6 @@ using namespace std; * (do not edit: following text is automatically generated * by 'rake configkit_schemas_inline_comments') * - * admin_panel_auth_type string - default("basic") - * admin_panel_close_timeout float - default(10.0) - * admin_panel_connect_timeout float - default(30.0) - * admin_panel_data_debug boolean - default(false) - * admin_panel_password string - secret - * admin_panel_password_file string - - - * admin_panel_ping_interval float - default(30.0) - * admin_panel_ping_timeout float - default(30.0) - * admin_panel_proxy_password string - secret - * admin_panel_proxy_timeout float - default(30.0) - * admin_panel_proxy_url string - - - * admin_panel_proxy_username string - - - * admin_panel_reconnect_timeout float - default(5.0) - * admin_panel_url string - read_only - * admin_panel_username string - - - * admin_panel_websocketpp_debug_access boolean - default(false) - * admin_panel_websocketpp_debug_error boolean - default(false) * app_output_log_level string - default("notice") * benchmark_mode string - - * config_manifest object - read_only @@ -138,7 +121,7 @@ using namespace std; * hook_queue_full_error string - read_only * hook_spawn_failed string - read_only * instance_registry_dir string - default,read_only - * integration_mode string - default("standalone") + * integration_mode string - default("standalone"),read_only * log_level string - default("notice") * log_target any - default({"stderr": true}) * max_instances_per_app unsigned integer - read_only @@ -163,7 +146,6 @@ using namespace std; * single_app_mode_app_type string - read_only * single_app_mode_startup_file string - read_only * spawn_dir string - default,read_only - * standalone_engine string - default * startup_report_file string - - * stat_throttle_rate unsigned integer - default(10) * telemetry_collector_ca_certificate_path string - - @@ -197,7 +179,6 @@ using namespace std; * watchdog_api_server_start_reading_after_accept boolean - default(true) * watchdog_pid_file string - read_only * watchdog_pid_file_autodelete boolean - default(true) - * web_server_module_version string - read_only * web_server_version string - read_only * * END diff --git a/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp b/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp index 3d59b36006..2fbcd96176 100644 --- a/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +++ b/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp @@ -47,26 +47,6 @@ namespace Passenger { namespace Apache2Module { extern "C" const command_rec passenger_commands[] = { - AP_INIT_TAKE1("PassengerAdminPanelAuthType", - (Take1Func) cmd_passenger_admin_panel_auth_type, - NULL, - RSRC_CONF, - "The authentication type to use when connecting to the admin panel"), - AP_INIT_TAKE1("PassengerAdminPanelPassword", - (Take1Func) cmd_passenger_admin_panel_password, - NULL, - RSRC_CONF, - "The password to use when connecting to the admin panel using basic authentication"), - AP_INIT_TAKE1("PassengerAdminPanelUrl", - (Take1Func) cmd_passenger_admin_panel_url, - NULL, - RSRC_CONF, - "Connect to an admin panel at the given connector URL"), - AP_INIT_TAKE1("PassengerAdminPanelUsername", - (Take1Func) cmd_passenger_admin_panel_username, - NULL, - RSRC_CONF, - "The username to use when connecting to the admin panel using basic authentication"), AP_INIT_FLAG("PassengerAllowEncodedSlashes", (FlagFunc) cmd_passenger_allow_encoded_slashes, NULL, diff --git a/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp b/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp index f0d414953f..6d70b787d0 100644 --- a/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +++ b/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp @@ -56,66 +56,6 @@ namespace Apache2Module { * rake src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp */ -static const char * -cmd_passenger_admin_panel_auth_type(cmd_parms *cmd, void *pcfg, const char *arg) { - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->temp_pool, - "WARNING: %s", err); - } - - serverConfig.adminPanelAuthTypeSourceFile = cmd->directive->filename; - serverConfig.adminPanelAuthTypeSourceLine = cmd->directive->line_num; - serverConfig.adminPanelAuthTypeExplicitlySet = true; - serverConfig.adminPanelAuthType = arg; - return NULL; -} - -static const char * -cmd_passenger_admin_panel_password(cmd_parms *cmd, void *pcfg, const char *arg) { - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->temp_pool, - "WARNING: %s", err); - } - - serverConfig.adminPanelPasswordSourceFile = cmd->directive->filename; - serverConfig.adminPanelPasswordSourceLine = cmd->directive->line_num; - serverConfig.adminPanelPasswordExplicitlySet = true; - serverConfig.adminPanelPassword = arg; - return NULL; -} - -static const char * -cmd_passenger_admin_panel_url(cmd_parms *cmd, void *pcfg, const char *arg) { - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->temp_pool, - "WARNING: %s", err); - } - - serverConfig.adminPanelUrlSourceFile = cmd->directive->filename; - serverConfig.adminPanelUrlSourceLine = cmd->directive->line_num; - serverConfig.adminPanelUrlExplicitlySet = true; - serverConfig.adminPanelUrl = arg; - return NULL; -} - -static const char * -cmd_passenger_admin_panel_username(cmd_parms *cmd, void *pcfg, const char *arg) { - const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); - if (err != NULL) { - ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->temp_pool, - "WARNING: %s", err); - } - - serverConfig.adminPanelUsernameSourceFile = cmd->directive->filename; - serverConfig.adminPanelUsernameSourceLine = cmd->directive->line_num; - serverConfig.adminPanelUsernameExplicitlySet = true; - serverConfig.adminPanelUsername = arg; - return NULL; -} - static const char * cmd_passenger_allow_encoded_slashes(cmd_parms *cmd, void *pcfg, const char *arg) { DirConfig *config = (DirConfig *) pcfg; diff --git a/src/apache2_module/Hooks.cpp b/src/apache2_module/Hooks.cpp index a054a8b591..1d09662ec7 100644 --- a/src/apache2_module/Hooks.cpp +++ b/src/apache2_module/Hooks.cpp @@ -1381,10 +1381,6 @@ class Hooks { config["stat_throttle_rate"] = serverConfig.statThrottleRate; config["turbocaching"] = serverConfig.turbocaching; config["prestart_urls"] = strsetToJson(serverConfig.prestartURLs); - config["admin_panel_url"] = nonEmptyString(serverConfig.adminPanelUrl); - config["admin_panel_auth_type"] = nonEmptyString(serverConfig.adminPanelAuthType); - config["admin_panel_username"] = nonEmptyString(serverConfig.adminPanelUsername); - config["admin_panel_password"] = nonEmptyString(serverConfig.adminPanelPassword); config["disable_log_prefix"] = serverConfig.disableLogPrefix; if (!serverConfig.logFile.empty()) { diff --git a/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp b/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp index 3761a9eea7..0e78142567 100644 --- a/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +++ b/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp @@ -47,50 +47,6 @@ void ConfigManifestGenerator::autoGenerated_generateConfigManifestForServerConfig() { Json::Value &globalOptionsContainer = manifest["global_configuration"]; - if (serverConfig.adminPanelAuthTypeExplicitlySet) { - Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer, - "PassengerAdminPanelAuthType", - sizeof("PassengerAdminPanelAuthType") - 1); - Json::Value &hierarchyMember = addOptionContainerHierarchyMember(optionContainer, - serverConfig.adminPanelAuthTypeSourceFile, - serverConfig.adminPanelAuthTypeSourceLine); - hierarchyMember["value"] = Json::Value( - serverConfig.adminPanelAuthType.data(), - serverConfig.adminPanelAuthType.data() + serverConfig.adminPanelAuthType.size()); - } - if (serverConfig.adminPanelPasswordExplicitlySet) { - Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer, - "PassengerAdminPanelPassword", - sizeof("PassengerAdminPanelPassword") - 1); - Json::Value &hierarchyMember = addOptionContainerHierarchyMember(optionContainer, - serverConfig.adminPanelPasswordSourceFile, - serverConfig.adminPanelPasswordSourceLine); - hierarchyMember["value"] = Json::Value( - serverConfig.adminPanelPassword.data(), - serverConfig.adminPanelPassword.data() + serverConfig.adminPanelPassword.size()); - } - if (serverConfig.adminPanelUrlExplicitlySet) { - Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer, - "PassengerAdminPanelUrl", - sizeof("PassengerAdminPanelUrl") - 1); - Json::Value &hierarchyMember = addOptionContainerHierarchyMember(optionContainer, - serverConfig.adminPanelUrlSourceFile, - serverConfig.adminPanelUrlSourceLine); - hierarchyMember["value"] = Json::Value( - serverConfig.adminPanelUrl.data(), - serverConfig.adminPanelUrl.data() + serverConfig.adminPanelUrl.size()); - } - if (serverConfig.adminPanelUsernameExplicitlySet) { - Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer, - "PassengerAdminPanelUsername", - sizeof("PassengerAdminPanelUsername") - 1); - Json::Value &hierarchyMember = addOptionContainerHierarchyMember(optionContainer, - serverConfig.adminPanelUsernameSourceFile, - serverConfig.adminPanelUsernameSourceLine); - hierarchyMember["value"] = Json::Value( - serverConfig.adminPanelUsername.data(), - serverConfig.adminPanelUsername.data() + serverConfig.adminPanelUsername.size()); - } if (serverConfig.anonymousTelemetryProxyExplicitlySet) { Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer, "PassengerAnonymousTelemetryProxy", diff --git a/src/apache2_module/ServerConfig/AutoGeneratedStruct.h b/src/apache2_module/ServerConfig/AutoGeneratedStruct.h index 604528e107..a147762821 100644 --- a/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +++ b/src/apache2_module/ServerConfig/AutoGeneratedStruct.h @@ -123,26 +123,6 @@ struct AutoGeneratedServerConfig { */ int statThrottleRate; - /* - * The authentication type to use when connecting to the admin panel - */ - StaticString adminPanelAuthType; - - /* - * The password to use when connecting to the admin panel using basic authentication - */ - StaticString adminPanelPassword; - - /* - * Connect to an admin panel at the given connector URL - */ - StaticString adminPanelUrl; - - /* - * The username to use when connecting to the admin panel using basic authentication - */ - StaticString adminPanelUsername; - /* * Use specified HTTP/SOCKS proxy for Phusion Passenger(R) anonymous telemetry collection. */ @@ -222,10 +202,6 @@ struct AutoGeneratedServerConfig { StaticString responseBufferHighWatermarkSourceFile; StaticString socketBacklogSourceFile; StaticString statThrottleRateSourceFile; - StaticString adminPanelAuthTypeSourceFile; - StaticString adminPanelPasswordSourceFile; - StaticString adminPanelUrlSourceFile; - StaticString adminPanelUsernameSourceFile; StaticString anonymousTelemetryProxySourceFile; StaticString dataBufferDirSourceFile; StaticString defaultGroupSourceFile; @@ -253,10 +229,6 @@ struct AutoGeneratedServerConfig { unsigned int responseBufferHighWatermarkSourceLine; unsigned int socketBacklogSourceLine; unsigned int statThrottleRateSourceLine; - unsigned int adminPanelAuthTypeSourceLine; - unsigned int adminPanelPasswordSourceLine; - unsigned int adminPanelUrlSourceLine; - unsigned int adminPanelUsernameSourceLine; unsigned int anonymousTelemetryProxySourceLine; unsigned int dataBufferDirSourceLine; unsigned int defaultGroupSourceLine; @@ -284,10 +256,6 @@ struct AutoGeneratedServerConfig { bool responseBufferHighWatermarkExplicitlySet: 1; bool socketBacklogExplicitlySet: 1; bool statThrottleRateExplicitlySet: 1; - bool adminPanelAuthTypeExplicitlySet: 1; - bool adminPanelPasswordExplicitlySet: 1; - bool adminPanelUrlExplicitlySet: 1; - bool adminPanelUsernameExplicitlySet: 1; bool anonymousTelemetryProxyExplicitlySet: 1; bool dataBufferDirExplicitlySet: 1; bool defaultGroupExplicitlySet: 1; @@ -317,18 +285,6 @@ struct AutoGeneratedServerConfig { responseBufferHighWatermark = DEFAULT_RESPONSE_BUFFER_HIGH_WATERMARK; socketBacklog = DEFAULT_SOCKET_BACKLOG; statThrottleRate = DEFAULT_STAT_THROTTLE_RATE; - /* - * adminPanelAuthType: default initialized - */ - /* - * adminPanelPassword: default initialized - */ - /* - * adminPanelUrl: default initialized - */ - /* - * adminPanelUsername: default initialized - */ /* * anonymousTelemetryProxy: default initialized */ @@ -378,10 +334,6 @@ struct AutoGeneratedServerConfig { responseBufferHighWatermarkSourceLine = 0; socketBacklogSourceLine = 0; statThrottleRateSourceLine = 0; - adminPanelAuthTypeSourceLine = 0; - adminPanelPasswordSourceLine = 0; - adminPanelUrlSourceLine = 0; - adminPanelUsernameSourceLine = 0; anonymousTelemetryProxySourceLine = 0; dataBufferDirSourceLine = 0; defaultGroupSourceLine = 0; @@ -409,10 +361,6 @@ struct AutoGeneratedServerConfig { responseBufferHighWatermarkExplicitlySet = false; socketBacklogExplicitlySet = false; statThrottleRateExplicitlySet = false; - adminPanelAuthTypeExplicitlySet = false; - adminPanelPasswordExplicitlySet = false; - adminPanelUrlExplicitlySet = false; - adminPanelUsernameExplicitlySet = false; anonymousTelemetryProxyExplicitlySet = false; dataBufferDirExplicitlySet = false; defaultGroupExplicitlySet = false; diff --git a/src/cxx_supportlib/WebSocketCommandReverseServer.h b/src/cxx_supportlib/WebSocketCommandReverseServer.h deleted file mode 100644 index f9ee0a2ea7..0000000000 --- a/src/cxx_supportlib/WebSocketCommandReverseServer.h +++ /dev/null @@ -1,975 +0,0 @@ -/* - * Phusion Passenger - https://www.phusionpassenger.com/ - * Copyright (c) 2017-2025 Asynchronous Holding B.V. - * - * "Passenger", "Phusion Passenger" and "Union Station" are registered - * trademarks of Asynchronous Holding B.V. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#ifndef _PASSENGER_WEB_SOCKET_COMMAND_REVERSE_SERVER_H_ -#define _PASSENGER_WEB_SOCKET_COMMAND_REVERSE_SERVER_H_ - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Passenger { - -using namespace std; - - -#define WCRS_DEBUG_FRAME(self, expr1, expr2) \ - P_LOG_UNLIKELY(Passenger::LoggingKit::context, \ - (self)->_getDataDebugLevel(), \ - __FILE__, __LINE__, \ - (self)->_getLogPrefix() << expr1 << " \"" \ - << cEscapeString(expr2) << "\"") - - -/** - * A generic WebSocket command "server" that implements a request/response - * model. - * - * The reason why the name contains the word "reverse" is because it doesn't - * actually listens on a port. Instead, it connects to a port and receives - * commands from there. - * - * This class is generic in the sense that it handles all sorts of connection - * management logic such as reconnecting on failure, handling pings, timeouts, - * configuration, basic flow control, etc. It doesn't contain any logic for - * actually handling incoming commands: you are supposed to supply a function - * for handling incoming commands (the message handler). This allows seperating - * all the connection management logic from the actual message handling - * business logic. - * - * ## Usage - * - * static bool - * onMessage(WebSocketCommandReverseServer *server, - * const WebSocketCommandReverseServer::ConnectionPtr &conn, - * const WebSocketCommandReverseServer::MessagePtr &msg) - * { - * P_INFO("Message received: " << msg->get_payload()); - * conn->send("Echo: " + msg->get_payload()); - * return true; - * } - * - * - * // Set configuration - * Json::Value config; - * config["url"] = "ws://127.0.0.1:8001/"; - * - * // Create and initialize the server - * WebSocketCommandReverseServer::Schema schema; - * WebSocketCommandReverseServer server(schema, onMessage, config); - * server.initialize(); - * - * // Enter the server's main loop. This blocks until something - * // calls `server.shutdown()`. - * server.run(); - * - * ## About the concurrency and I/O model - * - * WebSocketCommandReverseServer uses the WebSocket++ library and the - * Boost Asio I/O library. WebSocketCommandReverseServer manages its own - * event loop. - * - * The message handler will be called from the event loop's thread, so - * be careful. - * - * ## About flow control and backpressure - * - * We purposefully do not implement any flow control/backpressure on the - * WebSocket's _writing_ side. That is, if we send a large amount of data to - * the remote, then we do not wait until all that data has actually been - * sent out before proceeding to read the next message. Unfortunately the - * WebSocket++ API does not allow us to efficiently implement that: - * https://github.com/zaphoyd/websocketpp/issues/477 - * - * As of 4 September 2017 (Boost 1.64.0, WebSocket++ 0.7.0), - * we also do not implement any flow control/backpressure - * on the WebSocket's _reading_ side. If the server floods us with requests - * then all of them will be buffered. We are unable to implement flow control - * on the reading side because of a bug in either WebSocket++ or ASIO: if you - * pause/resume the WebSocket then it results in data loss or data corruption. - * - * So the server is responsible for ensuring that it does not overload the - * WebSocketCommandReverseServer. - */ -class WebSocketCommandReverseServer { -public: - /* - * BEGIN ConfigKit schema: Passenger::WebSocketCommandReverseServer::Schema - * (do not edit: following text is automatically generated - * by 'rake configkit_schemas_inline_comments') - * - * auth_type string - default("basic") - * close_timeout float - default(10.0) - * connect_timeout float - default(30.0) - * data_debug boolean - default(false) - * log_prefix string - - - * password string - secret - * password_file string - - - * ping_interval float - default(30.0) - * ping_timeout float - default(30.0) - * proxy_password string - secret - * proxy_timeout float - default(30.0) - * proxy_url string - - - * proxy_username string - - - * reconnect_timeout float - default(5.0) - * url string required - - * username string - - - * websocketpp_debug_access boolean - default(false) - * websocketpp_debug_error boolean - default(false) - * - * END - */ - class Schema: public ConfigKit::Schema { - private: - void initialize() { - using namespace ConfigKit; - - add("url", STRING_TYPE, REQUIRED); - add("log_prefix", STRING_TYPE, OPTIONAL); - add("websocketpp_debug_access", BOOL_TYPE, OPTIONAL, false); - add("websocketpp_debug_error", BOOL_TYPE, OPTIONAL, false); - add("data_debug", BOOL_TYPE, OPTIONAL, false); - add("auth_type", STRING_TYPE, OPTIONAL, "basic"); - add("username", STRING_TYPE, OPTIONAL); - add("password", STRING_TYPE, OPTIONAL | SECRET); - add("password_file", STRING_TYPE, OPTIONAL); - add("proxy_url", STRING_TYPE, OPTIONAL); - add("proxy_username", STRING_TYPE, OPTIONAL); - add("proxy_password", STRING_TYPE, OPTIONAL | SECRET); - add("proxy_timeout", FLOAT_TYPE, OPTIONAL, 30.0); - add("connect_timeout", FLOAT_TYPE, OPTIONAL, 30.0); - add("ping_interval", FLOAT_TYPE, OPTIONAL, 30.0); - add("ping_timeout", FLOAT_TYPE, OPTIONAL, 30.0); - add("close_timeout", FLOAT_TYPE, OPTIONAL, 10.0); - add("reconnect_timeout", FLOAT_TYPE, OPTIONAL, 5.0); - - addValidator(validateAuthentication); - addNormalizer(normalizeAuthentication); - } - - static void validateAuthentication(const ConfigKit::Store &config, vector &errors) { - typedef ConfigKit::Error Error; - - // url is required, but Core::Schema overrides it to be optional. - if (config["url"].isNull() || config["auth_type"].asString() == "none") { - return; - } - - if (config["auth_type"].asString() != "basic") { - errors.push_back(Error("Unsupported '{{auth_type}}' value" - " (only 'none' and 'basic' are supported)")); - } - - if (config["auth_type"].asString() == "basic") { - if (config["username"].isNull()) { - errors.push_back(Error( - "When '{{auth_type}}' is set to 'basic', '{{username}}' must also be set")); - } - - if (config["password"].isNull() && config["password_file"].isNull()) { - errors.push_back(Error( - "When '{{auth_type}}' is set to 'basic'," - " then either '{{password}}' or '{{password_file}}' must also be set")); - } else if (!config["password"].isNull() && !config["password_file"].isNull()) { - errors.push_back(Error( - "Only one of '{{password}}' or '{{password_file}}' may be set, but not both")); - } - } - } - - static Json::Value normalizeAuthentication(const Json::Value &effectiveValues) { - Json::Value updates; - if (!effectiveValues["password_file"].isNull()) { - updates["password_file"] = absolutizePath( - effectiveValues["password_file"].asString()); - } - return updates; - } - - public: - Schema() { - initialize(); - finalize(); - } - - Schema(bool _subclassing) { - initialize(); - } - }; - - struct ConfigRealization { - string logPrefix; - bool dataDebug; - - ConfigRealization(const ConfigKit::Store &config) - : logPrefix(config["log_prefix"].asString()), - dataDebug(config["data_debug"].asBool()) - { } - - void swap(ConfigRealization &other) BOOST_NOEXCEPT_OR_NOTHROW { - logPrefix.swap(other.logPrefix); - std::swap(dataDebug, other.dataDebug); - } - }; - - struct ConfigChangeRequest { - boost::scoped_ptr config; - boost::scoped_ptr configRlz; - }; - - typedef websocketpp::client Endpoint; - typedef Endpoint::connection_ptr ConnectionPtr; - typedef Endpoint::message_ptr MessagePtr; - typedef websocketpp::connection_hdl ConnectionWeakPtr; - - typedef boost::function Callback; - typedef boost::function InspectCallback; - typedef boost::function MessageHandler; - - enum State { - UNINITIALIZED, - NOT_CONNECTED, - CONNECTING, - WAITING_FOR_REQUEST, - REPLYING, - CLOSING, - SHUT_DOWN - }; - -private: - ConfigKit::Store config; - ConfigRealization configRlz; - - Endpoint endpoint; - ConnectionPtr conn; - boost::shared_ptr timer; - MessageHandler messageHandler; - Callback shutdownCallback; - mutable boost::mutex stateSyncher; - State state; - deque buffer; - bool reconnectAfterReply; - bool shuttingDown; - - unsigned int secondsToMilis(double seconds) { - return (unsigned int) (seconds * 1000.0); - } - - /** - * It could happen that a certain method or handler is invoked - * for a connection that has already been closed. For example, - * after the message handler was invoked and before the message - * handler called doneReplying(), it could happen that the connection - * was reset. This method allows detecting those cases so that - * the code can decide not to do anything. - */ - bool isCurrentConnection(const ConnectionPtr &c) { - return conn && c.get() == conn.get(); - } - - bool isCurrentConnection(const ConnectionWeakPtr &wconn) { - return conn && endpoint.get_con_from_hdl(wconn).get() == conn.get(); - } - - static bool connectionIsConnected(const ConnectionPtr &c) { - websocketpp::session::state::value state = c->get_state(); - return state == websocketpp::session::state::connecting - || state == websocketpp::session::state::open; - } - - bool isConnected(const ConnectionPtr &c) { - return isCurrentConnection(c) && connectionIsConnected(c); - } - - bool isConnected(const ConnectionWeakPtr &wconn) { - if (OXT_UNLIKELY(!conn)) { - return false; - } - - ConnectionPtr c = endpoint.get_con_from_hdl(wconn); - if (OXT_UNLIKELY(c.get() != conn.get())) { - return false; - } - - return connectionIsConnected(c); - } - - const string &getLogPrefix() const { - return configRlz.logPrefix; - } - - void activateConfigUpdates(const ConfigKit::Store *oldConfig) { - if (config["websocketpp_debug_access"].asBool()) { - endpoint.set_access_channels(websocketpp::log::alevel::all); - } else { - endpoint.clear_access_channels(websocketpp::log::alevel::all); - } - if (config["websocketpp_debug_error"].asBool()) { - endpoint.set_error_channels(websocketpp::log::elevel::all); - } else { - endpoint.clear_error_channels(websocketpp::log::elevel::all); - } - - if (oldConfig == NULL) { - return; - } - bool shouldReconnect = - oldConfig->get("url").asString() != config["url"].asString() || - oldConfig->get("proxy_url").asString() != config["proxy_url"].asString() || - oldConfig->get("data_debug").asBool() != config["data_debug"].asBool() || - oldConfig->get("websocketpp_debug_access").asBool() != config["websocketpp_debug_access"].asBool() || - oldConfig->get("websocketpp_debug_error").asBool() != config["websocketpp_debug_error"].asBool(); - if (shouldReconnect) { - internalReconnect(); - } - } - - void internalInspectState(const InspectCallback callback) { - Json::Value doc(Json::objectValue); - doc["state"] = getStateString(); - doc["buffer"]["message_count"] = (Json::UInt) buffer.size(); - if (reconnectAfterReply) { - doc["reconnect_planned"] = true; - } - if (shuttingDown) { - doc["shutting_down"] = true; - } - callback(doc); - } - - string getStateString() const { - boost::lock_guard l(stateSyncher); - switch (state) { - case UNINITIALIZED: - return "UNINITIALIZED"; - case NOT_CONNECTED: - return "NOT_CONNECTED"; - case CONNECTING: - return "CONNECTING"; - case WAITING_FOR_REQUEST: - return "WAITING_FOR_REQUEST"; - case REPLYING: - return "REPLYING"; - case CLOSING: - return "CLOSING"; - case SHUT_DOWN: - return "SHUT_DOWN"; - default: - return "UNKNOWN"; - }; - } - - void internalShutdown(const Callback callback) { - shuttingDown = true; - shutdownCallback = callback; - closeConnection(websocketpp::close::status::going_away, - "shutting down"); - } - - void startConnect() { - websocketpp::lib::error_code ec; - - { - boost::lock_guard l(stateSyncher); - state = CONNECTING; - } - - P_NOTICE(getLogPrefix() << "Connecting to " << config["url"].asString()); - conn = endpoint.get_connection(config["url"].asString(), ec); - if (ec) { - P_ERROR(getLogPrefix() << "Error setting up a socket to " - << config["url"].asString() << ": " << ec.message()); - { - boost::lock_guard l(stateSyncher); - state = NOT_CONNECTED; - } - scheduleReconnect(); - return; - } - - if (!applyConnectionConfig(conn)) { - // applyConnectionConfig() already logs an error. - { - boost::lock_guard l(stateSyncher); - state = NOT_CONNECTED; - } - scheduleReconnect(); - return; - } - - if (config["auth_type"].asString() == "basic") { - try { - addBasicAuthHeader(conn); - } catch (const std::exception &e) { - P_ERROR(getLogPrefix() << "Error setting up basic authentication: " - << e.what()); - { - boost::lock_guard l(stateSyncher); - state = NOT_CONNECTED; - } - scheduleReconnect(); - return; - } - } - - conn->set_socket_init_handler(websocketpp::lib::bind( - &WebSocketCommandReverseServer::onSocketInit, - this, - websocketpp::lib::placeholders::_1, - websocketpp::lib::placeholders::_2)); - conn->set_open_handler(websocketpp::lib::bind( - &WebSocketCommandReverseServer::onConnected, - this, - websocketpp::lib::placeholders::_1)); - conn->set_fail_handler(websocketpp::lib::bind( - &WebSocketCommandReverseServer::onConnectFailed, - this, - websocketpp::lib::placeholders::_1)); - conn->set_close_handler(websocketpp::lib::bind( - &WebSocketCommandReverseServer::onConnectionClosed, - this, - websocketpp::lib::placeholders::_1)); - conn->set_pong_timeout_handler(websocketpp::lib::bind( - &WebSocketCommandReverseServer::onPongTimeout, - this, - websocketpp::lib::placeholders::_1, - websocketpp::lib::placeholders::_2)); - conn->set_pong_handler(websocketpp::lib::bind( - &WebSocketCommandReverseServer::onPong, - this, - websocketpp::lib::placeholders::_1, - websocketpp::lib::placeholders::_2)); - conn->set_message_handler(websocketpp::lib::bind( - &WebSocketCommandReverseServer::onMessage, - this, - websocketpp::lib::placeholders::_1, - websocketpp::lib::placeholders::_2)); - - endpoint.connect(conn); - } - - void addBasicAuthHeader(ConnectionPtr &conn) { - string username = config["username"].asString(); - string password; - if (config["password_file"].isNull()) { - password = config["password"].asString(); - } else { - password = strip(unsafeReadFile(config["password_file"].asString())); - } - string data = modp::b64_encode(username + ":" + password); - conn->append_header("Authorization", "Basic " + data); - } - - bool applyConnectionConfig(ConnectionPtr &conn) { - websocketpp::lib::error_code ec; - - if (!config["proxy_url"].isNull()) { - conn->set_proxy(config["proxy_url"].asString(), ec); - if (ec) { - P_ERROR(getLogPrefix() - << "Error setting proxy URL to " - << config["proxy_url"].asString() << ": " - << ec.message()); - return false; - } - - if (!config["proxy_username"].isNull() || !config["proxy_password"].isNull()) { - conn->set_proxy_basic_auth(config["proxy_username"].asString(), - config["proxy_password"].asString(), ec); - if (ec) { - P_ERROR(getLogPrefix() - << "Error setting proxy authentication credentials to " - << config["proxy_username"].asString() << "::" - << ec.message()); - return false; - } - } - - conn->set_proxy_timeout(secondsToMilis(config["proxy_timeout"].asDouble()), ec); - if (ec) { - P_ERROR(getLogPrefix() - << "Error setting proxy timeout to " - << config["proxy_timeout"].asDouble() << " seconds: " - << ec.message()); - return false; - } - } - - conn->set_open_handshake_timeout(secondsToMilis(config["connect_timeout"].asDouble())); - conn->set_pong_timeout(secondsToMilis(config["ping_timeout"].asDouble())); - conn->set_close_handshake_timeout(secondsToMilis(config["close_timeout"].asDouble())); - - return true; - } - - void internalReconnect() { - switch (state) { - case NOT_CONNECTED: - // Do nothing. - break; - case CONNECTING: - case WAITING_FOR_REQUEST: - closeConnection(websocketpp::close::status::service_restart, - "reestablishing connection in order to apply configuration updates"); - break; - case REPLYING: - reconnectAfterReply = true; - return; - default: - P_BUG("Unsupported state " + toString(state)); - } - } - - void scheduleReconnect() { - P_NOTICE(getLogPrefix() << "Reestablishing connection in " << - config["reconnect_timeout"].asDouble() << " seconds"); - restartTimer(secondsToMilis(config["reconnect_timeout"].asDouble())); - } - - void closeConnection(websocketpp::close::status::value code, - const string &reason) - { - websocketpp::lib::error_code ec; - - { - boost::lock_guard l(stateSyncher); - state = CLOSING; - } - - P_NOTICE(getLogPrefix() << "Closing connection: " << reason); - reconnectAfterReply = false; - timer->cancel(); - if (conn != NULL) { - conn->close(code, reason, ec); - conn.reset(); - if (ec) { - P_WARN(getLogPrefix() << "Error closing connection: " << ec.message()); - } - } - - { - boost::lock_guard l(stateSyncher); - state = NOT_CONNECTED; - } - if (!shuttingDown) { - scheduleReconnect(); - } - } - - void restartTimer(unsigned int ms) { - timer->expires_from_now(boost::posix_time::milliseconds(ms)); - timer->async_wait(boost::bind( - &WebSocketCommandReverseServer::onTimeout, - this, - boost::placeholders::_1)); - } - - void onSocketInit(ConnectionWeakPtr wconn, boost::asio::ip::tcp::socket &s) { - boost::asio::ip::tcp::no_delay option(true); - s.set_option(option); - } - - void onConnected(ConnectionWeakPtr wconn) { - if (!isConnected(wconn)) { - P_DEBUG(getLogPrefix() << "onConnected: stale connection"); - return; - } - - P_NOTICE(getLogPrefix() << "Connection established"); - { - boost::lock_guard l(stateSyncher); - state = WAITING_FOR_REQUEST; - } - buffer.clear(); - P_DEBUG(getLogPrefix() << "Scheduling next ping in " << - config["ping_interval"].asDouble() << " seconds"); - restartTimer(secondsToMilis(config["ping_interval"].asDouble())); - } - - void onConnectFailed(ConnectionWeakPtr wconn) { - if (!isCurrentConnection(wconn)) { - P_DEBUG(getLogPrefix() << "onConnectFailed: not current connection"); - return; - } - - if (LoggingKit::getLevel() >= LoggingKit::ERROR) { - string message; - if (strcmp(conn->get_ec().category().name(), "websocketpp.processor") == 0 - && conn->get_ec().value() == websocketpp::processor::error::invalid_http_status) - { - if (conn->get_response_code() == websocketpp::http::status_code::unauthorized) { - message = "server authentication error"; - } else { - message = conn->get_ec().message(); - } - } else { - message = conn->get_ec().message(); - } - P_ERROR(getLogPrefix() << "Unable to establish connection: " << message); - } - { - boost::lock_guard l(stateSyncher); - state = NOT_CONNECTED; - } - scheduleReconnect(); - } - - void onConnectionClosed(ConnectionWeakPtr wconn) { - if (!isCurrentConnection(wconn)) { - P_DEBUG(getLogPrefix() << "onConnectionClosed: not current connection"); - return; - } - - P_NOTICE(getLogPrefix() << "Connection closed (server close reason: " << - conn->get_remote_close_code() << ": " << - conn->get_remote_close_reason() << ")"); - { - boost::lock_guard l(stateSyncher); - state = NOT_CONNECTED; - } - reconnectAfterReply = false; - - if (shuttingDown) { - timer->cancel(); - } else { - scheduleReconnect(); - } - } - - void onTimeout(const boost::system::error_code &e) { - if (e.value() == boost::system::errc::operation_canceled) { - P_DEBUG(getLogPrefix() << "onTimeout: operation cancelled"); - return; - } - if (e) { - P_ERROR(getLogPrefix() << "Error in timer: " << e.message()); - return; - } - - websocketpp::lib::error_code ec; - - switch (state) { - case NOT_CONNECTED: - startConnect(); - break; - case WAITING_FOR_REQUEST: - case REPLYING: - P_DEBUG(getLogPrefix() << "Sending ping"); - conn->ping("ping", ec); - if (ec) { - closeConnection(websocketpp::close::status::normal, - "error sending ping"); - } - // After sending the ping, we wait until either - // onPong() or onPongTimeout() is called before - // scheduling the next ping. - break; - default: - P_BUG("Unsupported state " + toString(state)); - break; - } - } - - void onPongTimeout(ConnectionWeakPtr wconn, const string &payload) { - if (!isCurrentConnection(wconn)) { - P_DEBUG(getLogPrefix() << "onPongTimeout: not current connection"); - return; - } - - switch (state) { - case REPLYING: - // Ignore pong timeouts while replying because - // reading is paused while replying. - P_DEBUG(getLogPrefix() << "onPongTimeout: ignoring REPLYING state"); - break; - default: - P_DEBUG(getLogPrefix() << "onPongTimeout: closing connection"); - closeConnection(websocketpp::close::status::normal, - "reconnecting because of pong timeout"); - break; - } - } - - void onPong(ConnectionWeakPtr wconn, const string &payload) { - if (!isConnected(wconn)) { - P_DEBUG(getLogPrefix() << "onPong: stale connection"); - return; - } - - P_DEBUG(getLogPrefix() << "Pong received. Scheduling next ping in " << - config["ping_interval"].asDouble() << " seconds"); - restartTimer(secondsToMilis(config["ping_interval"].asDouble())); - } - - void onMessage(ConnectionWeakPtr wconn, MessagePtr msg) { - if (!isConnected(wconn)) { - P_DEBUG(getLogPrefix() << "onMessage: stale connection"); - return; - } - - switch (state) { - case WAITING_FOR_REQUEST: - P_DEBUG(getLogPrefix() << "onMessage: got frame of " << - msg->get_payload().size() << " bytes"); - WCRS_DEBUG_FRAME(this, "Received message's frame data:", msg->get_payload()); - { - boost::lock_guard l(stateSyncher); - state = REPLYING; - } - if (messageHandler(this, conn, msg)) { - doneReplying(conn); - } else { - // We do not pause the connection here because of what appears - // to be an ASIO bug. - // See class header comments, "About flow control and backpressure". - //conn->pause_reading(); - } - break; - case CLOSING: - // Ignore any incoming messages while closing. - P_DEBUG(getLogPrefix() << "onMessage: ignoring CLOSING state"); - break; - case REPLYING: - // Even if we call conn->pause_reading(), WebSocket++ - // may already have received further messages in its buffer, - // which it will still pass to us. Don't process these - // and just buffer them. - P_DEBUG(getLogPrefix() << "onMessage: got frame of " << - msg->get_payload().size() << " bytes (pushed to buffer -> " - << (buffer.size() + 1) << " entries)"); - WCRS_DEBUG_FRAME(this, "Received message's frame data:", msg->get_payload()); - buffer.push_back(msg); - break; - default: - P_BUG("Unsupported state " + toString(state)); - } - } - -public: - WebSocketCommandReverseServer(const Schema &schema, const MessageHandler &_messageHandler, - const Json::Value &initialConfig, - const ConfigKit::Translator &translator = ConfigKit::DummyTranslator()) - : config(schema, initialConfig, translator), - configRlz(config), - messageHandler(_messageHandler), - state(UNINITIALIZED), - reconnectAfterReply(false), - shuttingDown(false) - { - activateConfigUpdates(NULL); - } - - void initialize() { - endpoint.init_asio(); - state = NOT_CONNECTED; - timer = boost::make_shared( - endpoint.get_io_service()); - startConnect(); - } - - /** - * Enter the server's event loop. This method blocks until - * the server is shut down. - * - * May only be called once, and only after `initialize()` is called. - */ - void run() { - endpoint.run(); - { - boost::lock_guard l(stateSyncher); - state = SHUT_DOWN; - } - if (shutdownCallback) { - shutdownCallback(); - } - } - - - const ConfigKit::Store &getConfig() const { - return config; - } - - boost::asio::io_service &getIoService() { - return endpoint.get_io_service(); - } - - - bool prepareConfigChange(const Json::Value &updates, - vector &errors, ConfigChangeRequest &req) - { - req.config.reset(new ConfigKit::Store(config, updates, errors)); - if (errors.empty()) { - req.configRlz.reset(new ConfigRealization(*req.config)); - } - return errors.empty(); - } - - void commitConfigChange(ConfigChangeRequest &req) BOOST_NOEXCEPT_OR_NOTHROW { - config.swap(*req.config); - configRlz.swap(*req.configRlz); - activateConfigUpdates(req.config.get()); - } - - Json::Value inspectConfig() const { - return config.inspect(); - } - - - void asyncPrepareConfigChange(const Json::Value &updates, - ConfigChangeRequest &req, - const ConfigKit::CallbackTypes::PrepareConfigChange &callback) - { - endpoint.get_io_service().post(boost::bind( - ConfigKit::callPrepareConfigChangeAndCallback, - this, updates, &req, callback)); - } - - void asyncCommitConfigChange(ConfigChangeRequest &req, - const ConfigKit::CallbackTypes::CommitConfigChange &callback) - BOOST_NOEXCEPT_OR_NOTHROW - { - endpoint.get_io_service().post(boost::bind( - ConfigKit::callCommitConfigChangeAndCallback, - this, &req, callback)); - } - - void asyncInspectConfig(const ConfigKit::CallbackTypes::InspectConfig &callback) { - endpoint.get_io_service().post(boost::bind( - ConfigKit::callInspectConfigAndCallback, - this, callback)); - } - - void asyncInspectState(const InspectCallback &callback) { - endpoint.get_io_service().post(boost::bind( - &WebSocketCommandReverseServer::internalInspectState, - this, callback)); - } - - /** - * Prepares this server for shut down. It will finish any replies that - * are in-flight and will close the connection. When finished, it will - * call the given callback (if any) from the thread that invoked - * `run()`. - * - * May only be called when the event loop is running. - * This method is thread-safe and may be called from any thread. - */ - void asyncShutdown(const Callback &callback = Callback()) { - endpoint.get_io_service().post(boost::bind( - &WebSocketCommandReverseServer::internalShutdown, - this, callback)); - } - - - /** - * When the message handler is done sending a reply, it must - * call this method to tell the server that the reply is done. - * - * May only be called when the server is in the REPLYING state. - * May only be called from the event loop's thread. - */ - void doneReplying(const ConnectionPtr &conn) { - begin: - - if (!isConnected(conn)) { - P_DEBUG(getLogPrefix() << "doneReplying: stale connection"); - return; - } - - P_DEBUG(getLogPrefix() << "Done replying"); - P_ASSERT_EQ(state, REPLYING); - - { - boost::lock_guard l(stateSyncher); - state = WAITING_FOR_REQUEST; - } - if (reconnectAfterReply) { - reconnectAfterReply = false; - internalReconnect(); - return; - } - - if (buffer.empty()) { - // We do not resume the connection here because of what appears - // to be an ASIO bug. - // See class header comments, "About flow control and backpressure". - //conn->resume_reading(); - } else { - MessagePtr msg = buffer.front(); - P_DEBUG(getLogPrefix() << "Process next message in buffer (" - << buffer.size() << " entries): " << - msg->get_payload().size() << " bytes"); - WCRS_DEBUG_FRAME(this, "Buffered message's frame data:", msg->get_payload()); - buffer.pop_front(); - { - boost::lock_guard l(stateSyncher); - state = REPLYING; - } - if (messageHandler(this, conn, msg)) { - goto begin; - } - } - } - - - const string &_getLogPrefix() const { - return getLogPrefix(); - } - - LoggingKit::Level _getDataDebugLevel() const { - if (OXT_UNLIKELY(configRlz.dataDebug)) { - return LoggingKit::NOTICE; - } else { - return LoggingKit::DEBUG2; - } - } -}; - - -} // namespace Passenger - -#endif /* _PASSENGER_WEB_SOCKET_COMMAND_REVERSE_SERVER_H_ */ diff --git a/src/cxx_supportlib/vendor-modified/boost/asio.hpp b/src/cxx_supportlib/vendor-modified/boost/asio.hpp index 947f0d8bab..f8f9eb5a5a 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio.hpp @@ -71,6 +71,7 @@ #include #include #include +#include #include #include #include @@ -81,6 +82,7 @@ #include #include #include +#include #include #include #include @@ -109,8 +111,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/async_result.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/async_result.hpp index 894a94d231..9e1f4d729a 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/async_result.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/async_result.hpp @@ -818,21 +818,21 @@ struct is_async_operation : template BOOST_ASIO_CONCEPT async_operation = is_async_operation::value; -#define BOOST_ASIO_ASYNC_OPERATION(t) \ - ::boost::asio::async_operation -#define BOOST_ASIO_ASYNC_OPERATION1(t, a0) \ - ::boost::asio::async_operation -#define BOOST_ASIO_ASYNC_OPERATION2(t, a0, a1) \ - ::boost::asio::async_operation -#define BOOST_ASIO_ASYNC_OPERATION3(t, a0, a1, a2) \ - ::boost::asio::async_operation +#define BOOST_ASIO_ASYNC_OPERATION \ + ::boost::asio::async_operation +#define BOOST_ASIO_ASYNC_OPERATION1(a0) \ + ::boost::asio::async_operation +#define BOOST_ASIO_ASYNC_OPERATION2(a0, a1) \ + ::boost::asio::async_operation +#define BOOST_ASIO_ASYNC_OPERATION3(a0, a1, a2) \ + ::boost::asio::async_operation #else // defined(BOOST_ASIO_HAS_CONCEPTS) -#define BOOST_ASIO_ASYNC_OPERATION(t) typename -#define BOOST_ASIO_ASYNC_OPERATION1(t, a0) typename -#define BOOST_ASIO_ASYNC_OPERATION2(t, a0, a1) typename -#define BOOST_ASIO_ASYNC_OPERATION3(t, a0, a1, a2) typename +#define BOOST_ASIO_ASYNC_OPERATION typename +#define BOOST_ASIO_ASYNC_OPERATION1(a0) typename +#define BOOST_ASIO_ASYNC_OPERATION2(a0, a1) typename +#define BOOST_ASIO_ASYNC_OPERATION3(a0, a1, a2) typename #endif // defined(BOOST_ASIO_HAS_CONCEPTS) diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/basic_datagram_socket.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/basic_datagram_socket.hpp index 88738d939c..9421007e38 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/basic_datagram_socket.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/basic_datagram_socket.hpp @@ -346,7 +346,7 @@ class basic_datagram_socket * call will block until the data has been sent successfully or an error * occurs. * - * @param buffers One ore more data buffers to be sent on the socket. + * @param buffers One or more data buffers to be sent on the socket. * * @returns The number of bytes sent. * @@ -378,7 +378,7 @@ class basic_datagram_socket * call will block until the data has been sent successfully or an error * occurs. * - * @param buffers One ore more data buffers to be sent on the socket. + * @param buffers One or more data buffers to be sent on the socket. * * @param flags Flags specifying how the send call is to be made. * diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/basic_deadline_timer.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/basic_deadline_timer.hpp index 742d6cb8fa..1e4b3dfea0 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/basic_deadline_timer.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/basic_deadline_timer.hpp @@ -17,6 +17,8 @@ #include +#if !defined(BOOST_ASIO_NO_DEPRECATED) + #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ || defined(GENERATING_DOCUMENTATION) @@ -36,7 +38,8 @@ namespace boost { namespace asio { -/// Provides waitable timer functionality. +/// (Deprecated: Use basic_waitable_timer.) Provides waitable timer +/// functionality. /** * The basic_deadline_timer class template provides the ability to perform a * blocking or asynchronous wait for a timer to expire. @@ -709,4 +712,6 @@ class basic_deadline_timer #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // || defined(GENERATING_DOCUMENTATION) +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + #endif // BOOST_ASIO_BASIC_DEADLINE_TIMER_HPP diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/basic_io_object.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/basic_io_object.hpp index 46b547c98a..48740c4788 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/basic_io_object.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/basic_io_object.hpp @@ -16,6 +16,10 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include + +#if !defined(BOOST_ASIO_NO_DEPRECATED) \ + || defined(GENERATING_DOCUMENTATION) + #include #include @@ -46,7 +50,7 @@ namespace detail }; } -/// Base class for all I/O objects. +/// (Deprecated) Base class for all I/O objects. /** * @note All I/O objects are non-copyable. However, when using C++0x, certain * I/O objects do support move construction and move assignment. @@ -66,9 +70,7 @@ class basic_io_object /// The underlying implementation type of I/O object. typedef typename service_type::implementation_type implementation_type; -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. + /// Get the io_context associated with the object. /** * This function may be used to obtain the io_context object that the I/O * object uses to dispatch handlers for asynchronous operations. @@ -81,8 +83,7 @@ class basic_io_object return service_.get_io_context(); } - /// (Deprecated: Use get_executor().) Get the io_context associated with the - /// object. + /// Get the io_context associated with the object. /** * This function may be used to obtain the io_context object that the I/O * object uses to dispatch handlers for asynchronous operations. @@ -94,7 +95,6 @@ class basic_io_object { return service_.get_io_context(); } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// The type of the executor associated with the object. typedef boost::asio::io_context::executor_type executor_type; @@ -197,7 +197,6 @@ class basic_io_object typedef IoObjectService service_type; typedef typename service_type::implementation_type implementation_type; -#if !defined(BOOST_ASIO_NO_DEPRECATED) boost::asio::io_context& get_io_context() { return service_->get_io_context(); @@ -207,7 +206,6 @@ class basic_io_object { return service_->get_io_context(); } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) typedef boost::asio::io_context::executor_type executor_type; @@ -285,4 +283,7 @@ class basic_io_object #include +#endif // !defined(BOOST_ASIO_NO_DEPRECATED) + // || defined(GENERATING_DOCUMENTATION) + #endif // BOOST_ASIO_BASIC_IO_OBJECT_HPP diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/basic_raw_socket.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/basic_raw_socket.hpp index 97dfd95f4b..f8d744b85c 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/basic_raw_socket.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/basic_raw_socket.hpp @@ -340,7 +340,7 @@ class basic_raw_socket * This function is used to send data on the raw socket. The function call * will block until the data has been sent successfully or an error occurs. * - * @param buffers One ore more data buffers to be sent on the socket. + * @param buffers One or more data buffers to be sent on the socket. * * @returns The number of bytes sent. * @@ -371,7 +371,7 @@ class basic_raw_socket * This function is used to send data on the raw socket. The function call * will block until the data has been sent successfully or an error occurs. * - * @param buffers One ore more data buffers to be sent on the socket. + * @param buffers One or more data buffers to be sent on the socket. * * @param flags Flags specifying how the send call is to be made. * diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_iostream.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_iostream.hpp index 9da33ea64d..16db727822 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_iostream.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_iostream.hpp @@ -65,16 +65,8 @@ class socket_iostream_base // Forward declaration with defaulted arguments. template > -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typename Clock = chrono::steady_clock, typename WaitTraits = wait_traits> -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) class basic_socket_iostream; #endif // !defined(BOOST_ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL) @@ -92,16 +84,7 @@ class basic_socket_iostream public std::basic_iostream { private: - // These typedefs are intended keep this class's implementation independent - // of whether it's using Boost.DateClock, Boost.Chrono or std::chrono. -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - typedef WaitTraits traits_helper; -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typedef detail::chrono_time_traits traits_helper; -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) public: /// The protocol type. @@ -114,22 +97,12 @@ class basic_socket_iostream typedef Clock clock_type; #if defined(GENERATING_DOCUMENTATION) - /// (Deprecated: Use time_point.) The time type. - typedef typename WaitTraits::time_type time_type; - /// The time type. typedef typename WaitTraits::time_point time_point; - /// (Deprecated: Use duration.) The duration type. - typedef typename WaitTraits::duration_type duration_type; - /// The duration type. typedef typename WaitTraits::duration duration; #else -# if !defined(BOOST_ASIO_NO_DEPRECATED) - typedef typename traits_helper::time_type time_type; - typedef typename traits_helper::duration_type duration_type; -# endif // !defined(BOOST_ASIO_NO_DEPRECATED) typedef typename traits_helper::time_type time_point; typedef typename traits_helper::duration_type duration; #endif @@ -241,18 +214,6 @@ class basic_socket_iostream return rdbuf()->error(); } -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use expiry().) Get the stream's expiry time as an absolute - /// time. - /** - * @return An absolute time value representing the stream's expiry time. - */ - time_point expires_at() const - { - return rdbuf()->expires_at(); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - /// Get the stream's expiry time as an absolute time. /** * @return An absolute time value representing the stream's expiry time. @@ -290,32 +251,6 @@ class basic_socket_iostream rdbuf()->expires_after(expiry_time); } -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use expiry().) Get the stream's expiry time relative to now. - /** - * @return A relative time value representing the stream's expiry time. - */ - duration expires_from_now() const - { - return rdbuf()->expires_from_now(); - } - - /// (Deprecated: Use expires_after().) Set the stream's expiry time relative - /// to now. - /** - * This function sets the expiry time associated with the stream. Stream - * operations performed after this time (where the operations cannot be - * completed using the internal buffers) will fail with the error - * boost::asio::error::operation_aborted. - * - * @param expiry_time The expiry time to be used for the timer. - */ - void expires_from_now(const duration& expiry_time) - { - rdbuf()->expires_from_now(expiry_time); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - private: // Disallow copying and assignment. basic_socket_iostream(const basic_socket_iostream&) = delete; diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_streambuf.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_streambuf.hpp index 6e1baa8ca0..5099a05652 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_streambuf.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_streambuf.hpp @@ -27,15 +27,7 @@ #include #include #include - -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) -# include -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) -# include -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) +#include #include @@ -82,16 +74,8 @@ class socket_streambuf_buffers // Forward declaration with defaulted arguments. template > -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typename Clock = chrono::steady_clock, typename WaitTraits = wait_traits> -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) class basic_socket_streambuf; #endif // !defined(BOOST_ASIO_BASIC_SOCKET_STREAMBUF_FWD_DECL) @@ -108,23 +92,10 @@ class basic_socket_streambuf : public std::streambuf, private detail::socket_streambuf_io_context, private detail::socket_streambuf_buffers, -#if defined(BOOST_ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION) private basic_socket -#else // defined(BOOST_ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION) - public basic_socket -#endif // defined(BOOST_ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION) { private: - // These typedefs are intended keep this class's implementation independent - // of whether it's using Boost.DateClock, Boost.Chrono or std::chrono. -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - typedef WaitTraits traits_helper; -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typedef detail::chrono_time_traits traits_helper; -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) public: /// The protocol type. @@ -137,22 +108,12 @@ class basic_socket_streambuf typedef Clock clock_type; #if defined(GENERATING_DOCUMENTATION) - /// (Deprecated: Use time_point.) The time type. - typedef typename WaitTraits::time_type time_type; - /// The time type. typedef typename WaitTraits::time_point time_point; - /// (Deprecated: Use duration.) The duration type. - typedef typename WaitTraits::duration_type duration_type; - /// The duration type. typedef typename WaitTraits::duration duration; #else -# if !defined(BOOST_ASIO_NO_DEPRECATED) - typedef typename traits_helper::time_type time_type; - typedef typename traits_helper::duration_type duration_type; -# endif // !defined(BOOST_ASIO_NO_DEPRECATED) typedef typename traits_helper::time_type time_point; typedef typename traits_helper::duration_type duration; #endif @@ -281,30 +242,6 @@ class basic_socket_streambuf return ec_; } -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use error().) Get the last error associated with the stream - /// buffer. - /** - * @return An \c error_code corresponding to the last error from the stream - * buffer. - */ - const boost::system::error_code& puberror() const - { - return error(); - } - - /// (Deprecated: Use expiry().) Get the stream buffer's expiry time as an - /// absolute time. - /** - * @return An absolute time value representing the stream buffer's expiry - * time. - */ - time_point expires_at() const - { - return expiry_time_; - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - /// Get the stream buffer's expiry time as an absolute time. /** * @return An absolute time value representing the stream buffer's expiry @@ -343,33 +280,6 @@ class basic_socket_streambuf expiry_time_ = traits_helper::add(traits_helper::now(), expiry_time); } -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use expiry().) Get the stream buffer's expiry time relative - /// to now. - /** - * @return A relative time value representing the stream buffer's expiry time. - */ - duration expires_from_now() const - { - return traits_helper::subtract(expires_at(), traits_helper::now()); - } - - /// (Deprecated: Use expires_after().) Set the stream buffer's expiry time - /// relative to now. - /** - * This function sets the expiry time associated with the stream. Stream - * operations performed after this time (where the operations cannot be - * completed using the internal buffers) will fail with the error - * boost::asio::error::operation_aborted. - * - * @param expiry_time The expiry time to be used for the timer. - */ - void expires_from_now(const duration& expiry_time) - { - expiry_time_ = traits_helper::add(traits_helper::now(), expiry_time); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - protected: int_type underflow() { @@ -619,14 +529,7 @@ class basic_socket_streambuf // Helper function to get the maximum expiry time. static time_point max_expiry_time() { -#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ - && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) - return boost::posix_time::pos_infin; -#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) return (time_point::max)(); -#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) - // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) } enum { putback_max = 8 }; diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/basic_streambuf.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/basic_streambuf.hpp index b0a355c874..b6084040fb 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/basic_streambuf.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/basic_streambuf.hpp @@ -120,8 +120,8 @@ class basic_streambuf /// The type used to represent the output sequence as a list of buffers. typedef implementation_defined mutable_buffers_type; #else - typedef BOOST_ASIO_CONST_BUFFER const_buffers_type; - typedef BOOST_ASIO_MUTABLE_BUFFER mutable_buffers_type; + typedef const_buffer const_buffers_type; + typedef mutable_buffer mutable_buffers_type; #endif /// Construct a basic_streambuf object. diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/basic_waitable_timer.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/basic_waitable_timer.hpp index 484b311862..6aa5daefe0 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/basic_waitable_timer.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/basic_waitable_timer.hpp @@ -412,36 +412,6 @@ class basic_waitable_timer return s; } -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use non-error_code overload.) Cancel any asynchronous - /// operations that are waiting on the timer. - /** - * This function forces the completion of any pending asynchronous wait - * operations against the timer. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * Cancelling the timer does not change the expiry time. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. - * - * @note If the timer has already expired when cancel() is called, then the - * handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t cancel(boost::system::error_code& ec) - { - return impl_.get_service().cancel(impl_.get_implementation(), ec); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - /// Cancels one asynchronous operation that is waiting on the timer. /** * This function forces the completion of one pending asynchronous wait @@ -475,49 +445,6 @@ class basic_waitable_timer return s; } -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use non-error_code overload.) Cancels one asynchronous - /// operation that is waiting on the timer. - /** - * This function forces the completion of one pending asynchronous wait - * operation against the timer. Handlers are cancelled in FIFO order. The - * handler for the cancelled operation will be invoked with the - * boost::asio::error::operation_aborted error code. - * - * Cancelling the timer does not change the expiry time. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. That is, - * either 0 or 1. - * - * @note If the timer has already expired when cancel_one() is called, then - * the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t cancel_one(boost::system::error_code& ec) - { - return impl_.get_service().cancel_one(impl_.get_implementation(), ec); - } - - /// (Deprecated: Use expiry().) Get the timer's expiry time as an absolute - /// time. - /** - * This function may be used to obtain the timer's current expiry time. - * Whether the timer has expired or not does not affect this value. - */ - time_point expires_at() const - { - return impl_.get_service().expires_at(impl_.get_implementation()); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - /// Get the timer's expiry time as an absolute time. /** * This function may be used to obtain the timer's current expiry time. @@ -559,38 +486,6 @@ class basic_waitable_timer return s; } -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use non-error_code overload.) Set the timer's expiry time as - /// an absolute time. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. - * - * @note If the timer has already expired when expires_at() is called, then - * the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_at(const time_point& expiry_time, - boost::system::error_code& ec) - { - return impl_.get_service().expires_at( - impl_.get_implementation(), expiry_time, ec); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - /// Set the timer's expiry time relative to now. /** * This function sets the expiry time. Any pending asynchronous wait @@ -622,80 +517,6 @@ class basic_waitable_timer return s; } -#if !defined(BOOST_ASIO_NO_DEPRECATED) - /// (Deprecated: Use expiry().) Get the timer's expiry time relative to now. - /** - * This function may be used to obtain the timer's current expiry time. - * Whether the timer has expired or not does not affect this value. - */ - duration expires_from_now() const - { - return impl_.get_service().expires_from_now(impl_.get_implementation()); - } - - /// (Deprecated: Use expires_after().) Set the timer's expiry time relative - /// to now. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @return The number of asynchronous operations that were cancelled. - * - * @throws boost::system::system_error Thrown on failure. - * - * @note If the timer has already expired when expires_from_now() is called, - * then the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_from_now(const duration& expiry_time) - { - boost::system::error_code ec; - std::size_t s = impl_.get_service().expires_from_now( - impl_.get_implementation(), expiry_time, ec); - boost::asio::detail::throw_error(ec, "expires_from_now"); - return s; - } - - /// (Deprecated: Use expires_after().) Set the timer's expiry time relative - /// to now. - /** - * This function sets the expiry time. Any pending asynchronous wait - * operations will be cancelled. The handler for each cancelled operation will - * be invoked with the boost::asio::error::operation_aborted error code. - * - * @param expiry_time The expiry time to be used for the timer. - * - * @param ec Set to indicate what error occurred, if any. - * - * @return The number of asynchronous operations that were cancelled. - * - * @note If the timer has already expired when expires_from_now() is called, - * then the handlers for asynchronous wait operations will: - * - * @li have already been invoked; or - * - * @li have been queued for invocation in the near future. - * - * These handlers can no longer be cancelled, and therefore are passed an - * error code that indicates the successful completion of the wait operation. - */ - std::size_t expires_from_now(const duration& expiry_time, - boost::system::error_code& ec) - { - return impl_.get_service().expires_from_now( - impl_.get_implementation(), expiry_time, ec); - } -#endif // !defined(BOOST_ASIO_NO_DEPRECATED) - /// Perform a blocking wait on the timer. /** * This function is used to wait for the timer to expire. This function diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/bind_allocator.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/bind_allocator.hpp index ac7faaf8c6..33c2da3892 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/bind_allocator.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/bind_allocator.hpp @@ -346,14 +346,21 @@ class allocator_binder /// Forwarding function call operator. template - result_of_t operator()(Args&&... args) + result_of_t operator()(Args&&... args) & { return target_(static_cast(args)...); } /// Forwarding function call operator. template - result_of_t operator()(Args&&... args) const + result_of_t operator()(Args&&... args) && + { + return static_cast(target_)(static_cast(args)...); + } + + /// Forwarding function call operator. + template + result_of_t operator()(Args&&... args) const& { return target_(static_cast(args)...); } diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/bind_cancellation_slot.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/bind_cancellation_slot.hpp index 38e8571fbe..3d7c8b09e4 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/bind_cancellation_slot.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/bind_cancellation_slot.hpp @@ -352,14 +352,21 @@ class cancellation_slot_binder /// Forwarding function call operator. template - result_of_t operator()(Args&&... args) + result_of_t operator()(Args&&... args) & { return target_(static_cast(args)...); } /// Forwarding function call operator. template - result_of_t operator()(Args&&... args) const + result_of_t operator()(Args&&... args) && + { + return static_cast(target_)(static_cast(args)...); + } + + /// Forwarding function call operator. + template + result_of_t operator()(Args&&... args) const& { return target_(static_cast(args)...); } diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/bind_executor.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/bind_executor.hpp index 818b32e4b0..f55b059f4d 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/bind_executor.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/bind_executor.hpp @@ -379,14 +379,21 @@ class executor_binder /// Forwarding function call operator. template - result_of_t operator()(Args&&... args) + result_of_t operator()(Args&&... args) & { return this->target_(static_cast(args)...); } /// Forwarding function call operator. template - result_of_t operator()(Args&&... args) const + result_of_t operator()(Args&&... args) && + { + return static_cast(this->target_)(static_cast(args)...); + } + + /// Forwarding function call operator. + template + result_of_t operator()(Args&&... args) const& { return this->target_(static_cast(args)...); } diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/bind_immediate_executor.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/bind_immediate_executor.hpp index fbf8c47325..e283669431 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/bind_immediate_executor.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/bind_immediate_executor.hpp @@ -351,14 +351,21 @@ class immediate_executor_binder /// Forwarding function call operator. template - result_of_t operator()(Args&&... args) + result_of_t operator()(Args&&... args) & { return target_(static_cast(args)...); } /// Forwarding function call operator. template - result_of_t operator()(Args&&... args) const + result_of_t operator()(Args&&... args) && + { + return static_cast(target_)(static_cast(args)...); + } + + /// Forwarding function call operator. + template + result_of_t operator()(Args&&... args) const& { return target_(static_cast(args)...); } diff --git a/src/cxx_supportlib/vendor-modified/boost/asio/buffer.hpp b/src/cxx_supportlib/vendor-modified/boost/asio/buffer.hpp index c82507c67a..dc63ce3384 100644 --- a/src/cxx_supportlib/vendor-modified/boost/asio/buffer.hpp +++ b/src/cxx_supportlib/vendor-modified/boost/asio/buffer.hpp @@ -53,6 +53,43 @@ namespace boost { namespace asio { +namespace detail { + +#if defined(BOOST_ASIO_MSVC) + +struct span_memfns_base +{ + void subspan(); +}; + +template +struct span_memfns_derived : T, span_memfns_base +{ +}; + +template +struct span_memfns_check +{ +}; + +template +char (&subspan_memfn_helper(...))[2]; + +template +char subspan_memfn_helper( + span_memfns_check< + void (span_memfns_base::*)(), + &span_memfns_derived::subspan>*); + +template +struct has_subspan_memfn : + integral_constant(0)) != 1> +{ +}; + +#endif // defined(BOOST_ASIO_MSVC) + +} // namespace detail class mutable_buffer; class const_buffer; @@ -93,6 +130,34 @@ class mutable_buffer { } + /// Construct a buffer from a span of bytes. + template