passenger 4.0.27 → 4.0.28

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 (156) hide show
  1. data.tar.gz.asc +7 -7
  2. data/.gitignore +1 -0
  3. data/NEWS +22 -0
  4. data/build/preprocessor.rb +10 -0
  5. data/build/rpm.rb +74 -65
  6. data/debian.template/rules.template +8 -0
  7. data/dev/copy_boost_headers.rb +11 -2
  8. data/doc/Users guide Apache.idmap.txt +161 -145
  9. data/doc/Users guide Apache.txt +12 -1
  10. data/doc/Users guide Nginx.idmap.txt +142 -126
  11. data/doc/Users guide Nginx.txt +14 -1
  12. data/doc/Users guide Standalone.txt +1 -0
  13. data/doc/users_guide_snippets/environment_variables.txt +1 -1
  14. data/doc/users_guide_snippets/installation.txt +2 -0
  15. data/doc/users_guide_snippets/tips.txt +118 -0
  16. data/ext/apache2/Configuration.cpp +0 -6
  17. data/ext/apache2/Configuration.hpp +0 -5
  18. data/ext/apache2/ConfigurationCommands.cpp +7 -0
  19. data/ext/apache2/ConfigurationFields.hpp +2 -0
  20. data/ext/apache2/ConfigurationSetters.cpp +24 -0
  21. data/ext/apache2/CreateDirConfig.cpp +1 -0
  22. data/ext/apache2/Hooks.cpp +0 -1
  23. data/ext/apache2/MergeDirConfig.cpp +7 -0
  24. data/ext/apache2/SetHeaders.cpp +5 -1
  25. data/ext/boost/cregex.hpp +39 -0
  26. data/ext/boost/libs/regex/src/c_regex_traits.cpp +193 -0
  27. data/ext/boost/libs/regex/src/cpp_regex_traits.cpp +117 -0
  28. data/ext/boost/libs/regex/src/cregex.cpp +660 -0
  29. data/ext/boost/libs/regex/src/instances.cpp +32 -0
  30. data/ext/boost/libs/regex/src/internals.hpp +35 -0
  31. data/ext/boost/libs/regex/src/posix_api.cpp +296 -0
  32. data/ext/boost/libs/regex/src/regex.cpp +227 -0
  33. data/ext/boost/libs/regex/src/regex_debug.cpp +59 -0
  34. data/ext/boost/libs/regex/src/regex_raw_buffer.cpp +72 -0
  35. data/ext/boost/libs/regex/src/regex_traits_defaults.cpp +692 -0
  36. data/ext/boost/libs/regex/src/static_mutex.cpp +179 -0
  37. data/ext/boost/libs/regex/src/wc_regex_traits.cpp +301 -0
  38. data/ext/boost/libs/regex/src/wide_posix_api.cpp +315 -0
  39. data/ext/boost/libs/regex/src/winstances.cpp +35 -0
  40. data/ext/boost/regex.h +100 -0
  41. data/ext/boost/regex.hpp +37 -0
  42. data/ext/boost/regex/concepts.hpp +1128 -0
  43. data/ext/boost/regex/config.hpp +435 -0
  44. data/ext/boost/regex/config/borland.hpp +72 -0
  45. data/ext/boost/regex/config/cwchar.hpp +207 -0
  46. data/ext/boost/regex/mfc.hpp +190 -0
  47. data/ext/boost/regex/pattern_except.hpp +100 -0
  48. data/ext/boost/regex/pending/object_cache.hpp +165 -0
  49. data/ext/boost/regex/pending/static_mutex.hpp +179 -0
  50. data/ext/boost/regex/pending/unicode_iterator.hpp +776 -0
  51. data/ext/boost/regex/regex_traits.hpp +35 -0
  52. data/ext/boost/regex/user.hpp +93 -0
  53. data/ext/boost/regex/v4/basic_regex.hpp +782 -0
  54. data/ext/boost/regex/v4/basic_regex_creator.hpp +1571 -0
  55. data/ext/boost/regex/v4/basic_regex_parser.hpp +2874 -0
  56. data/ext/boost/regex/v4/c_regex_traits.hpp +211 -0
  57. data/ext/boost/regex/v4/char_regex_traits.hpp +81 -0
  58. data/ext/boost/regex/v4/cpp_regex_traits.hpp +1099 -0
  59. data/ext/boost/regex/v4/cregex.hpp +330 -0
  60. data/ext/boost/regex/v4/error_type.hpp +59 -0
  61. data/ext/boost/regex/v4/fileiter.hpp +455 -0
  62. data/ext/boost/regex/v4/instances.hpp +222 -0
  63. data/ext/boost/regex/v4/iterator_category.hpp +91 -0
  64. data/ext/boost/regex/v4/iterator_traits.hpp +135 -0
  65. data/ext/boost/regex/v4/match_flags.hpp +138 -0
  66. data/ext/boost/regex/v4/match_results.hpp +702 -0
  67. data/ext/boost/regex/v4/mem_block_cache.hpp +99 -0
  68. data/ext/boost/regex/v4/perl_matcher.hpp +587 -0
  69. data/ext/boost/regex/v4/perl_matcher_common.hpp +996 -0
  70. data/ext/boost/regex/v4/perl_matcher_non_recursive.hpp +1642 -0
  71. data/ext/boost/regex/v4/perl_matcher_recursive.hpp +991 -0
  72. data/ext/boost/regex/v4/primary_transform.hpp +146 -0
  73. data/ext/boost/regex/v4/protected_call.hpp +81 -0
  74. data/ext/boost/regex/v4/regbase.hpp +180 -0
  75. data/ext/boost/regex/v4/regex.hpp +202 -0
  76. data/ext/boost/regex/v4/regex_format.hpp +1156 -0
  77. data/ext/boost/regex/v4/regex_fwd.hpp +73 -0
  78. data/ext/boost/regex/v4/regex_grep.hpp +155 -0
  79. data/ext/boost/regex/v4/regex_iterator.hpp +201 -0
  80. data/ext/boost/regex/v4/regex_match.hpp +382 -0
  81. data/ext/boost/regex/v4/regex_merge.hpp +93 -0
  82. data/ext/boost/regex/v4/regex_raw_buffer.hpp +210 -0
  83. data/ext/boost/regex/v4/regex_replace.hpp +99 -0
  84. data/ext/boost/regex/v4/regex_search.hpp +217 -0
  85. data/ext/boost/regex/v4/regex_split.hpp +172 -0
  86. data/ext/boost/regex/v4/regex_token_iterator.hpp +342 -0
  87. data/ext/boost/regex/v4/regex_traits.hpp +189 -0
  88. data/ext/boost/regex/v4/regex_traits_defaults.hpp +371 -0
  89. data/ext/boost/regex/v4/regex_workaround.hpp +232 -0
  90. data/ext/boost/regex/v4/states.hpp +301 -0
  91. data/ext/boost/regex/v4/sub_match.hpp +512 -0
  92. data/ext/boost/regex/v4/syntax_type.hpp +105 -0
  93. data/ext/boost/regex/v4/u32regex_iterator.hpp +193 -0
  94. data/ext/boost/regex/v4/u32regex_token_iterator.hpp +377 -0
  95. data/ext/boost/regex/v4/w32_regex_traits.hpp +741 -0
  96. data/ext/boost/regex_fwd.hpp +33 -0
  97. data/ext/common/AgentsStarter.h +0 -11
  98. data/ext/common/ApplicationPool2/Common.h +1 -7
  99. data/ext/common/ApplicationPool2/DirectSpawner.h +3 -3
  100. data/ext/common/ApplicationPool2/Group.h +166 -69
  101. data/ext/common/ApplicationPool2/Implementation.cpp +55 -10
  102. data/ext/common/ApplicationPool2/Options.h +45 -10
  103. data/ext/common/ApplicationPool2/PipeWatcher.h +1 -2
  104. data/ext/common/ApplicationPool2/Pool.h +29 -7
  105. data/ext/common/ApplicationPool2/Process.h +22 -3
  106. data/ext/common/ApplicationPool2/Session.h +1 -0
  107. data/ext/common/ApplicationPool2/SmartSpawner.h +5 -10
  108. data/ext/common/ApplicationPool2/Spawner.h +10 -15
  109. data/ext/common/ApplicationPool2/SuperGroup.h +10 -9
  110. data/ext/common/Constants.h +1 -3
  111. data/ext/common/Hooks.h +193 -0
  112. data/ext/common/Logging.cpp +67 -2
  113. data/ext/common/Logging.h +23 -1
  114. data/ext/common/Utils.cpp +0 -21
  115. data/ext/common/Utils.h +0 -42
  116. data/ext/common/Utils/CachedFileStat.hpp +1 -1
  117. data/ext/common/Utils/StrIntUtils.h +61 -14
  118. data/ext/common/Utils/StringMap.h +4 -0
  119. data/ext/common/agents/HelperAgent/AgentOptions.h +4 -4
  120. data/ext/common/agents/HelperAgent/Main.cpp +2 -3
  121. data/ext/common/agents/HelperAgent/RequestHandler.h +65 -2
  122. data/ext/common/agents/LoggingAgent/FilterSupport.h +3 -1
  123. data/ext/common/agents/Watchdog/Main.cpp +8 -72
  124. data/ext/nginx/CacheLocationConfig.c +29 -1
  125. data/ext/nginx/Configuration.c +0 -12
  126. data/ext/nginx/Configuration.h +0 -1
  127. data/ext/nginx/ConfigurationCommands.c +10 -0
  128. data/ext/nginx/ConfigurationFields.h +2 -0
  129. data/ext/nginx/CreateLocationConfig.c +4 -0
  130. data/ext/nginx/MergeLocationConfig.c +6 -0
  131. data/ext/oxt/system_calls.cpp +7 -1
  132. data/ext/oxt/system_calls.hpp +7 -7
  133. data/helper-scripts/node-loader.js +6 -2
  134. data/helper-scripts/rack-loader.rb +5 -2
  135. data/helper-scripts/rack-preloader.rb +5 -2
  136. data/lib/phusion_passenger.rb +1 -1
  137. data/lib/phusion_passenger/apache2/config_options.rb +8 -0
  138. data/lib/phusion_passenger/constants.rb +0 -1
  139. data/lib/phusion_passenger/nginx/config_options.rb +9 -2
  140. data/lib/phusion_passenger/platform_info/apache.rb +2 -1
  141. data/lib/phusion_passenger/platform_info/compiler.rb +15 -1
  142. data/lib/phusion_passenger/platform_info/cxx_portability.rb +2 -0
  143. data/node_lib/phusion_passenger/httplib_emulation.js +85 -17
  144. data/node_lib/phusion_passenger/request_handler.js +10 -2
  145. data/rpm/Vagrantfile +32 -0
  146. data/rpm/get_distro_id.py +4 -0
  147. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +2 -2
  148. data/test/cxx/ApplicationPool2/PoolTest.cpp +60 -9
  149. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +2 -6
  150. data/test/cxx/CachedFileStatTest.cpp +5 -5
  151. data/test/cxx/RequestHandlerTest.cpp +3 -6
  152. data/test/cxx/UtilsTest.cpp +30 -0
  153. data/test/node/httplib_emulation_spec.js +491 -0
  154. data/test/node/spec_helper.js +25 -0
  155. metadata +78 -2
  156. metadata.gz.asc +7 -7
@@ -0,0 +1,32 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 1998-2002
4
+ * John Maddock
5
+ *
6
+ * Use, modification and distribution are subject to the
7
+ * Boost Software License, Version 1.0. (See accompanying file
8
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
+ *
10
+ */
11
+
12
+ /*
13
+ * LOCATION: see http://www.boost.org for most recent version.
14
+ * FILE: instances.cpp
15
+ * VERSION: see <boost/version.hpp>
16
+ * DESCRIPTION: regex narrow character template instances.
17
+ */
18
+
19
+ #define BOOST_REGEX_SOURCE
20
+
21
+ #include <boost/regex/config.hpp>
22
+
23
+ #if !defined(BOOST_REGEX_NO_EXTERNAL_TEMPLATES)
24
+ #define BOOST_REGEX_NARROW_INSTANTIATE
25
+
26
+ #ifdef __BORLANDC__
27
+ #pragma hrdstop
28
+ #endif
29
+
30
+ #include <boost/regex.hpp>
31
+
32
+ #endif
@@ -0,0 +1,35 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 2011
4
+ * John Maddock
5
+ *
6
+ * Use, modification and distribution are subject to the
7
+ * Boost Software License, Version 1.0. (See accompanying file
8
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
+ *
10
+ */
11
+
12
+ #ifndef BOOST_REGEX_SRC_INTERNALS_HPP
13
+ #define BOOST_REGEX_SRC_INTERNALS_HPP
14
+
15
+ enum
16
+ {
17
+ char_class_space=1<<0,
18
+ char_class_print=1<<1,
19
+ char_class_cntrl=1<<2,
20
+ char_class_upper=1<<3,
21
+ char_class_lower=1<<4,
22
+ char_class_alpha=1<<5,
23
+ char_class_digit=1<<6,
24
+ char_class_punct=1<<7,
25
+ char_class_xdigit=1<<8,
26
+ char_class_alnum=char_class_alpha|char_class_digit,
27
+ char_class_graph=char_class_alnum|char_class_punct,
28
+ char_class_blank=1<<9,
29
+ char_class_word=1<<10,
30
+ char_class_unicode=1<<11,
31
+ char_class_horizontal=1<<12,
32
+ char_class_vertical=1<<13
33
+ };
34
+
35
+ #endif // BOOST_REGEX_SRC_INTERNALS_HPP
@@ -0,0 +1,296 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 1998-2002
4
+ * John Maddock
5
+ *
6
+ * Use, modification and distribution are subject to the
7
+ * Boost Software License, Version 1.0. (See accompanying file
8
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
+ *
10
+ */
11
+
12
+ /*
13
+ * LOCATION: see http://www.boost.org for most recent version.
14
+ * FILE: posix_api.cpp
15
+ * VERSION: see <boost/version.hpp>
16
+ * DESCRIPTION: Implements the Posix API wrappers.
17
+ */
18
+
19
+ #define BOOST_REGEX_SOURCE
20
+
21
+ #include <boost/config.hpp>
22
+ #include <cstdio>
23
+ #include <boost/regex.hpp>
24
+ #include <boost/cregex.hpp>
25
+
26
+ #if defined(BOOST_NO_STDC_NAMESPACE)
27
+ namespace std{
28
+ using ::sprintf;
29
+ using ::strcpy;
30
+ using ::strcmp;
31
+ }
32
+ #endif
33
+
34
+
35
+ namespace boost{
36
+
37
+ namespace{
38
+
39
+ unsigned int magic_value = 25631;
40
+
41
+ const char* names[] = {
42
+ "REG_NOERROR",
43
+ "REG_NOMATCH",
44
+ "REG_BADPAT",
45
+ "REG_ECOLLATE",
46
+ "REG_ECTYPE",
47
+ "REG_EESCAPE",
48
+ "REG_ESUBREG",
49
+ "REG_EBRACK",
50
+ "REG_EPAREN",
51
+ "REG_EBRACE",
52
+ "REG_BADBR",
53
+ "REG_ERANGE",
54
+ "REG_ESPACE",
55
+ "REG_BADRPT",
56
+ "REG_EEND",
57
+ "REG_ESIZE",
58
+ "REG_ERPAREN",
59
+ "REG_EMPTY",
60
+ "REG_ECOMPLEXITY",
61
+ "REG_ESTACK",
62
+ "REG_E_PERL",
63
+ "REG_E_UNKNOWN",
64
+ };
65
+ } // namespace
66
+
67
+ typedef boost::basic_regex<char, c_regex_traits<char> > c_regex_type;
68
+
69
+ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char* ptr, int f)
70
+ {
71
+ if(expression->re_magic != magic_value)
72
+ {
73
+ expression->guts = 0;
74
+ #ifndef BOOST_NO_EXCEPTIONS
75
+ try{
76
+ #endif
77
+ expression->guts = new c_regex_type();
78
+ #ifndef BOOST_NO_EXCEPTIONS
79
+ } catch(...)
80
+ {
81
+ return REG_ESPACE;
82
+ }
83
+ #else
84
+ if(0 == expression->guts)
85
+ return REG_E_MEMORY;
86
+ #endif
87
+ }
88
+ // set default flags:
89
+ boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
90
+ expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
91
+ // and translate those that are actually set:
92
+
93
+ if(f & REG_NOCOLLATE)
94
+ {
95
+ flags |= regex::nocollate;
96
+ #ifndef BOOST_REGEX_V3
97
+ flags &= ~regex::collate;
98
+ #endif
99
+ }
100
+
101
+ if(f & REG_NOSUB)
102
+ {
103
+ //expression->eflags |= match_any;
104
+ flags |= regex::nosubs;
105
+ }
106
+
107
+ if(f & REG_NOSPEC)
108
+ flags |= regex::literal;
109
+ if(f & REG_ICASE)
110
+ flags |= regex::icase;
111
+ if(f & REG_ESCAPE_IN_LISTS)
112
+ flags &= ~regex::no_escape_in_lists;
113
+ if(f & REG_NEWLINE_ALT)
114
+ flags |= regex::newline_alt;
115
+
116
+ const char* p2;
117
+ if(f & REG_PEND)
118
+ p2 = expression->re_endp;
119
+ else p2 = ptr + std::strlen(ptr);
120
+
121
+ int result;
122
+
123
+ #ifndef BOOST_NO_EXCEPTIONS
124
+ try{
125
+ #endif
126
+ expression->re_magic = magic_value;
127
+ static_cast<c_regex_type*>(expression->guts)->set_expression(ptr, p2, flags);
128
+ expression->re_nsub = static_cast<c_regex_type*>(expression->guts)->mark_count() - 1;
129
+ result = static_cast<c_regex_type*>(expression->guts)->error_code();
130
+ #ifndef BOOST_NO_EXCEPTIONS
131
+ }
132
+ catch(const boost::regex_error& be)
133
+ {
134
+ result = be.code();
135
+ }
136
+ catch(...)
137
+ {
138
+ result = REG_E_UNKNOWN;
139
+ }
140
+ #endif
141
+ if(result)
142
+ regfreeA(expression);
143
+ return result;
144
+
145
+ }
146
+
147
+ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA* e, char* buf, regsize_t buf_size)
148
+ {
149
+ std::size_t result = 0;
150
+ if(code & REG_ITOA)
151
+ {
152
+ code &= ~REG_ITOA;
153
+ if(code <= (int)REG_E_UNKNOWN)
154
+ {
155
+ result = std::strlen(names[code]) + 1;
156
+ if(buf_size >= result)
157
+ re_detail::strcpy_s(buf, buf_size, names[code]);
158
+ return result;
159
+ }
160
+ return result;
161
+ }
162
+ if(code == REG_ATOI)
163
+ {
164
+ char localbuf[5];
165
+ if(e == 0)
166
+ return 0;
167
+ for(int i = 0; i <= (int)REG_E_UNKNOWN; ++i)
168
+ {
169
+ if(std::strcmp(e->re_endp, names[i]) == 0)
170
+ {
171
+ //
172
+ // We're converting an integer i to a string, and since i <= REG_E_UNKNOWN
173
+ // a five character string is *always* large enough:
174
+ //
175
+ #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
176
+ int r = (::sprintf_s)(localbuf, 5, "%d", i);
177
+ #else
178
+ int r = (std::sprintf)(localbuf, "%d", i);
179
+ #endif
180
+ if(r < 0)
181
+ return 0; // sprintf failed
182
+ if(std::strlen(localbuf) < buf_size)
183
+ re_detail::strcpy_s(buf, buf_size, localbuf);
184
+ return std::strlen(localbuf) + 1;
185
+ }
186
+ }
187
+ #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
188
+ (::sprintf_s)(localbuf, 5, "%d", 0);
189
+ #else
190
+ (std::sprintf)(localbuf, "%d", 0);
191
+ #endif
192
+ if(std::strlen(localbuf) < buf_size)
193
+ re_detail::strcpy_s(buf, buf_size, localbuf);
194
+ return std::strlen(localbuf) + 1;
195
+ }
196
+ if(code <= (int)REG_E_UNKNOWN)
197
+ {
198
+ std::string p;
199
+ if((e) && (e->re_magic == magic_value))
200
+ p = static_cast<c_regex_type*>(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code));
201
+ else
202
+ {
203
+ p = re_detail::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code));
204
+ }
205
+ std::size_t len = p.size();
206
+ if(len < buf_size)
207
+ {
208
+ re_detail::strcpy_s(buf, buf_size, p.c_str());
209
+ }
210
+ return len + 1;
211
+ }
212
+ if(buf_size)
213
+ *buf = 0;
214
+ return 0;
215
+ }
216
+
217
+ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, const char* buf, regsize_t n, regmatch_t* array, int eflags)
218
+ {
219
+ #ifdef BOOST_MSVC
220
+ #pragma warning(push)
221
+ #pragma warning(disable:4267)
222
+ #endif
223
+ bool result = false;
224
+ match_flag_type flags = match_default | expression->eflags;
225
+ const char* end;
226
+ const char* start;
227
+ cmatch m;
228
+
229
+ if(eflags & REG_NOTBOL)
230
+ flags |= match_not_bol;
231
+ if(eflags & REG_NOTEOL)
232
+ flags |= match_not_eol;
233
+ if(eflags & REG_STARTEND)
234
+ {
235
+ start = buf + array[0].rm_so;
236
+ end = buf + array[0].rm_eo;
237
+ }
238
+ else
239
+ {
240
+ start = buf;
241
+ end = buf + std::strlen(buf);
242
+ }
243
+
244
+ #ifndef BOOST_NO_EXCEPTIONS
245
+ try{
246
+ #endif
247
+ if(expression->re_magic == magic_value)
248
+ {
249
+ result = regex_search(start, end, m, *static_cast<c_regex_type*>(expression->guts), flags);
250
+ }
251
+ else
252
+ return result;
253
+ #ifndef BOOST_NO_EXCEPTIONS
254
+ } catch(...)
255
+ {
256
+ return REG_E_UNKNOWN;
257
+ }
258
+ #endif
259
+
260
+ if(result)
261
+ {
262
+ // extract what matched:
263
+ std::size_t i;
264
+ for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i)
265
+ {
266
+ array[i].rm_so = (m[i].matched == false) ? -1 : (m[i].first - buf);
267
+ array[i].rm_eo = (m[i].matched == false) ? -1 : (m[i].second - buf);
268
+ }
269
+ // and set anything else to -1:
270
+ for(i = expression->re_nsub + 1; i < n; ++i)
271
+ {
272
+ array[i].rm_so = -1;
273
+ array[i].rm_eo = -1;
274
+ }
275
+ return 0;
276
+ }
277
+ return REG_NOMATCH;
278
+ #ifdef BOOST_MSVC
279
+ #pragma warning(pop)
280
+ #endif
281
+ }
282
+
283
+ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA* expression)
284
+ {
285
+ if(expression->re_magic == magic_value)
286
+ {
287
+ delete static_cast<c_regex_type*>(expression->guts);
288
+ }
289
+ expression->re_magic = 0;
290
+ }
291
+
292
+ } // namespace boost
293
+
294
+
295
+
296
+
@@ -0,0 +1,227 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 1998-2004
4
+ * John Maddock
5
+ *
6
+ * Use, modification and distribution are subject to the
7
+ * Boost Software License, Version 1.0. (See accompanying file
8
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
+ *
10
+ */
11
+
12
+ /*
13
+ * LOCATION: see http://www.boost.org for most recent version.
14
+ * FILE: regex.cpp
15
+ * VERSION: see <boost/version.hpp>
16
+ * DESCRIPTION: Misc boost::regbase member funnctions.
17
+ */
18
+
19
+
20
+ #define BOOST_REGEX_SOURCE
21
+
22
+ #include <boost/config.hpp>
23
+ #include <new>
24
+ #include <boost/regex.hpp>
25
+ #include <boost/throw_exception.hpp>
26
+
27
+ #if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && defined(_MSC_VER) && (_MSC_VER >= 1300)
28
+ # include <malloc.h>
29
+ #endif
30
+ #ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
31
+ #define WIN32_LEAN_AND_MEAN
32
+ #ifndef NOMINMAX
33
+ # define NOMINMAX
34
+ #endif
35
+ #define NOGDI
36
+ #define NOUSER
37
+ #include <windows.h>
38
+ #endif
39
+
40
+ #if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_REGEX_V3)
41
+ #if BOOST_REGEX_MAX_CACHE_BLOCKS == 0
42
+ #include <new>
43
+ #else
44
+ #include <boost/regex/v4/mem_block_cache.hpp>
45
+ #endif
46
+ #endif
47
+
48
+ #ifdef BOOST_INTEL
49
+ #pragma warning(disable:383)
50
+ #endif
51
+
52
+ namespace boost{
53
+
54
+ //
55
+ // fix: these are declared out of line here to ensure
56
+ // that dll builds contain the Virtual table for these
57
+ // types - this ensures that exceptions can be thrown
58
+ // from the dll and caught in an exe.
59
+ regex_error::regex_error(const std::string& s, regex_constants::error_type err, std::ptrdiff_t pos)
60
+ : std::runtime_error(s)
61
+ , m_error_code(err)
62
+ , m_position(pos)
63
+ {
64
+ }
65
+
66
+ regex_error::regex_error(regex_constants::error_type err)
67
+ : std::runtime_error(::boost::re_detail::get_default_error_string(err))
68
+ , m_error_code(err)
69
+ , m_position(0)
70
+ {
71
+ }
72
+
73
+ regex_error::~regex_error() throw()
74
+ {
75
+ }
76
+
77
+ void regex_error::raise()const
78
+ {
79
+ #ifndef BOOST_NO_EXCEPTIONS
80
+ ::boost::throw_exception(*this);
81
+ #endif
82
+ }
83
+
84
+
85
+
86
+ namespace re_detail{
87
+
88
+ BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex)
89
+ {
90
+ ::boost::throw_exception(ex);
91
+ }
92
+ //
93
+ // error checking API:
94
+ //
95
+ BOOST_REGEX_DECL void BOOST_REGEX_CALL verify_options(boost::regex::flag_type /*ef*/, match_flag_type mf)
96
+ {
97
+ #ifndef BOOST_REGEX_V3
98
+ //
99
+ // can't mix match_extra with POSIX matching rules:
100
+ //
101
+ if((mf & match_extra) && (mf & match_posix))
102
+ {
103
+ std::logic_error msg("Usage Error: Can't mix regular expression captures with POSIX matching rules");
104
+ throw_exception(msg);
105
+ }
106
+ #endif
107
+ }
108
+
109
+ #ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
110
+
111
+ static void execute_eror()
112
+ {
113
+ // we only get here after a stack overflow,
114
+ // this has to be a separate proceedure because we
115
+ // can't mix __try{}__except block with local objects
116
+ // that have destructors:
117
+ reset_stack_guard_page();
118
+ std::runtime_error err("Out of stack space, while attempting to match a regular expression.");
119
+ raise_runtime_error(err);
120
+ }
121
+
122
+ bool BOOST_REGEX_CALL abstract_protected_call::execute()const
123
+ {
124
+ __try{
125
+ return this->call();
126
+ }__except(EXCEPTION_STACK_OVERFLOW == GetExceptionCode())
127
+ {
128
+ execute_eror();
129
+ }
130
+ // We never really get here at all:
131
+ return false;
132
+ }
133
+
134
+ BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page()
135
+ {
136
+ #if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && defined(_MSC_VER) && (_MSC_VER >= 1300)
137
+ _resetstkoflw();
138
+ #else
139
+ //
140
+ // We need to locate the current page being used by the stack,
141
+ // move to the page below it and then deallocate and protect
142
+ // that page. Note that ideally we would protect only the lowest
143
+ // stack page that has been allocated: in practice there
144
+ // seems to be no easy way to locate this page, in any case as
145
+ // long as the next page is protected, then Windows will figure
146
+ // the rest out for us...
147
+ //
148
+ SYSTEM_INFO si;
149
+ GetSystemInfo(&si);
150
+ MEMORY_BASIC_INFORMATION mi;
151
+ DWORD previous_protection_status;
152
+ //
153
+ // this is an address in our stack space:
154
+ //
155
+ LPBYTE page = (LPBYTE)&page;
156
+ //
157
+ // Get the current memory page in use:
158
+ //
159
+ VirtualQuery(page, &mi, sizeof(mi));
160
+ //
161
+ // Go to the page one below this:
162
+ //
163
+ page = (LPBYTE)(mi.BaseAddress)-si.dwPageSize;
164
+ //
165
+ // Free and protect everything from the start of the
166
+ // allocation range, to the end of the page below the
167
+ // one in use:
168
+ //
169
+ if (!VirtualFree(mi.AllocationBase, (LPBYTE)page - (LPBYTE)mi.AllocationBase, MEM_DECOMMIT)
170
+ || !VirtualProtect(page, si.dwPageSize, PAGE_GUARD | PAGE_READWRITE, &previous_protection_status))
171
+ {
172
+ throw std::bad_exception();
173
+ }
174
+ #endif
175
+ }
176
+ #endif
177
+
178
+ #if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_REGEX_V3)
179
+
180
+ #if BOOST_REGEX_MAX_CACHE_BLOCKS == 0
181
+
182
+ BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block()
183
+ {
184
+ return ::operator new(BOOST_REGEX_BLOCKSIZE);
185
+ }
186
+
187
+ BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void* p)
188
+ {
189
+ ::operator delete(p);
190
+ }
191
+
192
+ #else
193
+
194
+ #ifdef BOOST_HAS_THREADS
195
+ mem_block_cache block_cache = { 0, 0, BOOST_STATIC_MUTEX_INIT, };
196
+ #else
197
+ mem_block_cache block_cache = { 0, 0, };
198
+ #endif
199
+
200
+ BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block()
201
+ {
202
+ return block_cache.get();
203
+ }
204
+
205
+ BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void* p)
206
+ {
207
+ block_cache.put(p);
208
+ }
209
+
210
+ #endif
211
+
212
+ #endif
213
+
214
+ } // namespace re_detail
215
+
216
+
217
+
218
+ } // namespace boost
219
+
220
+ #if defined(BOOST_RE_USE_VCL) && defined(BOOST_REGEX_DYN_LINK)
221
+
222
+ int WINAPI DllEntryPoint(HINSTANCE , unsigned long , void*)
223
+ {
224
+ return 1;
225
+ }
226
+ #endif
227
+