passenger 5.0.21 → 5.0.22
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/CHANGELOG +38 -2
- data/CONTRIBUTORS +3 -0
- data/README.md +5 -1
- data/bin/passenger-status +2 -7
- data/build/agent.rb +2 -0
- data/build/cxx_dependency_map.rb +1464 -162
- data/build/node_tests.rb +1 -1
- data/build/packaging.rb +1 -1
- data/dev/ci/run_travis.sh +1 -1
- data/dev/vagrant/provision.sh +1 -1
- data/npm-shrinkwrap.json +635 -125
- data/package.json +1 -1
- data/resources/templates/standalone/config.erb +33 -161
- data/resources/templates/standalone/global.erb +15 -0
- data/resources/templates/standalone/http.erb +40 -0
- data/resources/templates/standalone/mass_deployment_default_server.erb +11 -0
- data/resources/templates/standalone/rails_asset_pipeline.erb +22 -0
- data/resources/templates/standalone/server.erb +58 -0
- data/src/agent/Core/ApiServer.h +37 -32
- data/src/agent/Core/ApplicationPool/BasicGroupInfo.h +1 -1
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +6 -0
- data/src/agent/Core/ApplicationPool/Common.h +1 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +4 -0
- data/src/agent/Core/ApplicationPool/Implementation.cpp +2 -2
- data/src/agent/Core/ApplicationPool/Options.h +18 -1
- data/src/agent/Core/ApplicationPool/Pool.h +1 -1
- data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +6 -6
- data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +3 -3
- data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +6 -0
- data/src/agent/Core/ApplicationPool/Process.h +6 -1
- data/src/agent/Core/ApplicationPool/Socket.h +9 -12
- data/src/agent/Core/Controller.h +422 -0
- data/src/agent/Core/{RequestHandler → Controller}/AppResponse.h +2 -0
- data/src/agent/Core/{RequestHandler → Controller}/BufferBody.cpp +27 -5
- data/src/agent/Core/{RequestHandler → Controller}/CheckoutSession.cpp +61 -31
- data/src/agent/Core/{RequestHandler → Controller}/Client.h +5 -2
- data/src/agent/Core/{RequestHandler → Controller}/ForwardResponse.cpp +93 -42
- data/src/agent/Core/{RequestHandler → Controller}/Hooks.cpp +107 -60
- data/src/agent/Core/Controller/Implementation.cpp +38 -0
- data/src/agent/Core/{RequestHandler → Controller}/InitRequest.cpp +134 -80
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +165 -0
- data/src/agent/Core/{RequestHandler/Utils.cpp → Controller/InternalUtils.cpp} +49 -32
- data/src/agent/Core/Controller/Miscellaneous.cpp +116 -0
- data/src/agent/Core/{RequestHandler → Controller}/Request.h +6 -4
- data/src/agent/Core/{RequestHandler → Controller}/SendRequest.cpp +205 -130
- data/src/agent/Core/Controller/StateInspectionAndConfiguration.cpp +161 -0
- data/src/agent/Core/{RequestHandler → Controller}/TurboCaching.h +3 -0
- data/src/agent/Core/CoreMain.cpp +62 -51
- data/src/agent/Core/OptionParser.h +24 -0
- data/src/agent/Core/ResponseCache.h +5 -5
- data/src/agent/Core/SpawningKit/Config.h +2 -2
- data/src/agent/Core/SpawningKit/SmartSpawner.h +1 -1
- data/src/agent/Core/UnionStation/{Core.h → Context.h} +14 -18
- data/src/agent/Core/UnionStation/StopwatchLog.h +3 -2
- data/src/agent/Core/UnionStation/Transaction.h +7 -7
- data/src/agent/Shared/ApiServerUtils.h +9 -1
- data/src/agent/UstRouter/ApiServer.h +5 -2
- data/src/agent/UstRouter/Controller.h +27 -9
- data/src/agent/UstRouter/UstRouterMain.cpp +1 -0
- data/src/agent/Watchdog/ApiServer.h +5 -2
- data/src/apache2_module/ConfigurationCommands.cpp +7 -0
- data/src/apache2_module/ConfigurationFields.hpp +2 -0
- data/src/apache2_module/ConfigurationSetters.cpp +24 -0
- data/src/apache2_module/CreateDirConfig.cpp +1 -0
- data/src/apache2_module/Hooks.cpp +6 -5
- data/src/apache2_module/MergeDirConfig.cpp +7 -0
- data/src/apache2_module/SetHeaders.cpp +5 -0
- data/src/cxx_supportlib/Constants.h +5 -3
- data/src/cxx_supportlib/SafeLibev.h +2 -1
- data/src/cxx_supportlib/UnionStationFilterSupport.h +2 -1
- data/src/cxx_supportlib/Utils/ReleaseableScopedPointer.h +70 -0
- data/src/cxx_supportlib/vendor-modified/boost/libs/regex/src/regex_raw_buffer.cpp +6 -6
- data/src/helper-scripts/node-loader.js +59 -0
- data/src/nginx_module/CacheLocationConfig.c +48 -0
- data/src/nginx_module/ConfigurationCommands.c +20 -0
- data/src/nginx_module/ConfigurationFields.h +4 -0
- data/src/nginx_module/CreateLocationConfig.c +8 -0
- data/src/nginx_module/MergeLocationConfig.c +12 -0
- data/src/nodejs_supportlib/phusion_passenger/log_express.js +106 -0
- data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +203 -0
- data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +227 -0
- data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +446 -0
- data/src/nodejs_supportlib/vendor-copy/codify/codify.js +44 -0
- data/src/nodejs_supportlib/vendor-copy/codify/package.json +29 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/context.js +200 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/glue.js +488 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/index.js +407 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/node_modules/shimmer/index.js +90 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/node_modules/shimmer/package.json +40 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/package.json +54 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/listener.js +160 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/node_modules/shimmer/index.js +90 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/node_modules/shimmer/package.json +40 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/package.json +46 -0
- data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/package.json +56 -0
- data/src/nodejs_supportlib/vendor-copy/network-byte-order/lib/index.js +102 -0
- data/src/nodejs_supportlib/vendor-copy/network-byte-order/package.json +51 -0
- data/src/nodejs_supportlib/vendor-copy/winston/LICENSE +19 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston.js +165 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/common.js +483 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config.js +62 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/cli-config.js +35 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/npm-config.js +27 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/syslog-config.js +31 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/container.js +127 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/exception.js +56 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/logger.js +701 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports.js +34 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/console.js +128 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/daily-rotate-file.js +601 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/file.js +675 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/http.js +232 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/memory.js +89 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/transport.js +135 -0
- data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/webhook.js +146 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/LICENSE +19 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/lib/async.js +1283 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/package.json +66 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/support/sync-package-managers.js +53 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/MIT-LICENSE.txt +23 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/colors.js +176 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/custom/trap.js +45 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/custom/zalgo.js +104 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/extendStringPrototype.js +118 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/index.js +12 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/america.js +12 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/rainbow.js +13 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/random.js +8 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/zebra.js +5 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/styles.js +77 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/system/supports-colors.js +61 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/package.json +35 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/safe.js +9 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/themes/generic-logging.js +12 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/cycle/cycle.js +170 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/cycle/package.json +30 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/LICENSE +20 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/lib/eyes.js +236 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/package.json +42 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/LICENSE.md +11 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/isstream.js +27 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/package.json +42 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/LICENSE +19 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/lib/pkginfo.js +136 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/package.json +56 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/License +19 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/lib/stack-trace.js +111 -0
- data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/package.json +33 -0
- data/src/nodejs_supportlib/vendor-copy/winston/package.json +87 -0
- data/src/ruby_supportlib/phusion_passenger.rb +3 -4
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +19 -2
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +8 -0
- data/src/ruby_supportlib/phusion_passenger/config/list_instances_command.rb +2 -6
- data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +13 -0
- data/src/ruby_supportlib/phusion_passenger/config/restart_app_command.rb +3 -0
- data/src/ruby_supportlib/phusion_passenger/config/utils.rb +9 -7
- data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +8 -1
- data/src/ruby_supportlib/phusion_passenger/constants.rb +3 -1
- data/src/ruby_supportlib/phusion_passenger/native_support.rb +20 -4
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +8 -0
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +11 -4
- data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +647 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +229 -15
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +35 -323
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +36 -12
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +123 -14
- data/src/ruby_supportlib/phusion_passenger/standalone/status_command.rb +32 -17
- data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +32 -21
- data/src/ruby_supportlib/phusion_passenger/standalone/version_command.rb +5 -5
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README.md +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Rakefile +5 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +68 -24
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +9 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +9 -7
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +3 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb +8 -5
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +395 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +10 -7
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +14 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml +4 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.example +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +16 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile.lock +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/README.md +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb +44 -17
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_cache_subscriber.rb +16 -7
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version_data.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/union_station_hooks_rails.gemspec +1 -1
- metadata +99 -16
- metadata.gz.asc +7 -7
- data/resources/oss-binaries.phusionpassenger.com.crt +0 -248
- data/src/agent/Core/RequestHandler.h +0 -471
@@ -35,12 +35,13 @@
|
|
35
35
|
#include <ServerKit/FdSourceChannel.h>
|
36
36
|
#include <Logging.h>
|
37
37
|
#include <Core/ApplicationPool/Pool.h>
|
38
|
-
#include <Core/UnionStation/
|
38
|
+
#include <Core/UnionStation/Context.h>
|
39
39
|
#include <Core/UnionStation/Transaction.h>
|
40
40
|
#include <Core/UnionStation/StopwatchLog.h>
|
41
|
-
#include <Core/
|
41
|
+
#include <Core/Controller/AppResponse.h>
|
42
42
|
|
43
43
|
namespace Passenger {
|
44
|
+
namespace Core {
|
44
45
|
|
45
46
|
using namespace std;
|
46
47
|
using namespace boost;
|
@@ -102,7 +103,7 @@ public:
|
|
102
103
|
// This value is guaranteed to be contiguous.
|
103
104
|
LString *envvars;
|
104
105
|
|
105
|
-
#ifdef
|
106
|
+
#ifdef DEBUG_CC_EVENT_LOOP_BLOCKING
|
106
107
|
bool timedAppPoolGet;
|
107
108
|
ev_tstamp timeBeforeAccessingApplicationPool;
|
108
109
|
ev_tstamp timeOnRequestHeaderSent;
|
@@ -157,10 +158,11 @@ public:
|
|
157
158
|
options.transaction->message(message);
|
158
159
|
}
|
159
160
|
|
160
|
-
DEFINE_SERVER_KIT_BASE_HTTP_REQUEST_FOOTER(Passenger::Request);
|
161
|
+
DEFINE_SERVER_KIT_BASE_HTTP_REQUEST_FOOTER(Passenger::Core::Request);
|
161
162
|
};
|
162
163
|
|
163
164
|
|
165
|
+
} // namespace Core
|
164
166
|
} // namespace Passenger
|
165
167
|
|
166
168
|
#endif /* _PASSENGER_REQUEST_HANDLER_REQUEST_H_ */
|
@@ -23,13 +23,68 @@
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
24
|
* THE SOFTWARE.
|
25
25
|
*/
|
26
|
+
#include <Core/Controller.h>
|
26
27
|
|
27
|
-
//
|
28
|
+
// For calculating delta_monotonic (Ruby < 2.1 workaround, otherwise unused)
|
29
|
+
#include <uv.h>
|
30
|
+
|
31
|
+
/*************************************************************************
|
32
|
+
*
|
33
|
+
* Implements Core::Controller methods pertaining sending request data
|
34
|
+
* to a selected application process. This happens in parallel to forwarding
|
35
|
+
* application response data to the client.
|
36
|
+
*
|
37
|
+
*************************************************************************/
|
38
|
+
|
39
|
+
|
40
|
+
namespace Passenger {
|
41
|
+
namespace Core {
|
42
|
+
|
43
|
+
using namespace std;
|
44
|
+
using namespace boost;
|
45
|
+
|
46
|
+
|
47
|
+
/****************************
|
48
|
+
*
|
49
|
+
* Private methods
|
50
|
+
*
|
51
|
+
****************************/
|
52
|
+
|
53
|
+
|
54
|
+
struct Controller::SessionProtocolWorkingState {
|
55
|
+
StaticString path;
|
56
|
+
StaticString queryString;
|
57
|
+
StaticString methodStr;
|
58
|
+
StaticString serverName;
|
59
|
+
StaticString serverPort;
|
60
|
+
const LString *remoteAddr;
|
61
|
+
const LString *remotePort;
|
62
|
+
const LString *remoteUser;
|
63
|
+
const LString *contentType;
|
64
|
+
const LString *contentLength;
|
65
|
+
char *environmentVariablesData;
|
66
|
+
size_t environmentVariablesSize;
|
67
|
+
bool hasBaseURI;
|
68
|
+
|
69
|
+
SessionProtocolWorkingState()
|
70
|
+
: environmentVariablesData(NULL)
|
71
|
+
{ }
|
72
|
+
|
73
|
+
~SessionProtocolWorkingState() {
|
74
|
+
free(environmentVariablesData);
|
75
|
+
}
|
76
|
+
};
|
77
|
+
|
78
|
+
struct Controller::HttpHeaderConstructionCache {
|
79
|
+
StaticString methodStr;
|
80
|
+
const LString *remoteAddr;
|
81
|
+
const LString *setCookie;
|
82
|
+
bool cached;
|
83
|
+
};
|
28
84
|
|
29
|
-
private:
|
30
85
|
|
31
86
|
void
|
32
|
-
sendHeaderToApp(Client *client, Request *req) {
|
87
|
+
Controller::sendHeaderToApp(Client *client, Request *req) {
|
33
88
|
TRACE_POINT();
|
34
89
|
SKC_TRACE(client, 2, "Sending headers to application with " <<
|
35
90
|
req->session->getProtocol() << " protocol");
|
@@ -79,36 +134,16 @@ sendHeaderToApp(Client *client, Request *req) {
|
|
79
134
|
}
|
80
135
|
}
|
81
136
|
|
82
|
-
struct SessionProtocolWorkingState {
|
83
|
-
StaticString path;
|
84
|
-
StaticString queryString;
|
85
|
-
StaticString methodStr;
|
86
|
-
StaticString serverName;
|
87
|
-
StaticString serverPort;
|
88
|
-
const LString *remoteAddr;
|
89
|
-
const LString *remotePort;
|
90
|
-
const LString *remoteUser;
|
91
|
-
const LString *contentType;
|
92
|
-
const LString *contentLength;
|
93
|
-
char *environmentVariablesData;
|
94
|
-
size_t environmentVariablesSize;
|
95
|
-
bool hasBaseURI;
|
96
|
-
|
97
|
-
SessionProtocolWorkingState()
|
98
|
-
: environmentVariablesData(NULL)
|
99
|
-
{ }
|
100
|
-
|
101
|
-
~SessionProtocolWorkingState() {
|
102
|
-
free(environmentVariablesData);
|
103
|
-
}
|
104
|
-
};
|
105
|
-
|
106
137
|
void
|
107
|
-
sendHeaderToAppWithSessionProtocol(Client *client, Request *req) {
|
138
|
+
Controller::sendHeaderToAppWithSessionProtocol(Client *client, Request *req) {
|
108
139
|
TRACE_POINT();
|
109
140
|
SessionProtocolWorkingState state;
|
141
|
+
|
142
|
+
// Workaround for Ruby < 2.1 support.
|
143
|
+
std::string delta_monotonic = boost::to_string(SystemTime::getUsec() - (uv_hrtime() / 1000));
|
144
|
+
|
110
145
|
unsigned int bufferSize = determineHeaderSizeForSessionProtocol(req,
|
111
|
-
state);
|
146
|
+
state, delta_monotonic);
|
112
147
|
MemoryKit::mbuf_pool &mbuf_pool = getContext()->mbuf_pool;
|
113
148
|
const unsigned int MBUF_MAX_SIZE = mbuf_pool_data_size(&mbuf_pool);
|
114
149
|
bool ok;
|
@@ -118,7 +153,7 @@ sendHeaderToAppWithSessionProtocol(Client *client, Request *req) {
|
|
118
153
|
bufferSize = MBUF_MAX_SIZE;
|
119
154
|
|
120
155
|
ok = constructHeaderForSessionProtocol(req, buffer.start,
|
121
|
-
bufferSize, state);
|
156
|
+
bufferSize, state, delta_monotonic);
|
122
157
|
assert(ok);
|
123
158
|
buffer = MemoryKit::mbuf(buffer, 0, bufferSize);
|
124
159
|
SKC_TRACE(client, 3, "Header data: \"" << cEscapeString(
|
@@ -128,7 +163,7 @@ sendHeaderToAppWithSessionProtocol(Client *client, Request *req) {
|
|
128
163
|
char *buffer = (char *) psg_pnalloc(req->pool, bufferSize);
|
129
164
|
|
130
165
|
ok = constructHeaderForSessionProtocol(req, buffer,
|
131
|
-
bufferSize, state);
|
166
|
+
bufferSize, state, delta_monotonic);
|
132
167
|
assert(ok);
|
133
168
|
SKC_TRACE(client, 3, "Header data: \"" << cEscapeString(
|
134
169
|
StaticString(buffer, bufferSize)) << "\"");
|
@@ -139,15 +174,15 @@ sendHeaderToAppWithSessionProtocol(Client *client, Request *req) {
|
|
139
174
|
(void) ok; // Shut up compiler warning
|
140
175
|
}
|
141
176
|
|
142
|
-
|
143
|
-
sendBodyToAppWhenAppSinkIdle(Channel *_channel, unsigned int size) {
|
177
|
+
void
|
178
|
+
Controller::sendBodyToAppWhenAppSinkIdle(Channel *_channel, unsigned int size) {
|
144
179
|
FdSinkChannel *channel = reinterpret_cast<FdSinkChannel *>(_channel);
|
145
180
|
Request *req = static_cast<Request *>(static_cast<
|
146
181
|
ServerKit::BaseHttpRequest *>(channel->getHooks()->userData));
|
147
182
|
Client *client = static_cast<Client *>(req->client);
|
148
|
-
|
183
|
+
Controller *self = static_cast<Controller *>(
|
149
184
|
getServerFromClient(client));
|
150
|
-
SKC_LOG_EVENT_FROM_STATIC(self,
|
185
|
+
SKC_LOG_EVENT_FROM_STATIC(self, Controller, client, "sendBodyToAppWhenAppSinkIdle");
|
151
186
|
|
152
187
|
channel->setConsumedCallback(NULL);
|
153
188
|
if (channel->acceptingInput()) {
|
@@ -169,9 +204,96 @@ sendBodyToAppWhenAppSinkIdle(Channel *_channel, unsigned int size) {
|
|
169
204
|
}
|
170
205
|
}
|
171
206
|
|
207
|
+
static bool
|
208
|
+
isAlphaNum(char ch) {
|
209
|
+
return (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z');
|
210
|
+
}
|
211
|
+
|
212
|
+
/**
|
213
|
+
* For CGI, alphanum headers with optional dashes are mapped to UPP3R_CAS3. This
|
214
|
+
* function can be used to reject non-alphanum/dash headers that would end up with
|
215
|
+
* the same mapping (e.g. upp3r_cas3 and upp3r-cas3 would end up the same, and
|
216
|
+
* potentially collide each other in the receiving application). This is
|
217
|
+
* used to fix CVE-2015-7519.
|
218
|
+
*/
|
219
|
+
static bool
|
220
|
+
containsNonAlphaNumDash(const LString &s) {
|
221
|
+
const LString::Part *part = s.start;
|
222
|
+
while (part != NULL) {
|
223
|
+
for (unsigned int i = 0; i < part->size; i++) {
|
224
|
+
const char start = part->data[i];
|
225
|
+
if (start != '-' && !isAlphaNum(start)) {
|
226
|
+
return true;
|
227
|
+
}
|
228
|
+
}
|
229
|
+
part = part->next;
|
230
|
+
}
|
231
|
+
return false;
|
232
|
+
}
|
233
|
+
|
234
|
+
static void
|
235
|
+
httpHeaderToScgiUpperCase(unsigned char *data, unsigned int size) {
|
236
|
+
static const boost::uint8_t toUpperMap[256] = {
|
237
|
+
'\0', 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, '\t',
|
238
|
+
'\n', 0x0b, 0x0c, '\r', 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
|
239
|
+
0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
|
240
|
+
0x1e, 0x1f, ' ', '!', '"', '#', '$', '%', '&', '\'',
|
241
|
+
'(', ')', '*', '+', ',', '_', '.', '/', '0', '1',
|
242
|
+
'2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
|
243
|
+
'<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E',
|
244
|
+
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
245
|
+
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
|
246
|
+
'Z', '[', '\\', ']', '^', '_', '`', 'A', 'B', 'C',
|
247
|
+
'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
248
|
+
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
249
|
+
'X', 'Y', 'Z', '{', '|', '}', '~', 0x7f, 0x80, 0x81,
|
250
|
+
0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b,
|
251
|
+
0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95,
|
252
|
+
0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
253
|
+
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
|
254
|
+
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3,
|
255
|
+
0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd,
|
256
|
+
0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
257
|
+
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1,
|
258
|
+
0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb,
|
259
|
+
0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5,
|
260
|
+
0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
261
|
+
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
|
262
|
+
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
263
|
+
};
|
264
|
+
|
265
|
+
const unsigned char *buf = data;
|
266
|
+
const size_t imax = size / 8;
|
267
|
+
const size_t leftover = size % 8;
|
268
|
+
size_t i;
|
269
|
+
|
270
|
+
for (i = 0; i < imax; i++, data += 8) {
|
271
|
+
data[0] = (unsigned char) toUpperMap[data[0]];
|
272
|
+
data[1] = (unsigned char) toUpperMap[data[1]];
|
273
|
+
data[2] = (unsigned char) toUpperMap[data[2]];
|
274
|
+
data[3] = (unsigned char) toUpperMap[data[3]];
|
275
|
+
data[4] = (unsigned char) toUpperMap[data[4]];
|
276
|
+
data[5] = (unsigned char) toUpperMap[data[5]];
|
277
|
+
data[6] = (unsigned char) toUpperMap[data[6]];
|
278
|
+
data[7] = (unsigned char) toUpperMap[data[7]];
|
279
|
+
}
|
280
|
+
|
281
|
+
i = imax * 8;
|
282
|
+
switch (leftover) {
|
283
|
+
case 7: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
284
|
+
case 6: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
285
|
+
case 5: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
286
|
+
case 4: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
287
|
+
case 3: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
288
|
+
case 2: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
289
|
+
case 1: *data++ = (unsigned char) toUpperMap[buf[i]];
|
290
|
+
case 0: break;
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
172
294
|
unsigned int
|
173
|
-
determineHeaderSizeForSessionProtocol(Request *req,
|
174
|
-
SessionProtocolWorkingState &state)
|
295
|
+
Controller::determineHeaderSizeForSessionProtocol(Request *req,
|
296
|
+
SessionProtocolWorkingState &state, string delta_monotonic)
|
175
297
|
{
|
176
298
|
unsigned int dataSize = sizeof(boost::uint32_t);
|
177
299
|
|
@@ -302,6 +424,9 @@ determineHeaderSizeForSessionProtocol(Request *req,
|
|
302
424
|
if (req->options.analytics) {
|
303
425
|
dataSize += sizeof("PASSENGER_TXN_ID");
|
304
426
|
dataSize += req->options.transaction->getTxnId().size() + 1;
|
427
|
+
|
428
|
+
dataSize += sizeof("PASSENGER_DELTA_MONOTONIC");
|
429
|
+
dataSize += delta_monotonic.size() + 1;
|
305
430
|
}
|
306
431
|
|
307
432
|
if (req->upgraded()) {
|
@@ -324,8 +449,8 @@ determineHeaderSizeForSessionProtocol(Request *req,
|
|
324
449
|
}
|
325
450
|
|
326
451
|
bool
|
327
|
-
constructHeaderForSessionProtocol(Request *req, char * restrict buffer,
|
328
|
-
const SessionProtocolWorkingState &state)
|
452
|
+
Controller::constructHeaderForSessionProtocol(Request *req, char * restrict buffer,
|
453
|
+
unsigned int &size, const SessionProtocolWorkingState &state, string delta_monotonic)
|
329
454
|
{
|
330
455
|
char *pos = buffer;
|
331
456
|
const char *end = buffer + size;
|
@@ -418,6 +543,10 @@ constructHeaderForSessionProtocol(Request *req, char * restrict buffer, unsigned
|
|
418
543
|
pos = appendData(pos, end, P_STATIC_STRING_WITH_NULL("PASSENGER_TXN_ID"));
|
419
544
|
pos = appendData(pos, end, req->options.transaction->getTxnId());
|
420
545
|
pos = appendData(pos, end, "", 1);
|
546
|
+
|
547
|
+
pos = appendData(pos, end, P_STATIC_STRING_WITH_NULL("PASSENGER_DELTA_MONOTONIC"));
|
548
|
+
pos = appendData(pos, end, delta_monotonic);
|
549
|
+
pos = appendData(pos, end, "", 1);
|
421
550
|
}
|
422
551
|
|
423
552
|
if (req->upgraded()) {
|
@@ -427,12 +556,18 @@ constructHeaderForSessionProtocol(Request *req, char * restrict buffer, unsigned
|
|
427
556
|
|
428
557
|
ServerKit::HeaderTable::Iterator it(req->headers);
|
429
558
|
while (*it != NULL) {
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
559
|
+
// This header-skipping is not accounted for in determineHeaderSizeForSessionProtocol(), but
|
560
|
+
// since we are only reducing the size it just wastes some mem bytes.
|
561
|
+
if ((
|
562
|
+
(it->header->hash == HTTP_CONTENT_LENGTH.hash()
|
563
|
+
|| it->header->hash == HTTP_CONTENT_TYPE.hash()
|
564
|
+
|| it->header->hash == HTTP_CONNECTION.hash()
|
565
|
+
) && (psg_lstr_cmp(&it->header->key, P_STATIC_STRING("content-type"))
|
566
|
+
|| psg_lstr_cmp(&it->header->key, P_STATIC_STRING("content-length"))
|
567
|
+
|| psg_lstr_cmp(&it->header->key, P_STATIC_STRING("connection"))
|
568
|
+
)
|
569
|
+
) || containsNonAlphaNumDash(it->header->key)
|
570
|
+
)
|
436
571
|
{
|
437
572
|
it.next();
|
438
573
|
continue;
|
@@ -469,74 +604,7 @@ constructHeaderForSessionProtocol(Request *req, char * restrict buffer, unsigned
|
|
469
604
|
}
|
470
605
|
|
471
606
|
void
|
472
|
-
|
473
|
-
static const boost::uint8_t toUpperMap[256] = {
|
474
|
-
'\0', 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, '\t',
|
475
|
-
'\n', 0x0b, 0x0c, '\r', 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
|
476
|
-
0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
|
477
|
-
0x1e, 0x1f, ' ', '!', '"', '#', '$', '%', '&', '\'',
|
478
|
-
'(', ')', '*', '+', ',', '_', '.', '/', '0', '1',
|
479
|
-
'2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
|
480
|
-
'<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E',
|
481
|
-
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
482
|
-
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
|
483
|
-
'Z', '[', '\\', ']', '^', '_', '`', 'A', 'B', 'C',
|
484
|
-
'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
485
|
-
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
486
|
-
'X', 'Y', 'Z', '{', '|', '}', '~', 0x7f, 0x80, 0x81,
|
487
|
-
0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b,
|
488
|
-
0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95,
|
489
|
-
0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
490
|
-
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
|
491
|
-
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3,
|
492
|
-
0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd,
|
493
|
-
0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
494
|
-
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1,
|
495
|
-
0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb,
|
496
|
-
0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5,
|
497
|
-
0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
498
|
-
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
|
499
|
-
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
500
|
-
};
|
501
|
-
|
502
|
-
const unsigned char *buf = data;
|
503
|
-
const size_t imax = size / 8;
|
504
|
-
const size_t leftover = size % 8;
|
505
|
-
size_t i;
|
506
|
-
|
507
|
-
for (i = 0; i < imax; i++, data += 8) {
|
508
|
-
data[0] = (unsigned char) toUpperMap[data[0]];
|
509
|
-
data[1] = (unsigned char) toUpperMap[data[1]];
|
510
|
-
data[2] = (unsigned char) toUpperMap[data[2]];
|
511
|
-
data[3] = (unsigned char) toUpperMap[data[3]];
|
512
|
-
data[4] = (unsigned char) toUpperMap[data[4]];
|
513
|
-
data[5] = (unsigned char) toUpperMap[data[5]];
|
514
|
-
data[6] = (unsigned char) toUpperMap[data[6]];
|
515
|
-
data[7] = (unsigned char) toUpperMap[data[7]];
|
516
|
-
}
|
517
|
-
|
518
|
-
i = imax * 8;
|
519
|
-
switch (leftover) {
|
520
|
-
case 7: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
521
|
-
case 6: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
522
|
-
case 5: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
523
|
-
case 4: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
524
|
-
case 3: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
525
|
-
case 2: *data++ = (unsigned char) toUpperMap[buf[i++]];
|
526
|
-
case 1: *data++ = (unsigned char) toUpperMap[buf[i]];
|
527
|
-
case 0: break;
|
528
|
-
}
|
529
|
-
}
|
530
|
-
|
531
|
-
struct HttpHeaderConstructionCache {
|
532
|
-
StaticString methodStr;
|
533
|
-
const LString *remoteAddr;
|
534
|
-
const LString *setCookie;
|
535
|
-
bool cached;
|
536
|
-
};
|
537
|
-
|
538
|
-
void
|
539
|
-
sendHeaderToAppWithHttpProtocol(Client *client, Request *req) {
|
607
|
+
Controller::sendHeaderToAppWithHttpProtocol(Client *client, Request *req) {
|
540
608
|
ssize_t bytesWritten;
|
541
609
|
HttpHeaderConstructionCache cache;
|
542
610
|
|
@@ -592,7 +660,7 @@ sendHeaderToAppWithHttpProtocol(Client *client, Request *req) {
|
|
592
660
|
* In this case, this method always returns true.
|
593
661
|
*/
|
594
662
|
bool
|
595
|
-
constructHeaderBuffersForHttpProtocol(Request *req, struct iovec *buffers,
|
663
|
+
Controller::constructHeaderBuffersForHttpProtocol(Request *req, struct iovec *buffers,
|
596
664
|
unsigned int maxbuffers, unsigned int & restrict_ref nbuffers,
|
597
665
|
unsigned int & restrict_ref dataSize, HttpHeaderConstructionCache &cache)
|
598
666
|
{
|
@@ -795,7 +863,7 @@ constructHeaderBuffersForHttpProtocol(Request *req, struct iovec *buffers,
|
|
795
863
|
}
|
796
864
|
|
797
865
|
bool
|
798
|
-
sendHeaderToAppWithHttpProtocolAndWritev(Request *req, ssize_t &bytesWritten,
|
866
|
+
Controller::sendHeaderToAppWithHttpProtocolAndWritev(Request *req, ssize_t &bytesWritten,
|
799
867
|
HttpHeaderConstructionCache &cache)
|
800
868
|
{
|
801
869
|
unsigned int maxbuffers = std::min<unsigned int>(
|
@@ -820,8 +888,8 @@ sendHeaderToAppWithHttpProtocolAndWritev(Request *req, ssize_t &bytesWritten,
|
|
820
888
|
}
|
821
889
|
|
822
890
|
void
|
823
|
-
sendHeaderToAppWithHttpProtocolWithBuffering(Request *req,
|
824
|
-
HttpHeaderConstructionCache &cache)
|
891
|
+
Controller::sendHeaderToAppWithHttpProtocolWithBuffering(Request *req,
|
892
|
+
unsigned int offset, HttpHeaderConstructionCache &cache)
|
825
893
|
{
|
826
894
|
struct iovec *buffers;
|
827
895
|
unsigned int nbuffers, dataSize;
|
@@ -854,10 +922,10 @@ sendHeaderToAppWithHttpProtocolWithBuffering(Request *req, unsigned int offset,
|
|
854
922
|
}
|
855
923
|
|
856
924
|
void
|
857
|
-
sendBodyToApp(Client *client, Request *req) {
|
925
|
+
Controller::sendBodyToApp(Client *client, Request *req) {
|
858
926
|
TRACE_POINT();
|
859
927
|
assert(req->appSink.acceptingInput());
|
860
|
-
#ifdef
|
928
|
+
#ifdef DEBUG_CC_EVENT_LOOP_BLOCKING
|
861
929
|
req->timeOnRequestHeaderSent = ev_now(getLoop());
|
862
930
|
reportLargeTimeDiff(client,
|
863
931
|
"ApplicationPool get until headers sent",
|
@@ -881,7 +949,7 @@ sendBodyToApp(Client *client, Request *req) {
|
|
881
949
|
}
|
882
950
|
|
883
951
|
void
|
884
|
-
halfCloseAppSink(Client *client, Request *req) {
|
952
|
+
Controller::halfCloseAppSink(Client *client, Request *req) {
|
885
953
|
P_ASSERT_EQ(req->state, Request::WAITING_FOR_APP_OUTPUT);
|
886
954
|
if (req->halfCloseAppConnection) {
|
887
955
|
SKC_TRACE(client, 3, "Half-closing application socket with SHUT_WR");
|
@@ -889,8 +957,8 @@ halfCloseAppSink(Client *client, Request *req) {
|
|
889
957
|
}
|
890
958
|
}
|
891
959
|
|
892
|
-
Channel::Result
|
893
|
-
whenSendingRequest_onRequestBody(Client *client, Request *req,
|
960
|
+
ServerKit::Channel::Result
|
961
|
+
Controller::whenSendingRequest_onRequestBody(Client *client, Request *req,
|
894
962
|
const MemoryKit::mbuf &buffer, int errcode)
|
895
963
|
{
|
896
964
|
TRACE_POINT();
|
@@ -952,14 +1020,16 @@ whenSendingRequest_onRequestBody(Client *client, Request *req,
|
|
952
1020
|
}
|
953
1021
|
}
|
954
1022
|
|
955
|
-
|
956
|
-
resumeRequestBodyChannelWhenAppSinkIdle(Channel *_channel,
|
1023
|
+
void
|
1024
|
+
Controller::resumeRequestBodyChannelWhenAppSinkIdle(Channel *_channel,
|
1025
|
+
unsigned int size)
|
1026
|
+
{
|
957
1027
|
FdSinkChannel *channel = reinterpret_cast<FdSinkChannel *>(_channel);
|
958
1028
|
Request *req = static_cast<Request *>(static_cast<
|
959
1029
|
ServerKit::BaseHttpRequest *>(channel->getHooks()->userData));
|
960
1030
|
Client *client = static_cast<Client *>(req->client);
|
961
|
-
|
962
|
-
SKC_LOG_EVENT_FROM_STATIC(self,
|
1031
|
+
Controller *self = static_cast<Controller *>(getServerFromClient(client));
|
1032
|
+
SKC_LOG_EVENT_FROM_STATIC(self, Controller, client, "resumeRequestBodyChannelWhenAppSinkIdle");
|
963
1033
|
|
964
1034
|
P_ASSERT_EQ(req->state, Request::FORWARDING_BODY_TO_APP);
|
965
1035
|
req->appSink.setConsumedCallback(NULL);
|
@@ -980,7 +1050,7 @@ resumeRequestBodyChannelWhenAppSinkIdle(Channel *_channel, unsigned int size) {
|
|
980
1050
|
}
|
981
1051
|
|
982
1052
|
void
|
983
|
-
startBodyChannel(Client *client, Request *req) {
|
1053
|
+
Controller::startBodyChannel(Client *client, Request *req) {
|
984
1054
|
if (req->requestBodyBuffering) {
|
985
1055
|
req->bodyBuffer.start();
|
986
1056
|
} else {
|
@@ -989,7 +1059,7 @@ startBodyChannel(Client *client, Request *req) {
|
|
989
1059
|
}
|
990
1060
|
|
991
1061
|
void
|
992
|
-
stopBodyChannel(Client *client, Request *req) {
|
1062
|
+
Controller::stopBodyChannel(Client *client, Request *req) {
|
993
1063
|
if (req->requestBodyBuffering) {
|
994
1064
|
req->bodyBuffer.stop();
|
995
1065
|
} else {
|
@@ -998,12 +1068,17 @@ stopBodyChannel(Client *client, Request *req) {
|
|
998
1068
|
}
|
999
1069
|
|
1000
1070
|
void
|
1001
|
-
logAppSocketWriteError(Client *client, int errcode) {
|
1071
|
+
Controller::logAppSocketWriteError(Client *client, int errcode) {
|
1002
1072
|
if (errcode == EPIPE) {
|
1003
|
-
SKC_INFO(client,
|
1073
|
+
SKC_INFO(client,
|
1074
|
+
"App socket write error: the application closed the socket prematurely"
|
1004
1075
|
" (Broken pipe; errno=" << errcode << ")");
|
1005
1076
|
} else {
|
1006
1077
|
SKC_INFO(client, "App socket write error: " << ServerKit::getErrorDesc(errcode) <<
|
1007
1078
|
" (errno=" << errcode << ")");
|
1008
1079
|
}
|
1009
1080
|
}
|
1081
|
+
|
1082
|
+
|
1083
|
+
} // namespace Core
|
1084
|
+
} // namespace Passenger
|