passenger 5.0.8 → 5.0.9

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.

Files changed (168) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/.editorconfig +20 -0
  5. data/CHANGELOG +21 -0
  6. data/bin/passenger-install-apache2-module +3 -1
  7. data/build/agents.rb +7 -5
  8. data/build/basics.rb +3 -3
  9. data/build/common_library.rb +52 -30
  10. data/build/cxx_tests.rb +20 -13
  11. data/build/misc.rb +5 -5
  12. data/doc/Design and Architecture.html +1 -1
  13. data/doc/Design and Architecture.txt +1 -1
  14. data/doc/Packaging.html +4 -4
  15. data/doc/Packaging.txt.md +4 -4
  16. data/doc/Users guide Apache.html +22 -9
  17. data/doc/Users guide Apache.idmap.txt +4 -2
  18. data/doc/Users guide Apache.txt +2 -0
  19. data/doc/Users guide Nginx.html +22 -9
  20. data/doc/Users guide Nginx.idmap.txt +4 -2
  21. data/doc/Users guide Nginx.txt +2 -0
  22. data/doc/Users guide Standalone.html +14 -9
  23. data/doc/Users guide Standalone.idmap.txt +4 -2
  24. data/doc/users_guide_snippets/installation.txt +10 -6
  25. data/ext/apache2/Hooks.cpp +13 -2
  26. data/ext/common/ApplicationPool2/Pool/Inspection.h +8 -3
  27. data/ext/common/BackgroundEventLoop.cpp +249 -67
  28. data/ext/common/BackgroundEventLoop.h +5 -5
  29. data/ext/common/Constants.h +1 -1
  30. data/ext/common/InstanceDirectory.h +8 -6
  31. data/ext/common/ServerKit/Context.h +8 -2
  32. data/ext/common/ServerKit/FileBufferedChannel.h +262 -226
  33. data/ext/common/ServerKit/HeaderTable.h +28 -3
  34. data/ext/common/ServerKit/HttpHeaderParser.h +37 -13
  35. data/ext/common/ServerKit/HttpServer.h +17 -1
  36. data/ext/common/ServerKit/Implementation.cpp +2 -0
  37. data/ext/common/ServerKit/Server.h +25 -28
  38. data/ext/common/Utils/IOUtils.cpp +11 -0
  39. data/ext/common/Utils/ProcessMetricsCollector.h +4 -0
  40. data/ext/common/Utils/StrIntUtils.cpp +11 -7
  41. data/ext/common/Utils/StrIntUtils.h +1 -1
  42. data/ext/common/Utils/StrIntUtilsNoStrictAliasing.cpp +21 -16
  43. data/ext/common/agents/Base.cpp +6 -0
  44. data/ext/common/agents/Base.h +2 -0
  45. data/ext/common/agents/HelperAgent/AdminServer.h +25 -25
  46. data/ext/common/agents/HelperAgent/Main.cpp +37 -12
  47. data/ext/common/agents/HelperAgent/RequestHandler.h +18 -20
  48. data/ext/common/agents/HelperAgent/RequestHandler/AppResponse.h +4 -0
  49. data/ext/common/agents/HelperAgent/RequestHandler/ForwardResponse.cpp +10 -6
  50. data/ext/common/agents/HelperAgent/RequestHandler/Hooks.cpp +2 -0
  51. data/ext/common/agents/HelperAgent/RequestHandler/InitRequest.cpp +1 -1
  52. data/ext/common/agents/HelperAgent/RequestHandler/SendRequest.cpp +1 -1
  53. data/ext/common/agents/HelperAgent/RequestHandler/Utils.cpp +9 -2
  54. data/ext/common/agents/HelperAgent/ResponseCache.h +11 -11
  55. data/ext/common/agents/LoggingAgent/AdminServer.h +8 -8
  56. data/ext/common/agents/LoggingAgent/Main.cpp +6 -5
  57. data/ext/common/agents/Watchdog/AdminServer.h +13 -13
  58. data/ext/common/agents/Watchdog/Main.cpp +8 -3
  59. data/ext/libuv/.gitignore +72 -0
  60. data/ext/libuv/AUTHORS +199 -0
  61. data/ext/libuv/ChangeLog +2023 -0
  62. data/ext/libuv/LICENSE +46 -0
  63. data/ext/libuv/Makefile.am +336 -0
  64. data/ext/libuv/README.md +197 -0
  65. data/ext/libuv/checksparse.sh +233 -0
  66. data/ext/libuv/common.gypi +210 -0
  67. data/ext/libuv/configure.ac +67 -0
  68. data/ext/libuv/gyp_uv.py +96 -0
  69. data/ext/libuv/include/android-ifaddrs.h +54 -0
  70. data/ext/libuv/include/pthread-fixes.h +72 -0
  71. data/ext/libuv/include/tree.h +768 -0
  72. data/ext/libuv/include/uv-aix.h +32 -0
  73. data/ext/libuv/include/uv-bsd.h +34 -0
  74. data/ext/libuv/include/uv-darwin.h +61 -0
  75. data/ext/libuv/include/uv-errno.h +418 -0
  76. data/ext/libuv/include/uv-linux.h +34 -0
  77. data/ext/libuv/include/uv-sunos.h +44 -0
  78. data/ext/libuv/include/uv-threadpool.h +37 -0
  79. data/ext/libuv/include/uv-unix.h +383 -0
  80. data/ext/libuv/include/uv-version.h +39 -0
  81. data/ext/libuv/include/uv.h +1455 -0
  82. data/ext/libuv/libuv.pc.in +11 -0
  83. data/ext/libuv/m4/.gitignore +4 -0
  84. data/ext/libuv/m4/as_case.m4 +21 -0
  85. data/ext/libuv/m4/libuv-check-flags.m4 +319 -0
  86. data/ext/libuv/src/fs-poll.c +255 -0
  87. data/ext/libuv/src/heap-inl.h +245 -0
  88. data/ext/libuv/src/inet.c +313 -0
  89. data/ext/libuv/src/queue.h +92 -0
  90. data/ext/libuv/src/threadpool.c +303 -0
  91. data/ext/libuv/src/unix/aix.c +1240 -0
  92. data/ext/libuv/src/unix/android-ifaddrs.c +703 -0
  93. data/ext/libuv/src/unix/async.c +284 -0
  94. data/ext/libuv/src/unix/atomic-ops.h +60 -0
  95. data/ext/libuv/src/unix/core.c +985 -0
  96. data/ext/libuv/src/unix/darwin-proctitle.c +206 -0
  97. data/ext/libuv/src/unix/darwin.c +331 -0
  98. data/ext/libuv/src/unix/dl.c +83 -0
  99. data/ext/libuv/src/unix/freebsd.c +435 -0
  100. data/ext/libuv/src/unix/fs.c +1189 -0
  101. data/ext/libuv/src/unix/fsevents.c +899 -0
  102. data/ext/libuv/src/unix/getaddrinfo.c +202 -0
  103. data/ext/libuv/src/unix/getnameinfo.c +120 -0
  104. data/ext/libuv/src/unix/internal.h +314 -0
  105. data/ext/libuv/src/unix/kqueue.c +418 -0
  106. data/ext/libuv/src/unix/linux-core.c +876 -0
  107. data/ext/libuv/src/unix/linux-inotify.c +257 -0
  108. data/ext/libuv/src/unix/linux-syscalls.c +471 -0
  109. data/ext/libuv/src/unix/linux-syscalls.h +158 -0
  110. data/ext/libuv/src/unix/loop-watcher.c +63 -0
  111. data/ext/libuv/src/unix/loop.c +135 -0
  112. data/ext/libuv/src/unix/netbsd.c +368 -0
  113. data/ext/libuv/src/unix/openbsd.c +384 -0
  114. data/ext/libuv/src/unix/pipe.c +288 -0
  115. data/ext/libuv/src/unix/poll.c +113 -0
  116. data/ext/libuv/src/unix/process.c +551 -0
  117. data/ext/libuv/src/unix/proctitle.c +102 -0
  118. data/ext/libuv/src/unix/pthread-fixes.c +103 -0
  119. data/ext/libuv/src/unix/signal.c +465 -0
  120. data/ext/libuv/src/unix/spinlock.h +53 -0
  121. data/ext/libuv/src/unix/stream.c +1598 -0
  122. data/ext/libuv/src/unix/sunos.c +763 -0
  123. data/ext/libuv/src/unix/tcp.c +327 -0
  124. data/ext/libuv/src/unix/thread.c +519 -0
  125. data/ext/libuv/src/unix/timer.c +172 -0
  126. data/ext/libuv/src/unix/tty.c +265 -0
  127. data/ext/libuv/src/unix/udp.c +833 -0
  128. data/ext/libuv/src/uv-common.c +544 -0
  129. data/ext/libuv/src/uv-common.h +214 -0
  130. data/ext/libuv/src/version.c +49 -0
  131. data/ext/libuv/uv.gyp +487 -0
  132. data/ext/nginx/ContentHandler.c +21 -10
  133. data/ext/nginx/ngx_http_passenger_module.c +7 -0
  134. data/ext/oxt/implementation.cpp +9 -2
  135. data/ext/oxt/initialize.hpp +5 -1
  136. data/lib/phusion_passenger.rb +3 -3
  137. data/lib/phusion_passenger/admin_tools/instance.rb +10 -6
  138. data/lib/phusion_passenger/admin_tools/instance_registry.rb +6 -2
  139. data/lib/phusion_passenger/packaging.rb +3 -4
  140. data/lib/phusion_passenger/platform_info.rb +13 -1
  141. data/lib/phusion_passenger/platform_info/apache.rb +15 -4
  142. data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -1
  143. data/lib/phusion_passenger/rack/thread_handler_extension.rb +184 -99
  144. data/lib/phusion_passenger/request_handler/thread_handler.rb +13 -6
  145. data/lib/phusion_passenger/standalone/start_command.rb +2 -2
  146. data/resources/templates/apache2/apache_install_broken.txt.erb +2 -1
  147. metadata +99 -22
  148. metadata.gz.asc +7 -7
  149. data/ext/libeio/Changes +0 -76
  150. data/ext/libeio/LICENSE +0 -36
  151. data/ext/libeio/Makefile.am +0 -15
  152. data/ext/libeio/Makefile.in +0 -694
  153. data/ext/libeio/aclocal.m4 +0 -9418
  154. data/ext/libeio/autogen.sh +0 -3
  155. data/ext/libeio/config.guess +0 -1540
  156. data/ext/libeio/config.h.in +0 -136
  157. data/ext/libeio/config.sub +0 -1779
  158. data/ext/libeio/configure +0 -14822
  159. data/ext/libeio/configure.ac +0 -22
  160. data/ext/libeio/demo.c +0 -194
  161. data/ext/libeio/ecb.h +0 -714
  162. data/ext/libeio/eio.c +0 -2818
  163. data/ext/libeio/eio.h +0 -414
  164. data/ext/libeio/install-sh +0 -520
  165. data/ext/libeio/libeio.m4 +0 -195
  166. data/ext/libeio/ltmain.sh +0 -9636
  167. data/ext/libeio/missing +0 -376
  168. data/ext/libeio/xthread.h +0 -166
@@ -228,7 +228,7 @@ determineHeaderSizeForSessionProtocol(Request *req,
228
228
  dataSize += sizeof("REQUEST_METHOD");
229
229
  dataSize += state.methodStr.size() + 1;
230
230
 
231
- if (req->host != NULL) {
231
+ if (req->host != NULL && req->host->size > 0) {
232
232
  const LString *host = psg_lstr_make_contiguous(req->host, req->pool);
233
233
  const char *sep = (const char *) memchr(host->start->data, ':', host->size);
234
234
  if (sep != NULL) {
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2011-2014 Phusion
3
+ * Copyright (c) 2011-2015 Phusion
4
4
  *
5
5
  * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
@@ -54,10 +54,16 @@ generateServerLogName(unsigned int number) {
54
54
  void
55
55
  disconnectWithClientSocketWriteError(Client **client, int e) {
56
56
  stringstream message;
57
+ PassengerLogLevel logLevel;
57
58
  message << "client socket write error: ";
58
59
  message << ServerKit::getErrorDesc(e);
59
60
  message << " (errno=" << e << ")";
60
- disconnectWithError(client, message.str());
61
+ if (e == EPIPE || e == ECONNRESET) {
62
+ logLevel = LVL_INFO;
63
+ } else {
64
+ logLevel = LVL_WARN;
65
+ }
66
+ disconnectWithError(client, message.str(), logLevel);
61
67
  }
62
68
 
63
69
  void
@@ -251,6 +257,7 @@ parseCookieHeader(psg_pool_t *pool, const LString *headerValue,
251
257
  vector<StaticString> parts;
252
258
  vector<StaticString>::const_iterator it, it_end;
253
259
 
260
+ assert(headerValue->size > 0);
254
261
  headerValue = psg_lstr_make_contiguous(headerValue, pool);
255
262
  split(StaticString(headerValue->start->data, headerValue->size),
256
263
  ';', parts);
@@ -247,7 +247,7 @@ private:
247
247
  }
248
248
 
249
249
  time_t parseDate(psg_pool_t *pool, const LString *date, ev_tstamp now) const {
250
- if (date == NULL) {
250
+ if (date == NULL || date->size == 0) {
251
251
  return (time_t) now;
252
252
  }
253
253
 
@@ -332,7 +332,7 @@ private:
332
332
 
333
333
  void invalidateLocation(Request *req, const HashedStaticString &header) {
334
334
  const LString *value = req->appResponse.headers.lookup(header);
335
- if (value == NULL) {
335
+ if (value == NULL || value->size == 0) {
336
336
  return;
337
337
  }
338
338
 
@@ -360,16 +360,16 @@ private:
360
360
  return;
361
361
  }
362
362
 
363
- char *hostData = (char *) psg_pnalloc(req->pool, host.size());
364
- memcpy(hostData, host.data(), host.size());
365
- convertLowerCase((unsigned char *) hostData, host.size());
366
- host = StaticString(hostData, host.size());
363
+ char *lowercaseHost = (char *) psg_pnalloc(req->pool, host.size());
364
+ convertLowerCase((const unsigned char *) host.data(),
365
+ (unsigned char *) lowercaseHost, host.size());
366
+ host = StaticString(lowercaseHost, host.size());
367
367
 
368
- char *reqHost = (char *) psg_pnalloc(req->pool, req->host->size);
369
- memcpy(reqHost, req->host->start->data, req->host->size);
370
- convertLowerCase((unsigned char *) reqHost, req->host->size);
368
+ char *lowercaseReqHost = (char *) psg_pnalloc(req->pool, req->host->size);
369
+ convertLowerCase((const unsigned char *) req->host->start->data,
370
+ (unsigned char *) lowercaseReqHost, req->host->size);
371
371
 
372
- if (memcmp(host.data(), reqHost, req->host->size) != 0) {
372
+ if (memcmp(host.data(), lowercaseReqHost, req->host->size) != 0) {
373
373
  // The host names don't match.
374
374
  return;
375
375
  }
@@ -578,7 +578,7 @@ public:
578
578
  ServerKit::HeaderTable &respHeaders = req->appResponse.headers;
579
579
 
580
580
  req->appResponse.cacheControl = respHeaders.lookup(CACHE_CONTROL);
581
- if (req->appResponse.cacheControl != NULL) {
581
+ if (req->appResponse.cacheControl != NULL && req->appResponse.cacheControl->size > 0) {
582
582
  req->appResponse.cacheControl = psg_lstr_make_contiguous(
583
583
  req->appResponse.cacheControl,
584
584
  req->pool);
@@ -125,7 +125,7 @@ private:
125
125
  if (authorize(client, req, READONLY)) {
126
126
  HeaderTable headers;
127
127
  headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate");
128
- headers.insert(req->pool, "content-type", "application/json");
128
+ headers.insert(req->pool, "Content-Type", "application/json");
129
129
  writeSimpleResponse(client, 200, &headers, "{ \"status\": \"ok\" }");
130
130
  if (!req->ended()) {
131
131
  endRequest(&client, &req);
@@ -140,7 +140,7 @@ private:
140
140
  respondWith405(client, req);
141
141
  } else if (authorize(client, req, FULL)) {
142
142
  HeaderTable headers;
143
- headers.insert(req->pool, "content-type", "application/json");
143
+ headers.insert(req->pool, "Content-Type", "application/json");
144
144
  exitEvent->notify();
145
145
  writeSimpleResponse(client, 200, &headers, "{ \"status\": \"ok\" }");
146
146
  if (!req->ended()) {
@@ -162,7 +162,7 @@ private:
162
162
  string logFile = getLogFile();
163
163
  string fileDescriptorLogFile = getFileDescriptorLogFile();
164
164
 
165
- headers.insert(req->pool, "content-type", "application/json");
165
+ headers.insert(req->pool, "Content-Type", "application/json");
166
166
  doc["log_level"] = getLogLevel();
167
167
  if (!logFile.empty()) {
168
168
  doc["log_file"] = logFile;
@@ -191,7 +191,7 @@ private:
191
191
  HeaderTable headers;
192
192
  Json::Value &json = req->jsonBody;
193
193
 
194
- headers.insert(req->pool, "content-type", "application/json");
194
+ headers.insert(req->pool, "Content-Type", "application/json");
195
195
 
196
196
  if (json.isMember("log_level")) {
197
197
  setLogLevel(json["log_level"].asInt());
@@ -241,7 +241,7 @@ private:
241
241
  } else if (authorize(client, req, FULL)) {
242
242
  int e;
243
243
  HeaderTable headers;
244
- headers.insert(req->pool, "content-type", "application/json");
244
+ headers.insert(req->pool, "Content-Type", "application/json");
245
245
 
246
246
  string logFile = getLogFile();
247
247
  if (logFile.empty()) {
@@ -301,7 +301,7 @@ private:
301
301
  respondWith405(client, req);
302
302
  } else if (authorize(client, req, READONLY)) {
303
303
  HeaderTable headers;
304
- headers.insert(req->pool, "content-type", "text/plain");
304
+ headers.insert(req->pool, "Content-Type", "text/plain");
305
305
 
306
306
  stringstream stream;
307
307
  loggingServer->dump(stream);
@@ -317,7 +317,7 @@ private:
317
317
  void respondWith401(Client *client, Request *req) {
318
318
  HeaderTable headers;
319
319
  headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate");
320
- headers.insert(req->pool, "www-authenticate", "Basic realm=\"admin\"");
320
+ headers.insert(req->pool, "WWW-Authenticate", "Basic realm=\"admin\"");
321
321
  writeSimpleResponse(client, 401, &headers, "Unauthorized");
322
322
  if (!req->ended()) {
323
323
  endRequest(&client, &req);
@@ -345,7 +345,7 @@ private:
345
345
  void respondWith422(Client *client, Request *req, const StaticString &body) {
346
346
  HeaderTable headers;
347
347
  headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate");
348
- headers.insert(req->pool, "content-type", "text/plain; charset=utf-8");
348
+ headers.insert(req->pool, "Content-Type", "text/plain; charset=utf-8");
349
349
  writeSimpleResponse(client, 422, &headers, body);
350
350
  if (!req->ended()) {
351
351
  endRequest(&client, &req);
@@ -289,12 +289,13 @@ initializeUnprivilegedWorkingObjects() {
289
289
 
290
290
  UPDATE_TRACE_POINT();
291
291
  wo->bgloop = new BackgroundEventLoop(true, true);
292
- wo->serverKitContext = new ServerKit::Context(wo->bgloop->safe);
292
+ wo->serverKitContext = new ServerKit::Context(wo->bgloop->safe,
293
+ wo->bgloop->libuv_loop);
293
294
 
294
295
  UPDATE_TRACE_POINT();
295
296
  wo->accountsDatabase = boost::make_shared<AccountsDatabase>();
296
297
  wo->accountsDatabase->add("logging", wo->password, false);
297
- wo->loggingServer = new LoggingServer(wo->bgloop->loop,
298
+ wo->loggingServer = new LoggingServer(wo->bgloop->libev_loop,
298
299
  wo->serverSocketFd, wo->accountsDatabase, options);
299
300
 
300
301
  UPDATE_TRACE_POINT();
@@ -309,11 +310,11 @@ initializeUnprivilegedWorkingObjects() {
309
310
 
310
311
  UPDATE_TRACE_POINT();
311
312
  ev_signal_init(&wo->sigquitWatcher, printInfo, SIGQUIT);
312
- ev_signal_start(wo->bgloop->loop, &wo->sigquitWatcher);
313
+ ev_signal_start(wo->bgloop->libev_loop, &wo->sigquitWatcher);
313
314
  ev_signal_init(&wo->sigintWatcher, onTerminationSignal, SIGINT);
314
- ev_signal_start(wo->bgloop->loop, &wo->sigintWatcher);
315
+ ev_signal_start(wo->bgloop->libev_loop, &wo->sigintWatcher);
315
316
  ev_signal_init(&wo->sigtermWatcher, onTerminationSignal, SIGTERM);
316
- ev_signal_start(wo->bgloop->loop, &wo->sigtermWatcher);
317
+ ev_signal_start(wo->bgloop->libev_loop, &wo->sigtermWatcher);
317
318
  }
318
319
 
319
320
  static void
@@ -127,7 +127,7 @@ private:
127
127
  if (authorize(client, req, READONLY)) {
128
128
  HeaderTable headers;
129
129
  //stringstream stream;
130
- headers.insert(req->pool, "content-type", "text/plain");
130
+ headers.insert(req->pool, "Content-Type", "text/plain");
131
131
  //loggingServer->dump(stream);
132
132
  //writeSimpleResponse(client, 200, &headers, stream.str());
133
133
  if (!req->ended()) {
@@ -141,8 +141,8 @@ private:
141
141
  void processPing(Client *client, Request *req) {
142
142
  if (authorize(client, req, READONLY)) {
143
143
  HeaderTable headers;
144
- headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate");
145
- headers.insert(req->pool, "content-type", "application/json");
144
+ headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate");
145
+ headers.insert(req->pool, "Content-Type", "application/json");
146
146
  writeSimpleResponse(client, 200, &headers, "{ \"status\": \"ok\" }");
147
147
  if (!req->ended()) {
148
148
  endRequest(&client, &req);
@@ -157,7 +157,7 @@ private:
157
157
  respondWith405(client, req);
158
158
  } else if (authorize(client, req, FULL)) {
159
159
  HeaderTable headers;
160
- headers.insert(req->pool, "content-type", "application/json");
160
+ headers.insert(req->pool, "Content-Type", "application/json");
161
161
  exitEvent->notify();
162
162
  writeSimpleResponse(client, 200, &headers, "{ \"status\": \"ok\" }");
163
163
  if (!req->ended()) {
@@ -179,7 +179,7 @@ private:
179
179
  string logFile = getLogFile();
180
180
  string fileDescriptorLogFile = getFileDescriptorLogFile();
181
181
 
182
- headers.insert(req->pool, "content-type", "application/json");
182
+ headers.insert(req->pool, "Content-Type", "application/json");
183
183
  doc["log_level"] = getLogLevel();
184
184
  if (!logFile.empty()) {
185
185
  doc["log_file"] = logFile;
@@ -208,7 +208,7 @@ private:
208
208
  HeaderTable headers;
209
209
  Json::Value &json = req->jsonBody;
210
210
 
211
- headers.insert(req->pool, "content-type", "application/json");
211
+ headers.insert(req->pool, "Content-Type", "application/json");
212
212
 
213
213
  if (json.isMember("log_level")) {
214
214
  setLogLevel(json["log_level"].asInt());
@@ -258,7 +258,7 @@ private:
258
258
  } else if (authorize(client, req, FULL)) {
259
259
  int e;
260
260
  HeaderTable headers;
261
- headers.insert(req->pool, "content-type", "application/json");
261
+ headers.insert(req->pool, "Content-Type", "application/json");
262
262
 
263
263
  string logFile = getLogFile();
264
264
  if (logFile.empty()) {
@@ -315,8 +315,8 @@ private:
315
315
 
316
316
  void respondWith401(Client *client, Request *req) {
317
317
  HeaderTable headers;
318
- headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate");
319
- headers.insert(req->pool, "www-authenticate", "Basic realm=\"admin\"");
318
+ headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate");
319
+ headers.insert(req->pool, "WWW-Authenticate", "Basic realm=\"admin\"");
320
320
  writeSimpleResponse(client, 401, &headers, "Unauthorized");
321
321
  if (!req->ended()) {
322
322
  endRequest(&client, &req);
@@ -325,7 +325,7 @@ private:
325
325
 
326
326
  void respondWith404(Client *client, Request *req) {
327
327
  HeaderTable headers;
328
- headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate");
328
+ headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate");
329
329
  writeSimpleResponse(client, 404, &headers, "Not found");
330
330
  if (!req->ended()) {
331
331
  endRequest(&client, &req);
@@ -334,7 +334,7 @@ private:
334
334
 
335
335
  void respondWith405(Client *client, Request *req) {
336
336
  HeaderTable headers;
337
- headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate");
337
+ headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate");
338
338
  writeSimpleResponse(client, 405, &headers, "Method not allowed");
339
339
  if (!req->ended()) {
340
340
  endRequest(&client, &req);
@@ -343,8 +343,8 @@ private:
343
343
 
344
344
  void respondWith422(Client *client, Request *req, const StaticString &body) {
345
345
  HeaderTable headers;
346
- headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate");
347
- headers.insert(req->pool, "content-type", "text/plain; charset=utf-8");
346
+ headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate");
347
+ headers.insert(req->pool, "Content-Type", "text/plain; charset=utf-8");
348
348
  writeSimpleResponse(client, 422, &headers, body);
349
349
  if (!req->ended()) {
350
350
  endRequest(&client, &req);
@@ -954,7 +954,9 @@ lookupDefaultUidGid(uid_t &uid, gid_t &gid) {
954
954
  }
955
955
 
956
956
  static void
957
- initializeWorkingObjects(const WorkingObjectsPtr &wo, InstanceDirToucherPtr &instanceDirToucher) {
957
+ initializeWorkingObjects(const WorkingObjectsPtr &wo, InstanceDirToucherPtr &instanceDirToucher,
958
+ uid_t uidBeforeLoweringPrivilege)
959
+ {
958
960
  TRACE_POINT();
959
961
  VariantMap &options = *agentsOptions;
960
962
  vector<string> strset;
@@ -977,6 +979,7 @@ initializeWorkingObjects(const WorkingObjectsPtr &wo, InstanceDirToucherPtr &ins
977
979
  UPDATE_TRACE_POINT();
978
980
  InstanceDirectory::CreationOptions instanceOptions;
979
981
  instanceOptions.userSwitching = options.getBool("user_switching");
982
+ instanceOptions.originalUid = uidBeforeLoweringPrivilege;
980
983
  instanceOptions.defaultUid = wo->defaultUid;
981
984
  instanceOptions.defaultGid = wo->defaultGid;
982
985
  instanceOptions.properties["name"] = wo->randomGenerator.generateAsciiString(8);
@@ -1134,7 +1137,8 @@ initializeAdminServer(const WorkingObjectsPtr &wo) {
1134
1137
 
1135
1138
  UPDATE_TRACE_POINT();
1136
1139
  wo->bgloop = new BackgroundEventLoop(true, true);
1137
- wo->serverKitContext = new ServerKit::Context(wo->bgloop->safe);
1140
+ wo->serverKitContext = new ServerKit::Context(wo->bgloop->safe,
1141
+ wo->bgloop->libuv_loop);
1138
1142
  wo->serverKitContext->defaultFileBufferedChannelConfig.bufferDir =
1139
1143
  absolutizePath(options.get("data_buffer_dir"));
1140
1144
 
@@ -1265,6 +1269,7 @@ watchdogMain(int argc, char *argv[]) {
1265
1269
  P_DEBUG("Watchdog options: " << agentsOptions->inspect());
1266
1270
  InstanceDirToucherPtr instanceDirToucher;
1267
1271
  vector<AgentWatcherPtr> watchers;
1272
+ uid_t uidBeforeLoweringPrivilege = geteuid();
1268
1273
 
1269
1274
  try {
1270
1275
  TRACE_POINT();
@@ -1273,7 +1278,7 @@ watchdogMain(int argc, char *argv[]) {
1273
1278
  createPidFile();
1274
1279
  openReportFile(wo);
1275
1280
  lowerPrivilege();
1276
- initializeWorkingObjects(wo, instanceDirToucher);
1281
+ initializeWorkingObjects(wo, instanceDirToucher, uidBeforeLoweringPrivilege);
1277
1282
  initializeAgentWatchers(wo, watchers);
1278
1283
  initializeAdminServer(wo);
1279
1284
  UPDATE_TRACE_POINT();
@@ -0,0 +1,72 @@
1
+ *.swp
2
+ *.[oa]
3
+ *.l[oa]
4
+ *.opensdf
5
+ *.orig
6
+ *.pyc
7
+ *.sdf
8
+ *.suo
9
+ core
10
+ vgcore.*
11
+ .buildstamp
12
+ .dirstamp
13
+ .deps/
14
+ /.libs/
15
+ /aclocal.m4
16
+ /ar-lib
17
+ /autom4te.cache/
18
+ /compile
19
+ /config.guess
20
+ /config.log
21
+ /config.status
22
+ /config.sub
23
+ /configure
24
+ /depcomp
25
+ /install-sh
26
+ /libtool
27
+ /libuv.a
28
+ /libuv.dylib
29
+ /libuv.pc
30
+ /libuv.so
31
+ /ltmain.sh
32
+ /missing
33
+ /test-driver
34
+ Makefile
35
+ Makefile.in
36
+
37
+ # Generated by gyp for android
38
+ *.target.mk
39
+
40
+ /out/
41
+ /build/gyp
42
+
43
+ /test/.libs/
44
+ /test/run-tests
45
+ /test/run-tests.exe
46
+ /test/run-tests.dSYM
47
+ /test/run-benchmarks
48
+ /test/run-benchmarks.exe
49
+ /test/run-benchmarks.dSYM
50
+
51
+ *.sln
52
+ *.sln.cache
53
+ *.ncb
54
+ *.vcproj
55
+ *.vcproj*.user
56
+ *.vcxproj
57
+ *.vcxproj.filters
58
+ *.vcxproj.user
59
+ _UpgradeReport_Files/
60
+ UpgradeLog*.XML
61
+ Debug
62
+ Release
63
+ ipch
64
+
65
+ # sphinx generated files
66
+ /docs/build/
67
+
68
+ *.xcodeproj
69
+ *.xcworkspace
70
+
71
+ # make dist output
72
+ libuv-*.tar.*
@@ -0,0 +1,199 @@
1
+ # Authors ordered by first contribution.
2
+ Ryan Dahl <ryan@joyent.com>
3
+ Bert Belder <bertbelder@gmail.com>
4
+ Josh Roesslein <jroesslein@gmail.com>
5
+ Alan Gutierrez <alan@prettyrobots.com>
6
+ Joshua Peek <josh@joshpeek.com>
7
+ Igor Zinkovsky <igorzi@microsoft.com>
8
+ San-Tai Hsu <vanilla@fatpipi.com>
9
+ Ben Noordhuis <info@bnoordhuis.nl>
10
+ Henry Rawas <henryr@schakra.com>
11
+ Robert Mustacchi <rm@joyent.com>
12
+ Matt Stevens <matt@alloysoft.com>
13
+ Paul Querna <pquerna@apache.org>
14
+ Shigeki Ohtsu <ohtsu@iij.ad.jp>
15
+ Tom Hughes <tom.hughes@palm.com>
16
+ Peter Bright <drpizza@quiscalusmexicanus.org>
17
+ Jeroen Janssen <jeroen.janssen@gmail.com>
18
+ Andrea Lattuada <ndr.lattuada@gmail.com>
19
+ Augusto Henrique Hentz <ahhentz@gmail.com>
20
+ Clifford Heath <clifford.heath@gmail.com>
21
+ Jorge Chamorro Bieling <jorge@jorgechamorro.com>
22
+ Luis Lavena <luislavena@gmail.com>
23
+ Matthew Sporleder <msporleder@gmail.com>
24
+ Erick Tryzelaar <erick.tryzelaar@gmail.com>
25
+ Isaac Z. Schlueter <i@izs.me>
26
+ Pieter Noordhuis <pcnoordhuis@gmail.com>
27
+ Marek Jelen <marek@jelen.biz>
28
+ Fedor Indutny <fedor.indutny@gmail.com>
29
+ Saúl Ibarra Corretgé <saghul@gmail.com>
30
+ Felix Geisendörfer <felix@debuggable.com>
31
+ Yuki Okumura <mjt@cltn.org>
32
+ Roman Shtylman <shtylman@gmail.com>
33
+ Frank Denis <github@pureftpd.org>
34
+ Carter Allen <CarterA@opt-6.com>
35
+ Tj Holowaychuk <tj@vision-media.ca>
36
+ Shimon Doodkin <helpmepro1@gmail.com>
37
+ Ryan Emery <seebees@gmail.com>
38
+ Bruce Mitchener <bruce.mitchener@gmail.com>
39
+ Maciej Małecki <maciej.malecki@notimplemented.org>
40
+ Yasuhiro Matsumoto <mattn.jp@gmail.com>
41
+ Daisuke Murase <typester@cpan.org>
42
+ Paddy Byers <paddy.byers@gmail.com>
43
+ Dan VerWeire <dverweire@gmail.com>
44
+ Brandon Benvie <brandon@bbenvie.com>
45
+ Brandon Philips <brandon.philips@rackspace.com>
46
+ Nathan Rajlich <nathan@tootallnate.net>
47
+ Charlie McConnell <charlie@charlieistheman.com>
48
+ Vladimir Dronnikov <dronnikov@gmail.com>
49
+ Aaron Bieber <qbit@deftly.net>
50
+ Bulat Shakirzyanov <mallluhuct@gmail.com>
51
+ Brian White <mscdex@mscdex.net>
52
+ Erik Dubbelboer <erik@dubbelboer.com>
53
+ Keno Fischer <kenof@stanford.edu>
54
+ Ira Cooper <Ira.Cooper@mathworks.com>
55
+ Andrius Bentkus <andrius.bentkus@gmail.com>
56
+ Iñaki Baz Castillo <ibc@aliax.net>
57
+ Mark Cavage <mark.cavage@joyent.com>
58
+ George Yohng <georgegh@oss3d.com>
59
+ Xidorn Quan <quanxunzhen@gmail.com>
60
+ Roman Neuhauser <rneuhauser@suse.cz>
61
+ Shuhei Tanuma <shuhei.tanuma@gmail.com>
62
+ Bryan Cantrill <bcantrill@acm.org>
63
+ Trond Norbye <trond.norbye@gmail.com>
64
+ Tim Holy <holy@wustl.edu>
65
+ Prancesco Pertugio <meh@schizofreni.co>
66
+ Leonard Hecker <leonard.hecker91@gmail.com>
67
+ Andrew Paprocki <andrew@ishiboo.com>
68
+ Luigi Grilli <luigi.grilli@gmail.com>
69
+ Shannen Saez <shannenlaptop@gmail.com>
70
+ Artur Adib <arturadib@gmail.com>
71
+ Hiroaki Nakamura <hnakamur@gmail.com>
72
+ Ting-Yu Lin <ph.minamo@cytisan.com>
73
+ Stephen Gallagher <sgallagh@redhat.com>
74
+ Shane Holloway <shane.holloway@ieee.org>
75
+ Andrew Shaffer <darawk@gmail.com>
76
+ Vlad Tudose <vlad.tudose@intel.com>
77
+ Ben Leslie <benno@benno.id.au>
78
+ Tim Bradshaw <tfb@cley.com>
79
+ Timothy J. Fontaine <tjfontaine@gmail.com>
80
+ Marc Schlaich <marc.schlaich@googlemail.com>
81
+ Brian Mazza <louseman@gmail.com>
82
+ Elliot Saba <staticfloat@gmail.com>
83
+ Ben Kelly <ben@wanderview.com>
84
+ Nils Maier <maierman@web.de>
85
+ Nicholas Vavilov <vvnicholas@gmail.com>
86
+ Miroslav Bajtoš <miro.bajtos@gmail.com>
87
+ Sean Silva <chisophugis@gmail.com>
88
+ Wynn Wilkes <wynnw@movenetworks.com>
89
+ Andrei Sedoi <bsnote@gmail.com>
90
+ Alex Crichton <alex@alexcrichton.com>
91
+ Brent Cook <brent@boundary.com>
92
+ Brian Kaisner <bkize1@gmail.com>
93
+ Luca Bruno <lucab@debian.org>
94
+ Reini Urban <rurban@cpanel.net>
95
+ Maks Naumov <maksqwe1@ukr.net>
96
+ Sean Farrell <sean.farrell@rioki.org>
97
+ Chris Bank <cbank@adobe.com>
98
+ Geert Jansen <geertj@gmail.com>
99
+ Christoph Iserlohn <christoph.iserlohn@innoq.com>
100
+ Steven Kabbes <stevenkabbes@gmail.com>
101
+ Alex Gaynor <alex.gaynor@gmail.com>
102
+ huxingyi <huxingyi@msn.com>
103
+ Tenor Biel <tenorbiel@gmail.com>
104
+ Andrej Manduch <AManduch@gmail.com>
105
+ Joshua Neuheisel <joshua@neuheisel.us>
106
+ Alexis Campailla <alexis@janeasystems.com>
107
+ Yazhong Liu <yorkiefixer@gmail.com>
108
+ Sam Roberts <vieuxtech@gmail.com>
109
+ River Tarnell <river@loreley.flyingparchment.org.uk>
110
+ Nathan Sweet <nathanjsweet@gmail.com>
111
+ Trevor Norris <trev.norris@gmail.com>
112
+ Oguz Bastemur <obastemur@gmail.com>
113
+ Dylan Cali <calid1984@gmail.com>
114
+ Austin Foxley <austinf@cetoncorp.com>
115
+ Benjamin Saunders <ben.e.saunders@gmail.com>
116
+ Geoffry Song <goffrie@gmail.com>
117
+ Rasmus Christian Pedersen <ruysch@outlook.com>
118
+ William Light <wrl@illest.net>
119
+ Oleg Efimov <o.efimov@corp.badoo.com>
120
+ Lars Gierth <larsg@systemli.org>
121
+ Rasmus Christian Pedersen <zerhacken@yahoo.com>
122
+ Justin Venus <justin.venus@gmail.com>
123
+ Kristian Evensen <kristian.evensen@gmail.com>
124
+ Linus Mårtensson <linus.martensson@sonymobile.com>
125
+ Navaneeth Kedaram Nambiathan <navaneethkn@gmail.com>
126
+ Yorkie <yorkiefixer@gmail.com>
127
+ StarWing <weasley.wx@gmail.com>
128
+ thierry-FreeBSD <thierry@FreeBSD.org>
129
+ Isaiah Norton <isaiah.norton@gmail.com>
130
+ Raul Martins <raulms.martins@gmail.com>
131
+ David Capello <davidcapello@gmail.com>
132
+ Paul Tan <pyokagan@gmail.com>
133
+ Javier Hernández <jhernandez@emergya.com>
134
+ Tonis Tiigi <tonistiigi@gmail.com>
135
+ Norio Kobota <nori.0428@gmail.com>
136
+ 李港平 <chopdown@gmail.com>
137
+ Chernyshev Viacheslav <astellar@ro.ru>
138
+ Stephen von Takach <steve@advancedcontrol.com.au>
139
+ JD Ballard <jd@pixelandline.com>
140
+ Luka Perkov <luka.perkov@sartura.hr>
141
+ Ryan Cole <ryan@rycole.com>
142
+ HungMingWu <u9089000@gmail.com>
143
+ Jay Satiro <raysatiro@yahoo.com>
144
+ Leith Bade <leith@leithalweapon.geek.nz>
145
+ Peter Atashian <retep998@gmail.com>
146
+ Tim Cooper <tim.cooper@layeh.com>
147
+ Caleb James DeLisle <cjd@hyperboria.ca>
148
+ Jameson Nash <vtjnash@gmail.com>
149
+ Graham Lee <ghmlee@ghmlee.com>
150
+ Andrew Low <Andrew_Low@ca.ibm.com>
151
+ Pavel Platto <hinidu@gmail.com>
152
+ Tony Kelman <tony@kelman.net>
153
+ John Firebaugh <john.firebaugh@gmail.com>
154
+ lilohuang <lilohuang@hotmail.com>
155
+ Paul Goldsmith <paul.goldsmith@aplink.net>
156
+ Julien Gilli <julien.gilli@joyent.com>
157
+ Michael Hudson-Doyle <michael.hudson@linaro.org>
158
+ Recep ASLANTAS <m@recp.me>
159
+ Rob Adams <readams@readams.net>
160
+ Zachary Newman <znewman01@gmail.com>
161
+ Robin Hahling <robin.hahling@gw-computing.net>
162
+ Jeff Widman <jeff@jeffwidman.com>
163
+ cjihrig <cjihrig@gmail.com>
164
+ Tomasz Kołodziejski <tkolodziejski@mozilla.com>
165
+ Unknown W. Brackets <checkins@unknownbrackets.org>
166
+ Emmanuel Odeke <odeke@ualberta.ca>
167
+ Mikhail Mukovnikov <yndi@me.com>
168
+ Thorsten Lorenz <thlorenz@gmx.de>
169
+ Yuri D'Elia <yuri.delia@eurac.edu>
170
+ Manos Nikolaidis <manos@shadowrobot.com>
171
+ Elijah Andrews <elijah@busbud.com>
172
+ Michael Ira Krufky <m.krufky@samsung.com>
173
+ Helge Deller <deller@gmx.de>
174
+ Joey Geralnik <jgeralnik@gmail.com>
175
+ Tim Caswell <tim@creationix.com>
176
+ Logan Rosen <loganrosen@gmail.com>
177
+ Kenneth Perry <thothonegan@gmail.com>
178
+ John Marino <marino@FreeBSD.org>
179
+ Alexey Melnichuk <mimir@newmail.ru>
180
+ Johan Bergström <bugs@bergstroem.nu>
181
+ Alex Mo <almosnow@gmail.com>
182
+ Luis Martinez de Bartolome <lasote@gmail.com>
183
+ Michael Penick <michael.penick@datastax.com>
184
+ Michael <michael_dawson@ca.ibm.com>
185
+ Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
186
+ TomCrypto <thomas.beneteau@yahoo.fr>
187
+ Brett Vickers <brett@beevik.com>
188
+ Ole André Vadla Ravnås <oleavr@gmail.com>
189
+ Kazuho Oku <kazuhooku@gmail.com>
190
+ Ryan Phillips <ryan.phillips@rackspace.com>
191
+ Brian Green <briangreenery@gmail.com>
192
+ Devchandra Meetei Leishangthem <dlmeetei@gmail.com>
193
+ Corey Farrell <git@cfware.com>
194
+ Per Nilsson <pni@qlik.com>
195
+ Alan Rogers <alanjrogers@me.com>
196
+ Daryl Haresign <github@daryl.haresign.com>
197
+ Rui Abreu Ferreira <raf-ep@gmx.com>
198
+ João Reis <reis@janeasystems.com>
199
+ farblue68 <farblue68@gmail.com>