passenger 5.0.30 → 5.1.0

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 (131) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +30 -1
  3. data/CONTRIBUTING.md +1 -1
  4. data/CONTRIBUTORS +2 -0
  5. data/bin/passenger-install-nginx-module +18 -13
  6. data/build/agent.rb +1 -0
  7. data/build/basics.rb +1 -0
  8. data/build/cxx_tests.rb +6 -1
  9. data/build/misc.rb +3 -0
  10. data/build/packaging.rb +5 -17
  11. data/build/support/cxx_dependency_map.rb +100 -0
  12. data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb +4 -1
  13. data/build/test_basics.rb +12 -2
  14. data/dev/ci/run_travis.sh +6 -2
  15. data/doc/Users guide Apache.html +7 -2
  16. data/doc/Users guide Apache.txt +4 -0
  17. data/resources/templates/error_layout.css +70 -84
  18. data/resources/templates/error_layout.html.template +84 -93
  19. data/resources/templates/standalone/http.erb +17 -13
  20. data/resources/templates/standalone/server.erb +2 -1
  21. data/resources/templates/undisclosed_error.html.template +52 -51
  22. data/resources/update_check_client_cert.p12 +0 -0
  23. data/resources/update_check_client_cert.pem +89 -0
  24. data/resources/update_check_server_pubkey.pem +14 -0
  25. data/src/agent/Core/ApplicationPool/ErrorRenderer.h +15 -1
  26. data/src/agent/Core/Controller.h +3 -2
  27. data/src/agent/Core/Controller/CheckoutSession.cpp +5 -4
  28. data/src/agent/Core/Controller/ForwardResponse.cpp +1 -1
  29. data/src/agent/Core/Controller/InitRequest.cpp +2 -0
  30. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +1 -0
  31. data/src/agent/Core/Controller/Request.h +1 -0
  32. data/src/agent/Core/CoreMain.cpp +99 -2
  33. data/src/agent/Core/OptionParser.h +18 -1
  34. data/src/agent/Core/SecurityUpdateChecker.h +559 -0
  35. data/src/agent/Shared/Base.cpp +6 -1
  36. data/src/agent/TempDirToucher/TempDirToucherMain.cpp +52 -0
  37. data/src/agent/Watchdog/InstanceDirToucher.cpp +1 -2
  38. data/src/agent/Watchdog/WatchdogMain.cpp +31 -40
  39. data/src/apache2_module/Configuration.cpp +12 -0
  40. data/src/apache2_module/Configuration.hpp +5 -0
  41. data/src/apache2_module/ConfigurationCommands.cpp +19 -19
  42. data/src/apache2_module/ConfigurationCommands.cpp.cxxcodebuilder +2 -2
  43. data/src/apache2_module/ConfigurationFields.hpp +19 -19
  44. data/src/apache2_module/ConfigurationFields.hpp.cxxcodebuilder +2 -2
  45. data/src/apache2_module/ConfigurationSetters.cpp +19 -19
  46. data/src/apache2_module/ConfigurationSetters.cpp.cxxcodebuilder +2 -2
  47. data/src/apache2_module/CreateDirConfig.cpp +19 -19
  48. data/src/apache2_module/CreateDirConfig.cpp.cxxcodebuilder +2 -2
  49. data/src/apache2_module/Hooks.cpp +10 -1
  50. data/src/apache2_module/MergeDirConfig.cpp +19 -19
  51. data/src/apache2_module/MergeDirConfig.cpp.cxxcodebuilder +2 -2
  52. data/src/apache2_module/SetHeaders.cpp +19 -19
  53. data/src/apache2_module/SetHeaders.cpp.cxxcodebuilder +2 -2
  54. data/src/cxx_supportlib/Constants.h +22 -22
  55. data/src/cxx_supportlib/Constants.h.cxxcodebuilder +4 -1
  56. data/src/cxx_supportlib/Crypto.cpp +977 -0
  57. data/src/cxx_supportlib/Crypto.h +147 -0
  58. data/src/cxx_supportlib/InstanceDirectory.h +55 -2
  59. data/src/cxx_supportlib/Utils/Curl.h +24 -10
  60. data/src/cxx_supportlib/Utils/JsonUtils.h +1 -1
  61. data/src/cxx_supportlib/oxt/detail/spin_lock_darwin.hpp +2 -0
  62. data/src/cxx_supportlib/vendor-modified/boost/system/error_code.hpp +3 -3
  63. data/src/cxx_supportlib/vendor-modified/jsoncpp/json-forwards.h +167 -92
  64. data/src/cxx_supportlib/vendor-modified/jsoncpp/json.h +1827 -1542
  65. data/src/cxx_supportlib/vendor-modified/jsoncpp/jsoncpp.cpp +4705 -3652
  66. data/src/cxx_supportlib/vendor-modified/libev/Changes +46 -15
  67. data/src/cxx_supportlib/vendor-modified/libev/LICENSE +1 -1
  68. data/src/cxx_supportlib/vendor-modified/libev/Makefile.in +215 -128
  69. data/src/cxx_supportlib/vendor-modified/libev/aclocal.m4 +466 -275
  70. data/src/cxx_supportlib/vendor-modified/libev/config.guess +312 -418
  71. data/src/cxx_supportlib/vendor-modified/libev/config.sub +246 -105
  72. data/src/cxx_supportlib/vendor-modified/libev/configure +276 -72
  73. data/src/cxx_supportlib/vendor-modified/libev/configure.ac +2 -1
  74. data/src/cxx_supportlib/vendor-modified/libev/depcomp +346 -185
  75. data/src/cxx_supportlib/vendor-modified/libev/ev++.h +1 -1
  76. data/src/cxx_supportlib/vendor-modified/libev/ev.c +530 -190
  77. data/src/cxx_supportlib/vendor-modified/libev/ev.h +23 -14
  78. data/src/cxx_supportlib/vendor-modified/libev/ev_epoll.c +12 -6
  79. data/src/cxx_supportlib/vendor-modified/libev/ev_kqueue.c +9 -5
  80. data/src/cxx_supportlib/vendor-modified/libev/ev_poll.c +6 -3
  81. data/src/cxx_supportlib/vendor-modified/libev/ev_port.c +8 -4
  82. data/src/cxx_supportlib/vendor-modified/libev/ev_select.c +4 -2
  83. data/src/cxx_supportlib/vendor-modified/libev/ev_vars.h +3 -2
  84. data/src/cxx_supportlib/vendor-modified/libev/ev_win32.c +3 -4
  85. data/src/cxx_supportlib/vendor-modified/libev/install-sh +433 -219
  86. data/src/cxx_supportlib/vendor-modified/libev/libev.m4 +6 -6
  87. data/src/cxx_supportlib/vendor-modified/libev/ltmain.sh +2 -2
  88. data/src/cxx_supportlib/vendor-modified/libev/missing +167 -288
  89. data/src/cxx_supportlib/vendor-modified/libev/mkinstalldirs +72 -21
  90. data/src/cxx_supportlib/vendor-modified/modp_b64.cpp +4 -106
  91. data/src/cxx_supportlib/vendor-modified/modp_b64_data.h +37 -1
  92. data/src/cxx_supportlib/vendor-modified/modp_b64_strict_aliasing.cpp +119 -0
  93. data/src/helper-scripts/node-loader.js +72 -1
  94. data/src/nginx_module/CacheLocationConfig.c +52 -19
  95. data/src/nginx_module/CacheLocationConfig.c.cxxcodebuilder +2 -2
  96. data/src/nginx_module/Configuration.c +26 -1
  97. data/src/nginx_module/Configuration.h +2 -0
  98. data/src/nginx_module/ConfigurationCommands.c +35 -19
  99. data/src/nginx_module/ConfigurationCommands.c.cxxcodebuilder +2 -2
  100. data/src/nginx_module/ContentHandler.c +1 -1
  101. data/src/nginx_module/CreateLocationConfig.c +22 -19
  102. data/src/nginx_module/CreateLocationConfig.c.cxxcodebuilder +2 -2
  103. data/src/nginx_module/LocationConfig.h +21 -19
  104. data/src/nginx_module/LocationConfig.h.cxxcodebuilder +2 -2
  105. data/src/nginx_module/MergeLocationConfig.c +25 -19
  106. data/src/nginx_module/MergeLocationConfig.c.cxxcodebuilder +2 -2
  107. data/src/nginx_module/ngx_http_passenger_module.c +8 -4
  108. data/src/ruby_supportlib/phusion_passenger.rb +9 -4
  109. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +2 -2
  110. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance_registry.rb +1 -1
  111. data/src/ruby_supportlib/phusion_passenger/common_library.rb +13 -0
  112. data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +5 -2
  113. data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -1
  114. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +15 -3
  115. data/src/ruby_supportlib/phusion_passenger/platform_info/crypto.rb +51 -0
  116. data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +7 -0
  117. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +17 -0
  118. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +4 -2
  119. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +4 -0
  120. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +5 -0
  121. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/app.rb +19 -10
  122. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/base.rb +25 -0
  123. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/gdb_controller.rb +38 -103
  124. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/lldb_controller.rb +178 -0
  125. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/utils.rb +94 -0
  126. data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/version.rb +2 -2
  127. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +2 -2
  128. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +2 -2
  129. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +5 -3
  130. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +9 -7
  131. metadata +14 -4
@@ -0,0 +1,147 @@
1
+ /*
2
+ * Phusion Passenger - https://www.phusionpassenger.com/
3
+ * Copyright (c) 2010-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_CRYPTO_H_
27
+ #define _PASSENGER_CRYPTO_H_
28
+
29
+ #include <boost/function.hpp>
30
+ #include <boost/thread.hpp>
31
+ #include <modp_b64.h>
32
+
33
+ #if BOOST_OS_MACOS
34
+ #include <CoreFoundation/CoreFoundation.h>
35
+ #include <Security/Security.h>
36
+ #else
37
+ #include <openssl/pem.h>
38
+ #include <openssl/rand.h>
39
+ #include <openssl/err.h>
40
+ #endif
41
+
42
+ #include <StaticString.h>
43
+
44
+ namespace Passenger {
45
+
46
+ #if BOOST_OS_MACOS
47
+ typedef SecKeyRef PUBKEY_TYPE;
48
+ #else
49
+ typedef RSA* PUBKEY_TYPE;
50
+ #endif
51
+
52
+ using namespace std;
53
+ using namespace boost;
54
+ using namespace oxt;
55
+
56
+ struct AESEncResult {
57
+ unsigned char *encrypted;
58
+ size_t encryptedLen;
59
+ unsigned char *key;
60
+ size_t keyLen;
61
+ unsigned char *iv;
62
+ size_t ivLen;
63
+ };
64
+
65
+ class Crypto {
66
+ private:
67
+ /**
68
+ * @returns new PUBKEY_TYPE; user is responsible for free (with freePubKey)
69
+ */
70
+ PUBKEY_TYPE loadPubKey(const char *filename);
71
+
72
+ /**
73
+ * free a PUBKEY_TYPE (loaded with loadPubKey); may be NULL
74
+ */
75
+ void freePubKey(PUBKEY_TYPE);
76
+
77
+ void logError(const StaticString &error);
78
+
79
+ /**
80
+ * log prefix using P_ERROR, and (library-specific) detail from either additional or global query
81
+ */
82
+ #if BOOST_OS_MACOS
83
+ // (additional needs to be defined as a CFErrorRef, void * won't work)
84
+ void logFreeErrorExtended(const StaticString &prefix, CFErrorRef &additional);
85
+ CFDictionaryRef createQueryDict(const char *label);
86
+ SecAccessRef createAccess(const char *cLabel);
87
+ OSStatus lookupKeychainItem(const char *label, SecIdentityRef *oIdentity);
88
+ OSStatus copyIdentityFromPKCS12File(const char *cPath, const char *cPassword, const char *cLabel);
89
+ CFDataRef genIV(size_t iv_size);
90
+ bool getKeyBytes(SecKeyRef cryptokey, void **target, size_t &len);
91
+ bool generateRandomChars(unsigned char *rndChars, int rndLen);
92
+ bool memoryBridge(CFDataRef input, void **target, size_t &len);
93
+ bool innerMemoryBridge(void *input, void **target, size_t len);
94
+ #else
95
+ void logErrorExtended(const StaticString &prefix);
96
+ #endif
97
+
98
+ public:
99
+ Crypto();
100
+ ~Crypto();
101
+
102
+ /**
103
+ * Generates a nonce consisting of a timestamp (usec) and a random (base64) part.
104
+ */
105
+ bool generateAndAppendNonce(string &nonce);
106
+
107
+ #if BOOST_OS_MACOS
108
+ /**
109
+ * sets the permissions on the certificate so that curl doesn't prompt
110
+ */
111
+ bool preAuthKey(const char *path, const char *passwd, const char *cLabel);
112
+ void killKey(const char *cLabel);
113
+ #endif
114
+
115
+ /**
116
+ * Generate an AES key and encrypt dataChars with it. The resulting encrypted characters, together with the AES key
117
+ * and iv that were used appears in AESEncrypted. Memory is allocated for it, and it must be freed with freeAESEncrypted().
118
+ *
119
+ * N.B. only used in Enterprise (to enable additional services), but open sourced for transparency.
120
+ */
121
+ bool encryptAES256(char *dataChars, size_t dataLen, AESEncResult &aesEnc);
122
+
123
+ /**
124
+ * Releases resources returned by encryptAES256().
125
+ */
126
+ void freeAESEncrypted(AESEncResult &aesEnc);
127
+
128
+ /**
129
+ * Encrypt a (short) bit of date with specified public key. Memory is allocated for the result encryptedCharsPtr, which
130
+ * must be free()d manually.
131
+ *
132
+ * N.B. only used in Enterprise (to enable additional services), but open sourced for transparency.
133
+ */
134
+ bool encryptRSA(unsigned char *dataChars, size_t dataLen,
135
+ string encryptPubKeyPath, unsigned char **encryptedCharsPtr, size_t &encryptedLen);
136
+
137
+ /**
138
+ * @returns true if specified signature is from the entity known by its (public) key at signaturePubKeyPath,
139
+ * and valid for speficied data.
140
+ */
141
+ bool verifySignature(string signaturePubKeyPath, char *signatureChars, int signatureLen, string data);
142
+
143
+ };
144
+
145
+ } // namespace Passenger
146
+
147
+ #endif /* _PASSENGER_CRYPTO_H_ */
@@ -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.
@@ -26,6 +26,10 @@
26
26
  #ifndef _PASSENGER_INSTANCE_DIRECTORY_H_
27
27
  #define _PASSENGER_INSTANCE_DIRECTORY_H_
28
28
 
29
+ #ifdef USE_SELINUX
30
+ #include <selinux/selinux.h>
31
+ #endif
32
+
29
33
  #include <boost/shared_ptr.hpp>
30
34
  #include <sys/types.h>
31
35
  #include <sys/stat.h>
@@ -111,6 +115,7 @@ private:
111
115
 
112
116
  void initializeInstanceDirectory(const CreationOptions &options) {
113
117
  createPropertyFile(options);
118
+ createWebServerInfoSubdir(options);
114
119
  createAgentSocketsSubdir(options);
115
120
  createAppSocketsSubdir(options);
116
121
  createLockFile();
@@ -120,6 +125,54 @@ private:
120
125
  return options.originalUid == 0;
121
126
  }
122
127
 
128
+ #ifdef USE_SELINUX
129
+ void selinuxRelabel(const string &path, const char *newLabel) {
130
+ security_context_t currentCon;
131
+ string newCon;
132
+ int e;
133
+
134
+ if (getfilecon(path.c_str(), &currentCon) == -1) {
135
+ e = errno;
136
+ P_DEBUG("Unable to obtain SELinux context for file " <<
137
+ path <<": " << strerror(e) << " (errno=" << e << ")");
138
+ return;
139
+ }
140
+
141
+ P_DEBUG("SELinux context for " << path << ": " << currentCon);
142
+
143
+ if (strstr(currentCon, ":object_r:passenger_instance_content_t:") == NULL) {
144
+ goto cleanup;
145
+ }
146
+
147
+ newCon = replaceString(currentCon,
148
+ ":object_r:passenger_instance_content_t:",
149
+ StaticString(":object_r:") + newLabel + ":");
150
+ P_DEBUG("Relabeling " << path << " to: " << newCon);
151
+ if (setfilecon(path.c_str(), (security_context_t) newCon.c_str()) == -1) {
152
+ e = errno;
153
+ P_WARN("Cannot set SELinux context for " << path <<
154
+ " to " << newCon << ": " << strerror(e) <<
155
+ " (errno=" << e << ")");
156
+ goto cleanup;
157
+ }
158
+
159
+ cleanup:
160
+ freecon(currentCon);
161
+ }
162
+ #endif
163
+
164
+ void createWebServerInfoSubdir(const CreationOptions &options) {
165
+ makeDirTree(path + "/web_server_info", "u=rwx,g=rx,o=rx");
166
+ #ifdef USE_SELINUX
167
+ // We relabel the directory here instead of using setfscreatecon()
168
+ // for thread-safety. It isn't specified whether InstanceDirectory
169
+ // should be thread-safe, but let's do it this way to prevent
170
+ // future problems.
171
+ selinuxRelabel(path + "/web_server_info",
172
+ "passenger_instance_httpd_dir_t");
173
+ #endif
174
+ }
175
+
123
176
  void createAgentSocketsSubdir(const CreationOptions &options) {
124
177
  if (runningAsRoot(options)) {
125
178
  /* The server socket must be accessible by the web server
@@ -166,7 +219,7 @@ private:
166
219
 
167
220
  props["instance_dir"]["major_version"] = SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION;
168
221
  props["instance_dir"]["minor_version"] = SERVER_INSTANCE_DIR_STRUCTURE_MINOR_VERSION;
169
- props["instance_dir"]["created_at"] = (long long) time(NULL);
222
+ props["instance_dir"]["created_at"] = (Json::Int64) time(NULL);
170
223
  props["passenger_version"] = PASSENGER_VERSION;
171
224
  props["watchdog_pid"] = (Json::UInt64) getpid();
172
225
 
@@ -70,21 +70,24 @@ struct CurlProxyInfo {
70
70
  long type;
71
71
  bool none;
72
72
  bool httpTunnel;
73
+ bool valid; // false if an error occurred during address parsing
73
74
 
74
- CurlProxyInfo()
75
+ CurlProxyInfo(bool valid = false)
75
76
  : type(0),
76
77
  none(false),
77
- httpTunnel(false)
78
+ httpTunnel(false),
79
+ valid(valid)
78
80
  { }
79
81
  };
80
82
 
81
83
  inline const CurlProxyInfo
82
84
  prepareCurlProxy(const string &address) {
83
85
  if (address.empty()) {
84
- return CurlProxyInfo();
86
+ return CurlProxyInfo(true);
85
87
  } else if (address == "none") {
86
88
  CurlProxyInfo result;
87
89
  result.none = true;
90
+ result.valid = true;
88
91
  return result;
89
92
  } else {
90
93
  CurlProxyInfo result;
@@ -164,23 +167,34 @@ prepareCurlProxy(const string &address) {
164
167
  }
165
168
  }
166
169
 
170
+ result.valid = true;
167
171
  return result;
168
172
  }
169
173
  }
170
174
 
171
- inline void
175
+ inline CURLcode
172
176
  setCurlProxy(CURL *curl, const CurlProxyInfo &proxyInfo) {
173
177
  if (proxyInfo.hostAndPort.empty()) {
174
- return;
178
+ return CURLE_OK;
175
179
  } else if (proxyInfo.none) {
176
- curl_easy_setopt(curl, CURLOPT_PROXY, "");
180
+ return curl_easy_setopt(curl, CURLOPT_PROXY, "");
177
181
  } else {
178
- curl_easy_setopt(curl, CURLOPT_PROXY, proxyInfo.hostAndPort.c_str());
179
- curl_easy_setopt(curl, CURLOPT_PROXYTYPE, proxyInfo.type);
180
- curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, proxyInfo.credentials.c_str());
182
+ CURLcode code;
183
+ if (CURLE_OK != (code = curl_easy_setopt(curl, CURLOPT_PROXY, proxyInfo.hostAndPort.c_str()))) {
184
+ return code;
185
+ }
186
+ if (CURLE_OK != (code = curl_easy_setopt(curl, CURLOPT_PROXYTYPE, proxyInfo.type))) {
187
+ return code;
188
+ }
189
+ if (CURLE_OK != (code = curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, proxyInfo.credentials.c_str()))) {
190
+ return code;
191
+ }
181
192
  if (proxyInfo.httpTunnel) {
182
- curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1);
193
+ if (CURLE_OK != (code = curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1))) {
194
+ return code;
195
+ }
183
196
  }
197
+ return CURLE_OK;
184
198
  }
185
199
  }
186
200
 
@@ -241,7 +241,7 @@ durationToJson(unsigned long long duration) {
241
241
  Json::Value doc;
242
242
  char buf[64];
243
243
 
244
- doc["microseconds"] = duration;
244
+ doc["microseconds"] = (Json::UInt64) duration;
245
245
  if (duration >= 10 * 1000000) {
246
246
  snprintf(buf, sizeof(buf), "%.1fs", duration / 1000000.0);
247
247
  } else {
@@ -23,6 +23,8 @@
23
23
  * THE SOFTWARE.
24
24
  */
25
25
 
26
+ #define OSSPINLOCK_DEPRECATED 0
27
+
26
28
  #include <libkern/OSAtomic.h>
27
29
  #include <boost/noncopyable.hpp>
28
30
 
@@ -218,9 +218,9 @@ namespace boost
218
218
  inline const error_category & get_system_category() { return system_category(); }
219
219
  inline const error_category & get_generic_category() { return generic_category(); }
220
220
  inline const error_category & get_posix_category() { return generic_category(); }
221
- static const error_category & posix_category = generic_category();
222
- static const error_category & errno_ecat = generic_category();
223
- static const error_category & native_ecat = system_category();
221
+ //static const error_category & posix_category = generic_category();
222
+ //static const error_category & errno_ecat = generic_category();
223
+ //static const error_category & native_ecat = system_category();
224
224
  # endif
225
225
 
226
226
  // class error_condition -----------------------------------------------//
@@ -1,5 +1,5 @@
1
1
  /// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).
2
- /// It is intented to be used with #include <json/json-forwards.h>
2
+ /// It is intended to be used with #include "json/json-forwards.h"
3
3
  /// This header provides forward declaration for all JsonCpp types.
4
4
 
5
5
  // //////////////////////////////////////////////////////////////////////
@@ -77,7 +77,7 @@ license you like.
77
77
  # define JSON_FORWARD_AMALGATED_H_INCLUDED
78
78
  /// If defined, indicates that the source file is amalgated
79
79
  /// to prevent private header inclusion.
80
- #define JSON_IS_AMALGATED
80
+ #define JSON_IS_AMALGAMATION
81
81
 
82
82
  // //////////////////////////////////////////////////////////////////////
83
83
  // Beginning of content of file: include/json/config.h
@@ -89,95 +89,177 @@ license you like.
89
89
  // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
90
90
 
91
91
  #ifndef JSON_CONFIG_H_INCLUDED
92
- # define JSON_CONFIG_H_INCLUDED
92
+ #define JSON_CONFIG_H_INCLUDED
93
+ #include <stddef.h>
94
+ #include <string> //typedef String
95
+ #include <stdint.h> //typedef int64_t, uint64_t
93
96
 
94
97
  /// If defined, indicates that json library is embedded in CppTL library.
95
98
  //# define JSON_IN_CPPTL 1
96
99
 
97
100
  /// If defined, indicates that json may leverage CppTL library
98
101
  //# define JSON_USE_CPPTL 1
99
- /// If defined, indicates that cpptl vector based map should be used instead of std::map
102
+ /// If defined, indicates that cpptl vector based map should be used instead of
103
+ /// std::map
100
104
  /// as Value container.
101
105
  //# define JSON_USE_CPPTL_SMALLMAP 1
102
- /// If defined, indicates that Json specific container should be used
103
- /// (hash table & simple deque container with customizable allocator).
104
- /// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332
105
- //# define JSON_VALUE_USE_INTERNAL_MAP 1
106
- /// Force usage of standard new/malloc based allocator instead of memory pool based allocator.
107
- /// The memory pools allocator used optimization (initializing Value and ValueInternalLink
108
- /// as if it was a POD) that may cause some validation tool to report errors.
109
- /// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined.
110
- //# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1
111
-
112
- /// If defined, indicates that Json use exception to report invalid type manipulation
113
- /// instead of C assert macro.
114
- # define JSON_USE_EXCEPTION 1
106
+
107
+ // If non-zero, the library uses exceptions to report bad input instead of C
108
+ // assertion macros. The default is to use exceptions.
109
+ #ifndef JSON_USE_EXCEPTION
110
+ #define JSON_USE_EXCEPTION 1
111
+ #endif
115
112
 
116
113
  /// If defined, indicates that the source file is amalgated
117
114
  /// to prevent private header inclusion.
118
115
  /// Remarks: it is automatically defined in the generated amalgated header.
119
- #define JSON_IS_AMALGAMATION
120
-
116
+ // #define JSON_IS_AMALGAMATION
121
117
 
122
- # ifdef JSON_IN_CPPTL
123
- # include <cpptl/config.h>
124
- # ifndef JSON_USE_CPPTL
125
- # define JSON_USE_CPPTL 1
126
- # endif
127
- # endif
118
+ #ifdef JSON_IN_CPPTL
119
+ #include <cpptl/config.h>
120
+ #ifndef JSON_USE_CPPTL
121
+ #define JSON_USE_CPPTL 1
122
+ #endif
123
+ #endif
128
124
 
129
- # ifdef JSON_IN_CPPTL
130
- # define JSON_API CPPTL_API
131
- # elif defined(JSON_DLL_BUILD)
132
- # define JSON_API __declspec(dllexport)
133
- # elif defined(JSON_DLL)
134
- # define JSON_API __declspec(dllimport)
135
- # else
136
- # define JSON_API
137
- # endif
125
+ #ifdef JSON_IN_CPPTL
126
+ #define JSON_API CPPTL_API
127
+ #elif defined(JSON_DLL_BUILD)
128
+ #if defined(_MSC_VER) || defined(__MINGW32__)
129
+ #define JSON_API __declspec(dllexport)
130
+ #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
131
+ #endif // if defined(_MSC_VER)
132
+ #elif defined(JSON_DLL)
133
+ #if defined(_MSC_VER) || defined(__MINGW32__)
134
+ #define JSON_API __declspec(dllimport)
135
+ #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
136
+ #endif // if defined(_MSC_VER)
137
+ #endif // ifdef JSON_IN_CPPTL
138
+ #if !defined(JSON_API)
139
+ #define JSON_API
140
+ #endif
138
141
 
139
- // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for integer
142
+ // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
143
+ // integer
140
144
  // Storages, and 64 bits integer support is disabled.
141
145
  // #define JSON_NO_INT64 1
142
146
 
143
- #if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6
144
- // Microsoft Visual Studio 6 only support conversion from __int64 to double
145
- // (no conversion from unsigned __int64).
146
- #define JSON_USE_INT64_DOUBLE_CONVERSION 1
147
- #endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6
147
+ #if defined(_MSC_VER) // MSVC
148
+ # if _MSC_VER <= 1200 // MSVC 6
149
+ // Microsoft Visual Studio 6 only support conversion from __int64 to double
150
+ // (no conversion from unsigned __int64).
151
+ # define JSON_USE_INT64_DOUBLE_CONVERSION 1
152
+ // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
153
+ // characters in the debug information)
154
+ // All projects I've ever seen with VS6 were using this globally (not bothering
155
+ // with pragma push/pop).
156
+ # pragma warning(disable : 4786)
157
+ # endif // MSVC 6
158
+
159
+ # if _MSC_VER >= 1500 // MSVC 2008
160
+ /// Indicates that the following function is deprecated.
161
+ # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
162
+ # endif
148
163
 
149
- #if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
150
- /// Indicates that the following function is deprecated.
151
- # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
164
+ #endif // defined(_MSC_VER)
165
+
166
+ // In c++11 the override keyword allows you to explicity define that a function
167
+ // is intended to override the base-class version. This makes the code more
168
+ // managable and fixes a set of common hard-to-find bugs.
169
+ #if __cplusplus >= 201103L
170
+ # define JSONCPP_OVERRIDE override
171
+ #elif defined(_MSC_VER) && _MSC_VER > 1600
172
+ # define JSONCPP_OVERRIDE override
173
+ #else
174
+ # define JSONCPP_OVERRIDE
152
175
  #endif
153
176
 
177
+ #ifndef JSON_HAS_RVALUE_REFERENCES
178
+
179
+ #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
180
+ #define JSON_HAS_RVALUE_REFERENCES 1
181
+ #endif // MSVC >= 2010
182
+
183
+ #ifdef __clang__
184
+ #if __has_feature(cxx_rvalue_references)
185
+ #define JSON_HAS_RVALUE_REFERENCES 1
186
+ #endif // has_feature
187
+
188
+ #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
189
+ #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
190
+ #define JSON_HAS_RVALUE_REFERENCES 1
191
+ #endif // GXX_EXPERIMENTAL
192
+
193
+ #endif // __clang__ || __GNUC__
194
+
195
+ #endif // not defined JSON_HAS_RVALUE_REFERENCES
196
+
197
+ #ifndef JSON_HAS_RVALUE_REFERENCES
198
+ #define JSON_HAS_RVALUE_REFERENCES 0
199
+ #endif
200
+
201
+ #ifdef __clang__
202
+ #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
203
+ # if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
204
+ # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
205
+ # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
206
+ # define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
207
+ # endif // GNUC version
208
+ #endif // __clang__ || __GNUC__
209
+
154
210
  #if !defined(JSONCPP_DEPRECATED)
155
- # define JSONCPP_DEPRECATED(message)
211
+ #define JSONCPP_DEPRECATED(message)
156
212
  #endif // if !defined(JSONCPP_DEPRECATED)
157
213
 
214
+ #if __GNUC__ >= 6
215
+ # define JSON_USE_INT64_DOUBLE_CONVERSION 1
216
+ #endif
217
+
218
+ #if !defined(JSON_IS_AMALGAMATION)
219
+
220
+ # include "version.h"
221
+
222
+ # if JSONCPP_USING_SECURE_MEMORY
223
+ # include "allocator.h" //typedef Allocator
224
+ # endif
225
+
226
+ #endif // if !defined(JSON_IS_AMALGAMATION)
227
+
158
228
  namespace Json {
159
- typedef int Int;
160
- typedef unsigned int UInt;
161
- # if defined(JSON_NO_INT64)
162
- typedef int LargestInt;
163
- typedef unsigned int LargestUInt;
164
- # undef JSON_HAS_INT64
165
- # else // if defined(JSON_NO_INT64)
166
- // For Microsoft Visual use specific types as long long is not supported
167
- # if defined(_MSC_VER) // Microsoft Visual Studio
168
- typedef __int64 Int64;
169
- typedef unsigned __int64 UInt64;
170
- # else // if defined(_MSC_VER) // Other platforms, use long long
171
- typedef long long int Int64;
172
- typedef unsigned long long int UInt64;
173
- # endif // if defined(_MSC_VER)
174
- typedef Int64 LargestInt;
175
- typedef UInt64 LargestUInt;
176
- # define JSON_HAS_INT64
177
- # endif // if defined(JSON_NO_INT64)
229
+ typedef int Int;
230
+ typedef unsigned int UInt;
231
+ #if defined(JSON_NO_INT64)
232
+ typedef int LargestInt;
233
+ typedef unsigned int LargestUInt;
234
+ #undef JSON_HAS_INT64
235
+ #else // if defined(JSON_NO_INT64)
236
+ // For Microsoft Visual use specific types as long long is not supported
237
+ #if defined(_MSC_VER) // Microsoft Visual Studio
238
+ typedef __int64 Int64;
239
+ typedef unsigned __int64 UInt64;
240
+ #else // if defined(_MSC_VER) // Other platforms, use long long
241
+ typedef int64_t Int64;
242
+ typedef uint64_t UInt64;
243
+ #endif // if defined(_MSC_VER)
244
+ typedef Int64 LargestInt;
245
+ typedef UInt64 LargestUInt;
246
+ #define JSON_HAS_INT64
247
+ #endif // if defined(JSON_NO_INT64)
248
+ #if JSONCPP_USING_SECURE_MEMORY
249
+ #define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
250
+ #define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
251
+ #define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
252
+ #define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
253
+ #define JSONCPP_ISTREAM std::istream
254
+ #else
255
+ #define JSONCPP_STRING std::string
256
+ #define JSONCPP_OSTRINGSTREAM std::ostringstream
257
+ #define JSONCPP_OSTREAM std::ostream
258
+ #define JSONCPP_ISTRINGSTREAM std::istringstream
259
+ #define JSONCPP_ISTREAM std::istream
260
+ #endif // if JSONCPP_USING_SECURE_MEMORY
178
261
  } // end namespace Json
179
262
 
180
-
181
263
  #endif // JSON_CONFIG_H_INCLUDED
182
264
 
183
265
  // //////////////////////////////////////////////////////////////////////
@@ -199,42 +281,35 @@ namespace Json {
199
281
  // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
200
282
 
201
283
  #ifndef JSON_FORWARDS_H_INCLUDED
202
- # define JSON_FORWARDS_H_INCLUDED
284
+ #define JSON_FORWARDS_H_INCLUDED
203
285
 
204
286
  #if !defined(JSON_IS_AMALGAMATION)
205
- # include "config.h"
287
+ #include "config.h"
206
288
  #endif // if !defined(JSON_IS_AMALGAMATION)
207
289
 
208
290
  namespace Json {
209
291
 
210
- // writer.h
211
- class FastWriter;
212
- class StyledWriter;
213
-
214
- // reader.h
215
- class Reader;
216
-
217
- // features.h
218
- class Features;
219
-
220
- // value.h
221
- typedef unsigned int ArrayIndex;
222
- class StaticString;
223
- class Path;
224
- class PathArgument;
225
- class Value;
226
- class ValueIteratorBase;
227
- class ValueIterator;
228
- class ValueConstIterator;
229
- #ifdef JSON_VALUE_USE_INTERNAL_MAP
230
- class ValueMapAllocator;
231
- class ValueInternalLink;
232
- class ValueInternalArray;
233
- class ValueInternalMap;
234
- #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
292
+ // writer.h
293
+ class FastWriter;
294
+ class StyledWriter;
235
295
 
236
- } // namespace Json
296
+ // reader.h
297
+ class Reader;
298
+
299
+ // features.h
300
+ class Features;
237
301
 
302
+ // value.h
303
+ typedef unsigned int ArrayIndex;
304
+ class StaticString;
305
+ class Path;
306
+ class PathArgument;
307
+ class Value;
308
+ class ValueIteratorBase;
309
+ class ValueIterator;
310
+ class ValueConstIterator;
311
+
312
+ } // namespace Json
238
313
 
239
314
  #endif // JSON_FORWARDS_H_INCLUDED
240
315