passenger 5.0.26 → 5.0.27

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +17 -0
  3. data/CONTRIBUTORS +1 -0
  4. data/build/cxx_dependency_map.rb +113 -157
  5. data/build/cxx_tests.rb +8 -1
  6. data/src/agent/Core/ApplicationPool/TestSession.h +5 -1
  7. data/src/agent/Core/Controller/CheckoutSession.cpp +1 -1
  8. data/src/agent/Core/Controller/ForwardResponse.cpp +9 -0
  9. data/src/agent/Core/Controller/InternalUtils.cpp +9 -1
  10. data/src/agent/Core/Controller/SendRequest.cpp +13 -7
  11. data/src/agent/Core/Controller/StateInspectionAndConfiguration.cpp +3 -2
  12. data/src/agent/Core/CoreMain.cpp +3 -0
  13. data/src/agent/Core/SpawningKit/SmartSpawner.h +1 -1
  14. data/src/agent/Core/SpawningKit/Spawner.h +2 -2
  15. data/src/agent/Core/UnionStation/StopwatchLog.h +3 -4
  16. data/src/agent/Shared/Base.cpp +32 -0
  17. data/src/agent/Shared/Base.h +2 -0
  18. data/src/agent/UstRouter/UstRouterMain.cpp +3 -0
  19. data/src/agent/Watchdog/AgentWatcher.cpp +1 -3
  20. data/src/agent/Watchdog/WatchdogMain.cpp +31 -6
  21. data/src/apache2_module/Hooks.cpp +2 -2
  22. data/src/cxx_supportlib/BackgroundEventLoop.cpp +12 -2
  23. data/src/cxx_supportlib/Constants.h +1 -1
  24. data/src/cxx_supportlib/DataStructures/LString.cpp +39 -0
  25. data/src/cxx_supportlib/DataStructures/LString.h +35 -6
  26. data/src/cxx_supportlib/FileDescriptor.h +3 -1
  27. data/src/cxx_supportlib/Integrations/LibevJsonUtils.h +92 -0
  28. data/src/cxx_supportlib/ResourceLocator.h +10 -8
  29. data/src/cxx_supportlib/ServerKit/CookieUtils.h +4 -0
  30. data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +2 -0
  31. data/src/cxx_supportlib/ServerKit/HttpServer.h +6 -2
  32. data/src/cxx_supportlib/Utils.cpp +4 -5
  33. data/src/cxx_supportlib/Utils.h +2 -2
  34. data/src/cxx_supportlib/Utils/IOUtils.cpp +1 -1
  35. data/src/cxx_supportlib/Utils/JsonUtils.h +12 -10
  36. data/src/cxx_supportlib/Utils/MessagePassing.h +4 -4
  37. data/src/cxx_supportlib/Utils/StrIntUtils.cpp +7 -3
  38. data/src/cxx_supportlib/Utils/SystemTime.cpp +15 -4
  39. data/src/cxx_supportlib/Utils/SystemTime.h +228 -54
  40. data/src/cxx_supportlib/Utils/Timer.h +14 -41
  41. data/src/cxx_supportlib/WatchdogLauncher.h +1 -1
  42. data/src/cxx_supportlib/vendor-copy/libuv/Makefile.in +198 -59
  43. data/src/cxx_supportlib/vendor-copy/libuv/autom4te.cache/output.0 +15477 -0
  44. data/src/cxx_supportlib/vendor-copy/libuv/autom4te.cache/output.1 +15477 -0
  45. data/src/cxx_supportlib/vendor-copy/libuv/autom4te.cache/requests +324 -0
  46. data/src/cxx_supportlib/vendor-copy/libuv/autom4te.cache/traces.0 +3105 -0
  47. data/src/cxx_supportlib/vendor-copy/libuv/autom4te.cache/traces.1 +703 -0
  48. data/src/cxx_supportlib/vendor-copy/libuv/configure +115 -12
  49. data/src/cxx_supportlib/vendor-copy/libuv/ltmain.sh +15 -8
  50. data/src/cxx_supportlib/vendor-copy/libuv/m4/ltversion.m4 +5 -5
  51. data/src/cxx_supportlib/vendor-modified/psg_sysqueue.h +1 -0
  52. data/src/nginx_module/ngx_http_passenger_module.c +1 -1
  53. data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +1 -1
  54. data/src/ruby_native_extension/passenger_native_support.c +1 -1
  55. data/src/ruby_supportlib/phusion_passenger.rb +15 -1
  56. data/src/ruby_supportlib/phusion_passenger/common_library.rb +4 -0
  57. data/src/ruby_supportlib/phusion_passenger/packaging.rb +1 -0
  58. data/src/ruby_supportlib/phusion_passenger/ruby_core_io_enhancements.rb +5 -20
  59. metadata +9 -2
@@ -58,7 +58,7 @@
58
58
  #include <Utils.h>
59
59
  #include <Utils/IOUtils.h>
60
60
  #include <Utils/StrIntUtils.h>
61
- #include <Utils/Timer.h>
61
+ #include <Utils/SystemTime.h>
62
62
  #include <Utils/HttpConstants.h>
63
63
  #include <Utils/ReleaseableScopedPointer.h>
64
64
  #include <Logging.h>
@@ -630,7 +630,6 @@ private:
630
630
  * util_script.c's source. :-(
631
631
  */
632
632
  char backendData[MAX_STRING_LEN];
633
- Timer timer;
634
633
  getsfunc_BRIGADE(backendData, MAX_STRING_LEN, bb);
635
634
 
636
635
  // The bucket brigade is an interface to the HTTP response sent by the
@@ -1601,6 +1600,7 @@ init_module(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *
1601
1600
  */
1602
1601
  if (hooks == NULL) {
1603
1602
  oxt::initialize();
1603
+ SystemTime::initialize();
1604
1604
  } else {
1605
1605
  P_DEBUG("Restarting Phusion Passenger....");
1606
1606
  delete hooks;
@@ -44,6 +44,7 @@
44
44
  #if defined(__APPLE__) || \
45
45
  defined(__DragonFly__) || \
46
46
  defined(__FreeBSD__) || \
47
+ defined(__FreeBSD_kernel__) || \
47
48
  defined(__OpenBSD__) || \
48
49
  defined(__NetBSD__)
49
50
  #define HAVE_KQUEUE 1
@@ -271,7 +272,6 @@ BackgroundEventLoop::BackgroundEventLoop(bool scalable, bool usesLibuv)
271
272
  P_LOG_FILE_DESCRIPTOR_OPEN2(ev_backend_fd(libev_loop), "libev event loop: backend FD");
272
273
 
273
274
  ev_async_init(&priv->exitSignaller, signalLibevExit);
274
- ev_async_start(libev_loop, &priv->exitSignaller);
275
275
  P_LOG_FILE_DESCRIPTOR_OPEN2(ev_loop_get_pipe(libev_loop, 0), "libev event loop: async pipe 0");
276
276
  P_LOG_FILE_DESCRIPTOR_OPEN2(ev_loop_get_pipe(libev_loop, 1), "libev event loop: async pipe 1");
277
277
  priv->exitSignaller.data = this;
@@ -281,7 +281,6 @@ BackgroundEventLoop::BackgroundEventLoop(bool scalable, bool usesLibuv)
281
281
 
282
282
  if (usesLibuv) {
283
283
  ev_async_init(&priv->libuvActivitySignaller, onLibuvActivity);
284
- ev_async_start(libev_loop, &priv->libuvActivitySignaller);
285
284
  priv->libuvActivitySignaller.data = this;
286
285
 
287
286
  libuv_loop = &priv->libuv_loop;
@@ -303,6 +302,7 @@ BackgroundEventLoop::BackgroundEventLoop(bool scalable, bool usesLibuv)
303
302
  BackgroundEventLoop::~BackgroundEventLoop() {
304
303
  stop();
305
304
  if (priv->usesLibuv) {
305
+ uv_close((uv_handle_t *) &priv->libuv_timer, NULL);
306
306
  while (uv_loop_alive(libuv_loop)) {
307
307
  uv_run(libuv_loop, UV_RUN_NOWAIT);
308
308
  syscalls::usleep(10000);
@@ -312,6 +312,12 @@ BackgroundEventLoop::~BackgroundEventLoop() {
312
312
  P_LOG_FILE_DESCRIPTOR_CLOSE(libuv_loop->signal_pipefd[0]);
313
313
  P_LOG_FILE_DESCRIPTOR_CLOSE(libuv_loop->signal_pipefd[1]);
314
314
  uv_loop_close(libuv_loop);
315
+ if (ev_is_active(&priv->libuvActivitySignaller)) {
316
+ ev_async_stop(libev_loop, &priv->libuvActivitySignaller);
317
+ }
318
+ }
319
+ if (ev_is_active(&priv->exitSignaller)) {
320
+ ev_async_stop(libev_loop, &priv->exitSignaller);
315
321
  }
316
322
  uv_barrier_destroy(&priv->startBarrier);
317
323
  delete priv;
@@ -320,6 +326,10 @@ BackgroundEventLoop::~BackgroundEventLoop() {
320
326
  void
321
327
  BackgroundEventLoop::start(const string &threadName, unsigned int stackSize) {
322
328
  assert(priv->thr == NULL);
329
+ ev_async_start(libev_loop, &priv->exitSignaller);
330
+ if (priv->usesLibuv) {
331
+ ev_async_start(libev_loop, &priv->libuvActivitySignaller);
332
+ }
323
333
  priv->thr = new oxt::thread(
324
334
  boost::bind(runBackgroundLoop, this),
325
335
  threadName,
@@ -121,7 +121,7 @@
121
121
 
122
122
  #define PASSENGER_DEFAULT_USER "nobody"
123
123
 
124
- #define PASSENGER_VERSION "5.0.26"
124
+ #define PASSENGER_VERSION "5.0.27"
125
125
 
126
126
  #define POOL_HELPER_THREAD_STACK_SIZE 262144
127
127
 
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Phusion Passenger - https://www.phusionpassenger.com/
3
+ * Copyright (c) 2016 Phusion Holding B.V.
4
+ *
5
+ * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
+ * trademarks of Phusion Holding B.V.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+ #include <DataStructures/LString.h>
27
+
28
+ namespace Passenger {
29
+
30
+
31
+ LString::Part emptyLStringPart = {
32
+ NULL,
33
+ NULL,
34
+ "",
35
+ 0
36
+ };
37
+
38
+
39
+ }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2014 Phusion Holding B.V.
3
+ * Copyright (c) 2014-2016 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -27,6 +27,8 @@
27
27
  #define _PASSENGER_DATA_STRUCTURES_LSTRING_H_
28
28
 
29
29
  #include <boost/cstdint.hpp>
30
+ #include <oxt/backtrace.hpp>
31
+ #include <stdexcept>
30
32
  #include <cstring>
31
33
  #include <cassert>
32
34
  #include <algorithm>
@@ -48,8 +50,8 @@ using namespace std;
48
50
  * we just store the headers non-contiguously using LString. Each LString
49
51
  * references the mbuf_block that the HTTP header data comes from.
50
52
  *
51
- * The empty string is repesented by `size == 0 && start == NULL && end == NULL`.
52
- * Parts may never contain the empty string.
53
+ * The empty string is represented by `size == 0 && start == &emptyLStringPart && end == &emptyLStringPart`.
54
+ * Except for emptyLStringPart, parts may never contain the empty string.
53
55
  *
54
56
  * This struct must be a POD so that we can allocate it with psg_pool_t.
55
57
  */
@@ -67,6 +69,8 @@ struct LString {
67
69
  unsigned int size;
68
70
  };
69
71
 
72
+ extern LString::Part emptyLStringPart;
73
+
70
74
 
71
75
  namespace {
72
76
  OXT_FORCE_INLINE char
@@ -87,14 +91,18 @@ inline void psg_lstr_append(LString *str, psg_pool_t *pool, const char *data,
87
91
 
88
92
  inline void
89
93
  psg_lstr_init(LString *str) {
90
- str->start = NULL;
91
- str->end = NULL;
94
+ str->start = &emptyLStringPart;
95
+ str->end = &emptyLStringPart;
92
96
  str->size = 0;
93
97
  }
94
98
 
95
99
  inline LString *
96
100
  psg_lstr_create(psg_pool_t *pool, const char *data, unsigned int size) {
97
101
  LString *result = (LString *) psg_palloc(pool, sizeof(LString));
102
+ if (result == NULL) {
103
+ TRACE_POINT();
104
+ throw std::bad_alloc();
105
+ }
98
106
  psg_lstr_init(result);
99
107
  psg_lstr_append(result, pool, data, size);
100
108
  return result;
@@ -107,7 +115,7 @@ psg_lstr_create(psg_pool_t *pool, const StaticString &str) {
107
115
 
108
116
  inline void
109
117
  psg_lstr_append_part(LString *str, LString::Part *part) {
110
- if (str->end == NULL) {
118
+ if (str->size == 0) {
111
119
  str->start = part;
112
120
  str->end = part;
113
121
  } else {
@@ -121,6 +129,10 @@ psg_lstr_append_part(LString *str, LString::Part *part) {
121
129
  inline void
122
130
  psg_lstr_append_part_from_another_lstr(LString *str, psg_pool_t *pool, const LString::Part *part) {
123
131
  LString::Part *copy = (LString::Part *) psg_palloc(pool, sizeof(LString::Part));
132
+ if (copy == NULL) {
133
+ TRACE_POINT();
134
+ throw std::bad_alloc();
135
+ }
124
136
  *copy = *part;
125
137
  if (part->mbuf_block != NULL) {
126
138
  mbuf_block_ref(part->mbuf_block);
@@ -136,6 +148,10 @@ psg_lstr_append(LString *str, psg_pool_t *pool, const MemoryKit::mbuf &buffer,
136
148
  return;
137
149
  }
138
150
  LString::Part *part = (LString::Part *) psg_palloc(pool, sizeof(LString::Part));
151
+ if (part == NULL) {
152
+ TRACE_POINT();
153
+ throw std::bad_alloc();
154
+ }
139
155
  part->mbuf_block = buffer.mbuf_block;
140
156
  part->data = data;
141
157
  part->size = size;
@@ -154,6 +170,10 @@ psg_lstr_append(LString *str, psg_pool_t *pool, const char *data, unsigned int s
154
170
  return;
155
171
  }
156
172
  LString::Part *part = (LString::Part *) psg_palloc(pool, sizeof(LString::Part));
173
+ if (part == NULL) {
174
+ TRACE_POINT();
175
+ throw std::bad_alloc();
176
+ }
157
177
  part->next = NULL;
158
178
  part->mbuf_block = NULL;
159
179
  part->data = data;
@@ -173,6 +193,11 @@ psg_lstr_null_terminate(const LString *str, psg_pool_t *pool) {
173
193
  char *data, *pos;
174
194
 
175
195
  data = (char *) psg_pnalloc(pool, str->size + 1);
196
+ if (data == NULL) {
197
+ TRACE_POINT();
198
+ throw std::bad_alloc();
199
+ }
200
+
176
201
  pos = data;
177
202
  part = str->start;
178
203
  while (part != NULL) {
@@ -183,6 +208,10 @@ psg_lstr_null_terminate(const LString *str, psg_pool_t *pool) {
183
208
  *pos = '\0';
184
209
 
185
210
  newstr = (LString *) psg_palloc(pool, sizeof(LString));
211
+ if (newstr == NULL) {
212
+ TRACE_POINT();
213
+ throw std::bad_alloc();
214
+ }
186
215
  psg_lstr_init(newstr);
187
216
  psg_lstr_append(newstr, pool, data, str->size);
188
217
  return newstr;
@@ -139,7 +139,9 @@ public:
139
139
  int e = errno;
140
140
  data = boost::make_shared<SharedData>(fd, autoClose);
141
141
  errno = e;
142
- P_LOG_FILE_DESCRIPTOR_OPEN3(fd, file, line);
142
+ if (file != NULL) {
143
+ P_LOG_FILE_DESCRIPTOR_OPEN3(fd, file, line);
144
+ }
143
145
  }
144
146
  }
145
147
 
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Phusion Passenger - https://www.phusionpassenger.com/
3
+ * Copyright (c) 2016 Phusion Holding B.V.
4
+ *
5
+ * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
+ * trademarks of Phusion Holding B.V.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+ #ifndef _PASSENGER_LIBEV_JSON_UTILS_H_
27
+ #define _PASSENGER_LIBEV_JSON_UTILS_H_
28
+
29
+ #include <ev.h>
30
+ #include <jsoncpp/json.h>
31
+ #include <cstring>
32
+ #include <ctime>
33
+ #include <Utils/StrIntUtils.h>
34
+ #include <Utils/SystemTime.h>
35
+
36
+ namespace Passenger {
37
+
38
+ using namespace std;
39
+
40
+
41
+ /**
42
+ * Encodes the given libev timestamp into a JSON object that
43
+ * describes it.
44
+ *
45
+ * evTimeToJson(ev_now(loop) - 10);
46
+ * // {
47
+ * // "timestamp": 1424887842,
48
+ * // "local": "Wed Feb 25 19:10:34 CET 2015",
49
+ * // "relative_timestamp": -10,
50
+ * // "relative": "10s ago"
51
+ * // }
52
+ */
53
+ inline Json::Value
54
+ evTimeToJson(ev_tstamp evTime, ev_tstamp evNow, unsigned long long now = 0) {
55
+ if (evTime <= 0) {
56
+ return Json::Value(Json::nullValue);
57
+ }
58
+
59
+ if (now == 0) {
60
+ now = SystemTime::getUsec();
61
+ }
62
+
63
+ Json::Value doc;
64
+ unsigned long long wallClockTimeUsec = now
65
+ + (evTime - evNow) * 1000000ull;
66
+ time_t wallClockTime = (time_t) (wallClockTimeUsec / 1000000ull);
67
+ char buf[32];
68
+ size_t len;
69
+
70
+ ctime_r(&wallClockTime, buf);
71
+ len = strlen(buf);
72
+ if (len > 0) {
73
+ // Get rid of trailing newline
74
+ buf[len - 1] = '\0';
75
+ }
76
+
77
+ doc["timestamp"] = wallClockTimeUsec / 1000000.0;
78
+ doc["local"] = buf;
79
+
80
+ doc["relative_timestamp"] = evTime - evNow;
81
+ if (evTime > evNow) {
82
+ doc["relative"] = distanceOfTimeInWords(evTime, evNow) + " from now";
83
+ } else {
84
+ doc["relative"] = distanceOfTimeInWords(evTime, evNow) + " ago";
85
+ }
86
+ return doc;
87
+ }
88
+
89
+
90
+ } // namespace Passenger
91
+
92
+ #endif /* _PASSENGER_LIBEV_JSON_UTILS_H_ */
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010-2015 Phusion Holding B.V.
3
+ * Copyright (c) 2010-2016 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -52,7 +52,7 @@ using namespace boost;
52
52
  */
53
53
  class ResourceLocator {
54
54
  private:
55
- string root;
55
+ string installSpec;
56
56
  string binDir;
57
57
  string supportBinariesDir;
58
58
  string helperScriptsDir;
@@ -81,9 +81,11 @@ private:
81
81
  public:
82
82
  ResourceLocator() { }
83
83
 
84
- ResourceLocator(const string &installSpec) {
85
- if (getFileType(installSpec) == FT_REGULAR) {
86
- const string &file = installSpec;
84
+ ResourceLocator(const string &_installSpec)
85
+ : installSpec(_installSpec)
86
+ {
87
+ if (getFileType(_installSpec) == FT_REGULAR) {
88
+ const string &file = _installSpec;
87
89
  IniFileSectionPtr options = IniFile(file).section("locations");
88
90
  binDir = getOption(file, options, "bin_dir");
89
91
  supportBinariesDir = getOption(file, options, "support_binaries_dir");
@@ -94,7 +96,7 @@ public:
94
96
  nodeLibDir = getOption(file, options, "node_libdir");
95
97
  buildSystemDir = getOptionalSection(file, options, "node_libdir");
96
98
  } else {
97
- const string &root = installSpec;
99
+ const string &root = _installSpec;
98
100
  binDir = root + "/bin";
99
101
  supportBinariesDir = root + "/buildout/support-binaries";
100
102
  helperScriptsDir = root + "/src/helper-scripts";
@@ -106,8 +108,8 @@ public:
106
108
  }
107
109
  }
108
110
 
109
- const string &getRoot() const {
110
- return root;
111
+ const string &getInstallSpec() const {
112
+ return installSpec;
111
113
  }
112
114
 
113
115
  const string &getBinDir() const {
@@ -59,6 +59,10 @@ findCookie(psg_pool_t *pool, const LString *cookieHeaderValue, const LString *na
59
59
  bool done = part == NULL;
60
60
  LString *result = NULL;
61
61
 
62
+ if (cookieHeaderValue->size == 0) {
63
+ return NULL;
64
+ }
65
+
62
66
  while (!done) {
63
67
  if (findCookieNameValueSeparator(part, index, &separatorPart, &separatorIndex)) {
64
68
  if (!findCookieEnd(separatorPart, separatorIndex, &endPart, &endIndex)) {
@@ -1028,6 +1028,7 @@ private:
1028
1028
 
1029
1029
  if (req->result == UV_ECANCELED) {
1030
1030
  uv_fs_req_cleanup(req);
1031
+ free(req);
1031
1032
  delete fcContext;
1032
1033
  return;
1033
1034
  }
@@ -1042,6 +1043,7 @@ private:
1042
1043
  }
1043
1044
 
1044
1045
  uv_fs_req_cleanup(req);
1046
+ free(req);
1045
1047
  delete fcContext;
1046
1048
  }
1047
1049
 
@@ -43,6 +43,7 @@
43
43
  #include <ServerKit/HttpHeaderParser.h>
44
44
  #include <ServerKit/HttpChunkedBodyParser.h>
45
45
  #include <Algorithms/MovingAverage.h>
46
+ #include <Integrations/LibevJsonUtils.h>
46
47
  #include <Utils/SystemTime.h>
47
48
  #include <Utils/StrIntUtils.h>
48
49
  #include <Utils/HttpConstants.h>
@@ -1227,6 +1228,9 @@ public:
1227
1228
  doc["http_state"] = req->getHttpStateString();
1228
1229
 
1229
1230
  if (req->begun()) {
1231
+ ev_tstamp evNow = ev_now(this->getLoop());
1232
+ unsigned long long now = SystemTime::getUsec();
1233
+
1230
1234
  doc["http_major"] = req->httpMajor;
1231
1235
  doc["http_minor"] = req->httpMinor;
1232
1236
  doc["want_keep_alive"] = req->wantKeepAlive;
@@ -1234,8 +1238,8 @@ public:
1234
1238
  doc["request_body_fully_read"] = req->bodyFullyRead();
1235
1239
  doc["request_body_already_read"] = (Json::Value::UInt64) req->bodyAlreadyRead;
1236
1240
  doc["response_begun"] = req->responseBegun;
1237
- doc["last_data_receive_time"] = timeToJson(req->lastDataReceiveTime * 1000000);
1238
- doc["last_data_send_time"] = timeToJson(req->lastDataSendTime * 1000000);
1241
+ doc["last_data_receive_time"] = evTimeToJson(req->lastDataReceiveTime, evNow, now);
1242
+ doc["last_data_send_time"] = evTimeToJson(req->lastDataSendTime, evNow, now);
1239
1243
  doc["method"] = http_method_str(req->method);
1240
1244
  if (req->httpState != Request::ERROR) {
1241
1245
  if (req->bodyType == Request::RBT_CONTENT_LENGTH) {