passenger 4.0.60 → 5.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/.editorconfig +5 -0
- data/.travis.yml +3 -2
- data/CHANGELOG +31 -53
- data/CONTRIBUTING.md +4 -4
- data/CONTRIBUTORS +0 -1
- data/Gemfile +18 -0
- data/Gemfile.lock +41 -0
- data/Rakefile +16 -0
- data/bin/passenger +2 -2
- data/bin/passenger-install-apache2-module +12 -12
- data/bin/passenger-install-nginx-module +9 -14
- data/bin/passenger-status +125 -87
- data/build/agents.rb +112 -140
- data/build/apache2.rb +4 -9
- data/build/basics.rb +5 -3
- data/build/common_library.rb +1 -0
- data/build/cxx_tests.rb +69 -47
- data/build/debian.rb +4 -2
- data/build/documentation.rb +1 -0
- data/build/integration_tests.rb +28 -43
- data/build/misc.rb +0 -18
- data/build/nginx.rb +2 -6
- data/build/packaging.rb +33 -22
- data/build/preprocessor.rb +2 -4
- data/build/ruby_tests.rb +7 -26
- data/build/test_basics.rb +24 -25
- data/debian.template/control.template +2 -2
- data/debian.template/locations.ini.template +2 -3
- data/debian.template/passenger.install.template +2 -2
- data/debian.template/rules.template +1 -1
- data/dev/ci/run_jenkins.sh +0 -1
- data/dev/ci/run_rpm_tests.sh +3 -0
- data/dev/ci/run_travis.sh +63 -17
- data/dev/copy_boost_headers +22 -6
- data/dev/ruby_server.rb +244 -0
- data/dev/vagrant/provision.sh +3 -1
- data/doc/DebuggingAndStressTesting.md +3 -3
- data/doc/Design and Architecture.txt +5 -6
- data/doc/Packaging.txt.md +35 -6
- data/doc/ServerOptimizationGuide.txt.md +339 -0
- data/doc/Users guide Apache.idmap.txt +177 -187
- data/doc/Users guide Apache.txt +143 -219
- data/doc/Users guide Nginx.idmap.txt +166 -166
- data/doc/Users guide Nginx.txt +265 -223
- data/doc/Users guide Standalone.txt +3 -3
- data/doc/templates/markdown.html.erb +37 -6
- data/doc/users_guide_snippets/environment_variables.txt +1 -1
- data/doc/users_guide_snippets/support_information.txt +1 -1
- data/doc/users_guide_snippets/tips.txt +2 -2
- data/ext/apache2/Configuration.cpp +23 -81
- data/ext/apache2/Configuration.hpp +18 -92
- data/ext/apache2/ConfigurationCommands.cpp +64 -15
- data/ext/apache2/ConfigurationCommands.cpp.erb +8 -4
- data/ext/apache2/ConfigurationFields.hpp +12 -0
- data/ext/apache2/ConfigurationSetters.cpp +73 -1
- data/ext/apache2/ConfigurationSetters.cpp.erb +3 -2
- data/ext/apache2/CreateDirConfig.cpp +6 -0
- data/ext/apache2/DirectoryMapper.h +11 -6
- data/ext/apache2/Hooks.cpp +291 -408
- data/ext/apache2/MergeDirConfig.cpp +42 -0
- data/ext/apache2/SetHeaders.cpp +61 -16
- data/ext/apache2/SetHeaders.cpp.erb +9 -7
- data/ext/boost/container/allocator_traits.hpp +400 -0
- data/ext/boost/container/deque.hpp +2012 -0
- data/ext/boost/container/detail/adaptive_node_pool_impl.hpp +874 -0
- data/ext/boost/container/detail/advanced_insert_int.hpp +369 -0
- data/ext/boost/container/detail/algorithms.hpp +84 -0
- data/ext/boost/container/detail/allocation_type.hpp +54 -0
- data/ext/boost/container/detail/allocator_version_traits.hpp +163 -0
- data/ext/boost/container/detail/config_begin.hpp +49 -0
- data/ext/boost/container/detail/config_end.hpp +17 -0
- data/ext/boost/container/detail/destroyers.hpp +365 -0
- data/ext/boost/container/detail/flat_tree.hpp +1055 -0
- data/ext/boost/container/detail/function_detector.hpp +88 -0
- data/ext/boost/container/detail/iterators.hpp +611 -0
- data/ext/boost/container/detail/math_functions.hpp +113 -0
- data/ext/boost/container/detail/memory_util.hpp +83 -0
- data/ext/boost/container/detail/mpl.hpp +160 -0
- data/ext/boost/container/detail/multiallocation_chain.hpp +286 -0
- data/ext/boost/container/detail/node_alloc_holder.hpp +386 -0
- data/ext/boost/container/detail/node_pool_impl.hpp +365 -0
- data/ext/boost/container/detail/pair.hpp +354 -0
- data/ext/boost/container/detail/pool_common.hpp +52 -0
- data/ext/boost/container/detail/preprocessor.hpp +232 -0
- data/ext/boost/container/detail/transform_iterator.hpp +176 -0
- data/ext/boost/container/detail/tree.hpp +1134 -0
- data/ext/boost/container/detail/type_traits.hpp +210 -0
- data/ext/boost/container/detail/utilities.hpp +1141 -0
- data/ext/boost/container/detail/value_init.hpp +45 -0
- data/ext/boost/container/detail/variadic_templates_tools.hpp +153 -0
- data/ext/boost/container/detail/version_type.hpp +92 -0
- data/ext/boost/container/detail/workaround.hpp +44 -0
- data/ext/boost/container/flat_map.hpp +1674 -0
- data/ext/boost/container/flat_set.hpp +1408 -0
- data/ext/boost/container/list.hpp +1475 -0
- data/ext/boost/container/map.hpp +1508 -0
- data/ext/boost/container/scoped_allocator.hpp +1503 -0
- data/ext/boost/container/scoped_allocator_fwd.hpp +83 -0
- data/ext/boost/container/set.hpp +1280 -0
- data/ext/boost/container/slist.hpp +1706 -0
- data/ext/boost/container/stable_vector.hpp +1869 -0
- data/ext/boost/container/static_vector.hpp +1053 -0
- data/ext/boost/container/string.hpp +2856 -0
- data/ext/boost/container/throw_exception.hpp +110 -0
- data/ext/boost/container/vector.hpp +2671 -0
- data/ext/boost/detail/is_xxx.hpp +61 -0
- data/ext/boost/intrusive/any_hook.hpp +344 -0
- data/ext/boost/intrusive/avl_set.hpp +2528 -0
- data/ext/boost/intrusive/avl_set_hook.hpp +297 -0
- data/ext/boost/intrusive/avltree.hpp +1786 -0
- data/ext/boost/intrusive/avltree_algorithms.hpp +968 -0
- data/ext/boost/intrusive/bs_set_hook.hpp +296 -0
- data/ext/boost/intrusive/circular_list_algorithms.hpp +413 -0
- data/ext/boost/intrusive/circular_slist_algorithms.hpp +404 -0
- data/ext/boost/intrusive/derivation_value_traits.hpp +70 -0
- data/ext/boost/intrusive/detail/any_node_and_algorithms.hpp +297 -0
- data/ext/boost/intrusive/detail/assert.hpp +41 -0
- data/ext/boost/intrusive/detail/avltree_node.hpp +197 -0
- data/ext/boost/intrusive/detail/clear_on_destructor_base.hpp +36 -0
- data/ext/boost/intrusive/detail/common_slist_algorithms.hpp +102 -0
- data/ext/boost/intrusive/detail/config_begin.hpp +52 -0
- data/ext/boost/intrusive/detail/config_end.hpp +15 -0
- data/ext/boost/intrusive/detail/ebo_functor_holder.hpp +95 -0
- data/ext/boost/intrusive/detail/function_detector.hpp +88 -0
- data/ext/boost/intrusive/detail/generic_hook.hpp +209 -0
- data/ext/boost/intrusive/detail/has_member_function_callable_with.hpp +357 -0
- data/ext/boost/intrusive/detail/hashtable_node.hpp +249 -0
- data/ext/boost/intrusive/detail/is_stateful_value_traits.hpp +77 -0
- data/ext/boost/intrusive/detail/list_node.hpp +196 -0
- data/ext/boost/intrusive/detail/memory_util.hpp +288 -0
- data/ext/boost/intrusive/detail/mpl.hpp +383 -0
- data/ext/boost/intrusive/detail/parent_from_member.hpp +97 -0
- data/ext/boost/intrusive/detail/preprocessor.hpp +52 -0
- data/ext/boost/intrusive/detail/rbtree_node.hpp +201 -0
- data/ext/boost/intrusive/detail/slist_node.hpp +166 -0
- data/ext/boost/intrusive/detail/transform_iterator.hpp +173 -0
- data/ext/boost/intrusive/detail/tree_algorithms.hpp +1742 -0
- data/ext/boost/intrusive/detail/tree_node.hpp +199 -0
- data/ext/boost/intrusive/detail/utilities.hpp +858 -0
- data/ext/boost/intrusive/detail/workaround.hpp +22 -0
- data/ext/boost/intrusive/hashtable.hpp +3110 -0
- data/ext/boost/intrusive/intrusive_fwd.hpp +542 -0
- data/ext/boost/intrusive/linear_slist_algorithms.hpp +327 -0
- data/ext/boost/intrusive/link_mode.hpp +46 -0
- data/ext/boost/intrusive/list.hpp +1525 -0
- data/ext/boost/intrusive/list_hook.hpp +290 -0
- data/ext/boost/intrusive/member_value_traits.hpp +70 -0
- data/ext/boost/intrusive/options.hpp +810 -0
- data/ext/boost/intrusive/parent_from_member.hpp +42 -0
- data/ext/boost/intrusive/pointer_plus_bits.hpp +86 -0
- data/ext/boost/intrusive/pointer_traits.hpp +265 -0
- data/ext/boost/intrusive/priority_compare.hpp +39 -0
- data/ext/boost/intrusive/rbtree.hpp +1785 -0
- data/ext/boost/intrusive/rbtree_algorithms.hpp +934 -0
- data/ext/boost/intrusive/set.hpp +2554 -0
- data/ext/boost/intrusive/set_hook.hpp +300 -0
- data/ext/boost/intrusive/sg_set.hpp +2601 -0
- data/ext/boost/intrusive/sgtree.hpp +2009 -0
- data/ext/boost/intrusive/sgtree_algorithms.hpp +807 -0
- data/ext/boost/intrusive/slist.hpp +2219 -0
- data/ext/boost/intrusive/slist_hook.hpp +294 -0
- data/ext/boost/intrusive/splay_set.hpp +2575 -0
- data/ext/boost/intrusive/splay_set_hook.hpp +292 -0
- data/ext/boost/intrusive/splaytree.hpp +1784 -0
- data/ext/boost/intrusive/splaytree_algorithms.hpp +1008 -0
- data/ext/boost/intrusive/treap.hpp +1882 -0
- data/ext/boost/intrusive/treap_algorithms.hpp +919 -0
- data/ext/boost/intrusive/treap_set.hpp +2751 -0
- data/ext/boost/intrusive/trivial_value_traits.hpp +46 -0
- data/ext/boost/intrusive/unordered_set.hpp +2115 -0
- data/ext/boost/intrusive/unordered_set_hook.hpp +434 -0
- data/ext/boost/intrusive_ptr.hpp +18 -0
- data/ext/boost/math/common_factor_ct.hpp +180 -0
- data/ext/boost/math_fwd.hpp +108 -0
- data/ext/boost/move/detail/move_helpers.hpp +175 -0
- data/ext/boost/parameter.hpp +21 -0
- data/ext/boost/parameter/aux_/arg_list.hpp +459 -0
- data/ext/boost/parameter/aux_/cast.hpp +143 -0
- data/ext/boost/parameter/aux_/default.hpp +69 -0
- data/ext/boost/parameter/aux_/is_maybe.hpp +26 -0
- data/ext/boost/parameter/aux_/maybe.hpp +120 -0
- data/ext/boost/parameter/aux_/overloads.hpp +88 -0
- data/ext/boost/parameter/aux_/parameter_requirements.hpp +25 -0
- data/ext/boost/parameter/aux_/parenthesized_type.hpp +119 -0
- data/ext/boost/parameter/aux_/preprocessor/flatten.hpp +115 -0
- data/ext/boost/parameter/aux_/preprocessor/for_each.hpp +103 -0
- data/ext/boost/parameter/aux_/python/invoker.hpp +132 -0
- data/ext/boost/parameter/aux_/python/invoker_iterate.hpp +93 -0
- data/ext/boost/parameter/aux_/result_of0.hpp +36 -0
- data/ext/boost/parameter/aux_/set.hpp +67 -0
- data/ext/boost/parameter/aux_/tag.hpp +38 -0
- data/ext/boost/parameter/aux_/tagged_argument.hpp +188 -0
- data/ext/boost/parameter/aux_/template_keyword.hpp +47 -0
- data/ext/boost/parameter/aux_/unwrap_cv_reference.hpp +97 -0
- data/ext/boost/parameter/aux_/void.hpp +29 -0
- data/ext/boost/parameter/aux_/yesno.hpp +26 -0
- data/ext/boost/parameter/binding.hpp +106 -0
- data/ext/boost/parameter/config.hpp +14 -0
- data/ext/boost/parameter/keyword.hpp +152 -0
- data/ext/boost/parameter/macros.hpp +99 -0
- data/ext/boost/parameter/match.hpp +55 -0
- data/ext/boost/parameter/name.hpp +156 -0
- data/ext/boost/parameter/parameters.hpp +931 -0
- data/ext/boost/parameter/preprocessor.hpp +1178 -0
- data/ext/boost/parameter/python.hpp +735 -0
- data/ext/boost/parameter/value_type.hpp +108 -0
- data/ext/boost/pool/detail/for.m4 +107 -0
- data/ext/boost/pool/detail/guard.hpp +69 -0
- data/ext/boost/pool/detail/mutex.hpp +42 -0
- data/ext/boost/pool/detail/pool_construct.bat +24 -0
- data/ext/boost/pool/detail/pool_construct.ipp +852 -0
- data/ext/boost/pool/detail/pool_construct.m4 +84 -0
- data/ext/boost/pool/detail/pool_construct.sh +12 -0
- data/ext/boost/pool/detail/pool_construct_simple.bat +25 -0
- data/ext/boost/pool/detail/pool_construct_simple.ipp +43 -0
- data/ext/boost/pool/detail/pool_construct_simple.m4 +72 -0
- data/ext/boost/pool/detail/pool_construct_simple.sh +12 -0
- data/ext/boost/pool/object_pool.hpp +287 -0
- data/ext/boost/pool/pool.hpp +1024 -0
- data/ext/boost/pool/pool_alloc.hpp +488 -0
- data/ext/boost/pool/poolfwd.hpp +82 -0
- data/ext/boost/pool/simple_segregated_storage.hpp +377 -0
- data/ext/boost/pool/singleton_pool.hpp +251 -0
- data/ext/boost/preprocessor/arithmetic.hpp +25 -0
- data/ext/boost/preprocessor/arithmetic/detail/div_base.hpp +61 -0
- data/ext/boost/preprocessor/arithmetic/div.hpp +39 -0
- data/ext/boost/preprocessor/arithmetic/mod.hpp +39 -0
- data/ext/boost/preprocessor/arithmetic/mul.hpp +53 -0
- data/ext/boost/preprocessor/array.hpp +32 -0
- data/ext/boost/preprocessor/array/enum.hpp +33 -0
- data/ext/boost/preprocessor/array/insert.hpp +55 -0
- data/ext/boost/preprocessor/array/pop_back.hpp +37 -0
- data/ext/boost/preprocessor/array/pop_front.hpp +38 -0
- data/ext/boost/preprocessor/array/push_back.hpp +33 -0
- data/ext/boost/preprocessor/array/push_front.hpp +33 -0
- data/ext/boost/preprocessor/array/remove.hpp +54 -0
- data/ext/boost/preprocessor/array/replace.hpp +49 -0
- data/ext/boost/preprocessor/array/reverse.hpp +29 -0
- data/ext/boost/preprocessor/array/to_list.hpp +33 -0
- data/ext/boost/preprocessor/array/to_seq.hpp +33 -0
- data/ext/boost/preprocessor/array/to_tuple.hpp +22 -0
- data/ext/boost/preprocessor/assert_msg.hpp +17 -0
- data/ext/boost/preprocessor/comma.hpp +17 -0
- data/ext/boost/preprocessor/comparison.hpp +24 -0
- data/ext/boost/preprocessor/comparison/equal.hpp +34 -0
- data/ext/boost/preprocessor/comparison/greater.hpp +38 -0
- data/ext/boost/preprocessor/comparison/greater_equal.hpp +38 -0
- data/ext/boost/preprocessor/comparison/less.hpp +46 -0
- data/ext/boost/preprocessor/comparison/less_equal.hpp +39 -0
- data/ext/boost/preprocessor/comparison/not_equal.hpp +814 -0
- data/ext/boost/preprocessor/config/limits.hpp +30 -0
- data/ext/boost/preprocessor/control.hpp +22 -0
- data/ext/boost/preprocessor/control/deduce_d.hpp +22 -0
- data/ext/boost/preprocessor/control/detail/dmc/while.hpp +536 -0
- data/ext/boost/preprocessor/control/detail/edg/while.hpp +534 -0
- data/ext/boost/preprocessor/control/detail/msvc/while.hpp +277 -0
- data/ext/boost/preprocessor/control/expr_if.hpp +30 -0
- data/ext/boost/preprocessor/debug.hpp +18 -0
- data/ext/boost/preprocessor/debug/assert.hpp +44 -0
- data/ext/boost/preprocessor/debug/line.hpp +35 -0
- data/ext/boost/preprocessor/detail/dmc/auto_rec.hpp +286 -0
- data/ext/boost/preprocessor/detail/is_nullary.hpp +30 -0
- data/ext/boost/preprocessor/detail/is_unary.hpp +30 -0
- data/ext/boost/preprocessor/detail/null.hpp +17 -0
- data/ext/boost/preprocessor/detail/split.hpp +35 -0
- data/ext/boost/preprocessor/enum_params_with_defaults.hpp +17 -0
- data/ext/boost/preprocessor/enum_shifted.hpp +17 -0
- data/ext/boost/preprocessor/expand.hpp +17 -0
- data/ext/boost/preprocessor/expr_if.hpp +17 -0
- data/ext/boost/preprocessor/facilities.hpp +23 -0
- data/ext/boost/preprocessor/facilities/apply.hpp +34 -0
- data/ext/boost/preprocessor/facilities/expand.hpp +28 -0
- data/ext/boost/preprocessor/facilities/is_1.hpp +23 -0
- data/ext/boost/preprocessor/facilities/is_empty.hpp +43 -0
- data/ext/boost/preprocessor/facilities/is_empty_or_1.hpp +30 -0
- data/ext/boost/preprocessor/for.hpp +17 -0
- data/ext/boost/preprocessor/if.hpp +17 -0
- data/ext/boost/preprocessor/iteration.hpp +19 -0
- data/ext/boost/preprocessor/iteration/detail/bounds/lower3.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/bounds/lower4.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/bounds/lower5.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/bounds/upper3.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/bounds/upper4.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/bounds/upper5.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/finish.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/iter/forward3.hpp +1338 -0
- data/ext/boost/preprocessor/iteration/detail/iter/forward4.hpp +1338 -0
- data/ext/boost/preprocessor/iteration/detail/iter/forward5.hpp +1338 -0
- data/ext/boost/preprocessor/iteration/detail/iter/reverse2.hpp +1296 -0
- data/ext/boost/preprocessor/iteration/detail/iter/reverse3.hpp +1296 -0
- data/ext/boost/preprocessor/iteration/detail/iter/reverse4.hpp +1296 -0
- data/ext/boost/preprocessor/iteration/detail/iter/reverse5.hpp +1296 -0
- data/ext/boost/preprocessor/iteration/detail/local.hpp +812 -0
- data/ext/boost/preprocessor/iteration/detail/rlocal.hpp +782 -0
- data/ext/boost/preprocessor/iteration/detail/self.hpp +21 -0
- data/ext/boost/preprocessor/iteration/detail/start.hpp +99 -0
- data/ext/boost/preprocessor/iteration/local.hpp +26 -0
- data/ext/boost/preprocessor/iteration/self.hpp +19 -0
- data/ext/boost/preprocessor/library.hpp +36 -0
- data/ext/boost/preprocessor/limits.hpp +17 -0
- data/ext/boost/preprocessor/list.hpp +37 -0
- data/ext/boost/preprocessor/list/at.hpp +39 -0
- data/ext/boost/preprocessor/list/cat.hpp +42 -0
- data/ext/boost/preprocessor/list/detail/dmc/fold_left.hpp +279 -0
- data/ext/boost/preprocessor/list/detail/edg/fold_left.hpp +536 -0
- data/ext/boost/preprocessor/list/detail/edg/fold_right.hpp +794 -0
- data/ext/boost/preprocessor/list/enum.hpp +41 -0
- data/ext/boost/preprocessor/list/filter.hpp +54 -0
- data/ext/boost/preprocessor/list/first_n.hpp +58 -0
- data/ext/boost/preprocessor/list/for_each.hpp +49 -0
- data/ext/boost/preprocessor/list/for_each_product.hpp +141 -0
- data/ext/boost/preprocessor/list/rest_n.hpp +55 -0
- data/ext/boost/preprocessor/list/size.hpp +58 -0
- data/ext/boost/preprocessor/list/to_array.hpp +123 -0
- data/ext/boost/preprocessor/list/to_seq.hpp +32 -0
- data/ext/boost/preprocessor/list/to_tuple.hpp +38 -0
- data/ext/boost/preprocessor/logical.hpp +29 -0
- data/ext/boost/preprocessor/logical/bitnor.hpp +38 -0
- data/ext/boost/preprocessor/logical/bitor.hpp +38 -0
- data/ext/boost/preprocessor/logical/bitxor.hpp +38 -0
- data/ext/boost/preprocessor/logical/nor.hpp +30 -0
- data/ext/boost/preprocessor/logical/not.hpp +30 -0
- data/ext/boost/preprocessor/logical/or.hpp +30 -0
- data/ext/boost/preprocessor/logical/xor.hpp +30 -0
- data/ext/boost/preprocessor/max.hpp +17 -0
- data/ext/boost/preprocessor/min.hpp +17 -0
- data/ext/boost/preprocessor/punctuation.hpp +20 -0
- data/ext/boost/preprocessor/punctuation/paren_if.hpp +38 -0
- data/ext/boost/preprocessor/repeat_3rd.hpp +17 -0
- data/ext/boost/preprocessor/repeat_from_to.hpp +17 -0
- data/ext/boost/preprocessor/repeat_from_to_2nd.hpp +17 -0
- data/ext/boost/preprocessor/repeat_from_to_3rd.hpp +17 -0
- data/ext/boost/preprocessor/repetition.hpp +32 -0
- data/ext/boost/preprocessor/repetition/deduce_r.hpp +22 -0
- data/ext/boost/preprocessor/repetition/deduce_z.hpp +22 -0
- data/ext/boost/preprocessor/repetition/detail/dmc/for.hpp +536 -0
- data/ext/boost/preprocessor/repetition/detail/edg/for.hpp +534 -0
- data/ext/boost/preprocessor/repetition/detail/msvc/for.hpp +277 -0
- data/ext/boost/preprocessor/repetition/enum_params_with_defaults.hpp +24 -0
- data/ext/boost/preprocessor/repetition/enum_shifted.hpp +68 -0
- data/ext/boost/preprocessor/repetition/enum_shifted_binary_params.hpp +51 -0
- data/ext/boost/preprocessor/repetition/enum_trailing.hpp +63 -0
- data/ext/boost/preprocessor/repetition/enum_trailing_binary_params.hpp +53 -0
- data/ext/boost/preprocessor/selection.hpp +18 -0
- data/ext/boost/preprocessor/selection/max.hpp +39 -0
- data/ext/boost/preprocessor/selection/min.hpp +39 -0
- data/ext/boost/preprocessor/seq.hpp +43 -0
- data/ext/boost/preprocessor/seq/cat.hpp +49 -0
- data/ext/boost/preprocessor/seq/detail/binary_transform.hpp +40 -0
- data/ext/boost/preprocessor/seq/detail/split.hpp +284 -0
- data/ext/boost/preprocessor/seq/filter.hpp +54 -0
- data/ext/boost/preprocessor/seq/first_n.hpp +30 -0
- data/ext/boost/preprocessor/seq/fold_left.hpp +1070 -0
- data/ext/boost/preprocessor/seq/fold_right.hpp +288 -0
- data/ext/boost/preprocessor/seq/for_each.hpp +60 -0
- data/ext/boost/preprocessor/seq/for_each_product.hpp +126 -0
- data/ext/boost/preprocessor/seq/insert.hpp +28 -0
- data/ext/boost/preprocessor/seq/pop_back.hpp +29 -0
- data/ext/boost/preprocessor/seq/pop_front.hpp +27 -0
- data/ext/boost/preprocessor/seq/push_back.hpp +19 -0
- data/ext/boost/preprocessor/seq/push_front.hpp +19 -0
- data/ext/boost/preprocessor/seq/remove.hpp +29 -0
- data/ext/boost/preprocessor/seq/replace.hpp +29 -0
- data/ext/boost/preprocessor/seq/rest_n.hpp +30 -0
- data/ext/boost/preprocessor/seq/reverse.hpp +39 -0
- data/ext/boost/preprocessor/seq/subseq.hpp +28 -0
- data/ext/boost/preprocessor/seq/to_array.hpp +28 -0
- data/ext/boost/preprocessor/seq/to_list.hpp +29 -0
- data/ext/boost/preprocessor/seq/to_tuple.hpp +27 -0
- data/ext/boost/preprocessor/seq/transform.hpp +48 -0
- data/ext/boost/preprocessor/slot.hpp +17 -0
- data/ext/boost/preprocessor/slot/counter.hpp +25 -0
- data/ext/boost/preprocessor/slot/detail/counter.hpp +269 -0
- data/ext/boost/preprocessor/slot/detail/slot1.hpp +267 -0
- data/ext/boost/preprocessor/slot/detail/slot2.hpp +267 -0
- data/ext/boost/preprocessor/slot/detail/slot3.hpp +267 -0
- data/ext/boost/preprocessor/slot/detail/slot4.hpp +267 -0
- data/ext/boost/preprocessor/slot/detail/slot5.hpp +267 -0
- data/ext/boost/preprocessor/tuple.hpp +28 -0
- data/ext/boost/preprocessor/tuple/enum.hpp +22 -0
- data/ext/boost/preprocessor/tuple/reverse.hpp +114 -0
- data/ext/boost/preprocessor/tuple/size.hpp +28 -0
- data/ext/boost/preprocessor/tuple/to_array.hpp +37 -0
- data/ext/boost/preprocessor/tuple/to_seq.hpp +114 -0
- data/ext/boost/preprocessor/variadic.hpp +23 -0
- data/ext/boost/preprocessor/variadic/to_array.hpp +32 -0
- data/ext/boost/preprocessor/variadic/to_list.hpp +25 -0
- data/ext/boost/preprocessor/variadic/to_seq.hpp +25 -0
- data/ext/boost/preprocessor/variadic/to_tuple.hpp +24 -0
- data/ext/boost/preprocessor/while.hpp +17 -0
- data/ext/boost/preprocessor/wstringize.hpp +29 -0
- data/ext/boost/smart_ptr/intrusive_ptr.hpp +324 -0
- data/ext/common/AccountsDatabase.h +3 -4
- data/ext/common/AgentsStarter.cpp +12 -15
- data/ext/common/AgentsStarter.h +54 -120
- data/ext/common/ApplicationPool2/AppTypes.cpp +12 -5
- data/ext/common/ApplicationPool2/AppTypes.h +21 -14
- data/ext/common/ApplicationPool2/Common.h +36 -19
- data/ext/common/ApplicationPool2/DirectSpawner.h +15 -16
- data/ext/common/ApplicationPool2/DummySpawner.h +9 -8
- data/ext/common/ApplicationPool2/ErrorRenderer.h +1 -1
- data/ext/common/ApplicationPool2/Group.h +304 -171
- data/ext/common/ApplicationPool2/Implementation.cpp +234 -125
- data/ext/common/ApplicationPool2/Options.h +50 -62
- data/ext/common/ApplicationPool2/Pool.h +285 -189
- data/ext/common/ApplicationPool2/Process.h +126 -115
- data/ext/common/ApplicationPool2/Session.h +70 -30
- data/ext/common/ApplicationPool2/SmartSpawner.h +19 -18
- data/ext/common/ApplicationPool2/Socket.h +57 -43
- data/ext/common/ApplicationPool2/SpawnObject.h +83 -0
- data/ext/common/ApplicationPool2/Spawner.h +59 -38
- data/ext/common/ApplicationPool2/SpawnerFactory.h +8 -14
- data/ext/common/ApplicationPool2/SuperGroup.h +69 -40
- data/ext/common/BackgroundEventLoop.cpp +48 -1
- data/ext/common/BackgroundEventLoop.h +3 -1
- data/ext/common/Constants.h +30 -8
- data/ext/common/DataStructures/HashedStaticString.h +103 -0
- data/ext/common/DataStructures/LString.h +396 -0
- data/ext/common/DataStructures/StringKeyTable.h +588 -0
- data/ext/common/EventedMessageServer.h +1 -0
- data/ext/common/FileDescriptor.h +5 -0
- data/ext/common/InstanceDirectory.h +240 -0
- data/ext/common/Logging.cpp +38 -13
- data/ext/common/Logging.h +53 -22
- data/ext/common/MemoryKit/mbuf.cpp +413 -0
- data/ext/common/MemoryKit/mbuf.h +266 -0
- data/ext/common/MemoryKit/palloc.cpp +337 -0
- data/ext/common/MemoryKit/palloc.h +121 -0
- data/ext/common/ResourceLocator.h +62 -6
- data/ext/common/SafeLibev.h +4 -4
- data/ext/common/ServerKit/AcceptLoadBalancer.h +275 -0
- data/ext/common/ServerKit/Channel.h +747 -0
- data/ext/common/ServerKit/Client.h +166 -0
- data/ext/common/ServerKit/ClientRef.h +130 -0
- data/ext/common/ServerKit/Context.h +129 -0
- data/ext/common/ServerKit/Errors.h +103 -0
- data/ext/common/ServerKit/FdSinkChannel.h +206 -0
- data/ext/common/ServerKit/FdSourceChannel.h +230 -0
- data/ext/common/ServerKit/FileBufferedChannel.h +1399 -0
- data/ext/common/ServerKit/FileBufferedFdSinkChannel.h +228 -0
- data/ext/common/ServerKit/HeaderTable.h +472 -0
- data/ext/common/ServerKit/Hooks.h +79 -0
- data/ext/common/ServerKit/HttpChunkedBodyParser.h +289 -0
- data/ext/common/ServerKit/HttpChunkedBodyParserState.h +70 -0
- data/ext/common/ServerKit/HttpClient.h +94 -0
- data/ext/common/ServerKit/HttpHeaderParser.h +477 -0
- data/ext/common/ServerKit/HttpHeaderParserState.h +60 -0
- data/ext/common/ServerKit/HttpRequest.h +276 -0
- data/ext/common/ServerKit/HttpRequestRef.h +130 -0
- data/ext/common/ServerKit/HttpServer.h +1152 -0
- data/ext/common/ServerKit/Implementation.cpp +47 -0
- data/ext/common/ServerKit/Server.h +1040 -0
- data/ext/common/ServerKit/http_parser.cpp +2259 -0
- data/ext/common/ServerKit/http_parser.h +330 -0
- data/ext/common/StaticString.h +8 -0
- data/ext/common/Utils.cpp +14 -12
- data/ext/common/Utils.h +9 -103
- data/ext/common/Utils/BufferedIO.h +1 -0
- data/ext/common/Utils/CachedFileStat.hpp +1 -7
- data/ext/common/Utils/DateParsing.h +379 -0
- data/ext/common/Utils/FileChangeChecker.h +3 -9
- data/ext/common/Utils/Hasher.cpp +52 -0
- data/ext/common/Utils/Hasher.h +58 -0
- data/ext/common/Utils/IOUtils.cpp +62 -62
- data/ext/common/Utils/JsonUtils.h +21 -0
- data/ext/common/Utils/OptionParsing.h +75 -0
- data/ext/common/Utils/StrIntUtils.cpp +112 -19
- data/ext/common/Utils/StrIntUtils.h +52 -12
- data/ext/common/Utils/StrIntUtilsNoStrictAliasing.cpp +174 -0
- data/ext/common/Utils/VariantMap.h +18 -7
- data/ext/common/Utils/modp_b64.cpp +290 -0
- data/ext/common/Utils/modp_b64.h +241 -0
- data/ext/common/Utils/modp_b64_data.h +479 -0
- data/ext/common/Utils/sysqueue.h +811 -0
- data/ext/common/agents/Base.cpp +71 -98
- data/ext/common/agents/Base.h +11 -3
- data/ext/common/agents/HelperAgent/AdminServer.h +690 -0
- data/ext/common/agents/HelperAgent/Main.cpp +899 -487
- data/ext/common/agents/HelperAgent/OptionParser.h +311 -0
- data/ext/common/agents/HelperAgent/RequestHandler.h +315 -2548
- data/ext/common/agents/HelperAgent/RequestHandler/AppResponse.h +225 -0
- data/ext/common/agents/HelperAgent/RequestHandler/BufferBody.cpp +93 -0
- data/ext/common/agents/HelperAgent/RequestHandler/CheckoutSession.cpp +346 -0
- data/ext/common/agents/HelperAgent/RequestHandler/Client.h +54 -0
- data/ext/common/agents/HelperAgent/RequestHandler/ForwardResponse.cpp +846 -0
- data/ext/common/agents/HelperAgent/RequestHandler/Hooks.cpp +231 -0
- data/ext/common/agents/HelperAgent/RequestHandler/InitRequest.cpp +434 -0
- data/ext/common/agents/HelperAgent/RequestHandler/Request.h +149 -0
- data/ext/common/agents/HelperAgent/RequestHandler/SendRequest.cpp +887 -0
- data/ext/common/agents/HelperAgent/RequestHandler/TurboCaching.h +293 -0
- data/ext/common/agents/HelperAgent/RequestHandler/Utils.cpp +301 -0
- data/ext/common/agents/HelperAgent/ResponseCache.h +624 -0
- data/ext/common/agents/HelperAgent/SystemMetricsTool.cpp +21 -23
- data/ext/common/agents/LoggingAgent/AdminServer.h +369 -0
- data/ext/common/agents/LoggingAgent/LoggingServer.h +1 -0
- data/ext/common/agents/LoggingAgent/Main.cpp +422 -215
- data/ext/common/agents/LoggingAgent/OptionParser.h +167 -0
- data/ext/common/agents/LoggingAgent/RemoteSender.h +3 -3
- data/ext/common/agents/Main.cpp +107 -0
- data/ext/common/agents/SpawnPreparer/Main.cpp +207 -0
- data/ext/common/agents/TempDirToucher/Main.cpp +429 -0
- data/ext/common/agents/Watchdog/AdminServer.h +390 -0
- data/ext/common/agents/Watchdog/AgentWatcher.cpp +7 -5
- data/ext/common/agents/Watchdog/HelperAgentWatcher.cpp +18 -39
- data/ext/common/agents/Watchdog/InstanceDirToucher.cpp +116 -0
- data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +13 -17
- data/ext/common/agents/Watchdog/Main.cpp +743 -202
- data/ext/libeio/eio.c +17 -0
- data/ext/libeio/eio.h +2 -0
- data/ext/nginx/CacheLocationConfig.c +177 -198
- data/ext/nginx/CacheLocationConfig.c.erb +35 -22
- data/ext/nginx/Configuration.c +402 -236
- data/ext/nginx/Configuration.h +12 -5
- data/ext/nginx/ConfigurationCommands.c +35 -15
- data/ext/nginx/ConfigurationCommands.c.erb +4 -4
- data/ext/nginx/ConfigurationFields.h +9 -5
- data/ext/nginx/ConfigurationFields.h.erb +3 -1
- data/ext/nginx/ContentHandler.c +393 -362
- data/ext/nginx/CreateLocationConfig.c +8 -4
- data/ext/nginx/CreateLocationConfig.c.erb +8 -3
- data/ext/nginx/MergeLocationConfig.c +36 -6
- data/ext/nginx/MergeLocationConfig.c.erb +42 -1
- data/ext/nginx/ngx_http_passenger_module.c +28 -15
- data/ext/oxt/detail/backtrace_disabled.hpp +2 -1
- data/ext/oxt/detail/backtrace_enabled.hpp +15 -2
- data/ext/oxt/implementation.cpp +92 -20
- data/ext/oxt/thread.hpp +5 -0
- data/ext/ruby/extconf.rb +3 -6
- data/ext/ruby/passenger_native_support.c +13 -40
- data/helper-scripts/download_binaries/extconf.rb +4 -4
- data/helper-scripts/meteor-loader.rb +12 -112
- data/helper-scripts/node-loader.js +3 -91
- data/helper-scripts/rack-loader.rb +13 -14
- data/helper-scripts/rack-preloader.rb +16 -17
- data/helper-scripts/wsgi-loader.py +11 -7
- data/lib/phusion_passenger.rb +100 -79
- data/lib/phusion_passenger/abstract_installer.rb +28 -3
- data/lib/phusion_passenger/admin_tools.rb +3 -3
- data/lib/phusion_passenger/admin_tools/instance.rb +207 -0
- data/lib/phusion_passenger/admin_tools/instance_registry.rb +98 -0
- data/lib/phusion_passenger/apache2/config_options.rb +72 -22
- data/lib/phusion_passenger/common_library.rb +79 -14
- data/lib/phusion_passenger/config/about_command.rb +17 -23
- data/lib/phusion_passenger/config/admin_command_command.rb +175 -0
- data/lib/phusion_passenger/config/agent_compiler.rb +170 -0
- data/lib/phusion_passenger/config/command.rb +1 -4
- data/lib/phusion_passenger/config/compile_agent_command.rb +102 -0
- data/lib/phusion_passenger/config/compile_nginx_engine_command.rb +112 -0
- data/lib/phusion_passenger/config/detach_process_command.rb +32 -10
- data/lib/phusion_passenger/config/download_agent_command.rb +285 -0
- data/lib/phusion_passenger/config/download_nginx_engine_command.rb +281 -0
- data/lib/phusion_passenger/config/install_agent_command.rb +174 -0
- data/lib/phusion_passenger/config/install_standalone_runtime_command.rb +231 -0
- data/lib/phusion_passenger/config/installation_utils.rb +241 -0
- data/lib/phusion_passenger/config/list_instances_command.rb +13 -25
- data/lib/phusion_passenger/config/main.rb +43 -14
- data/lib/phusion_passenger/config/nginx_engine_compiler.rb +337 -0
- data/lib/phusion_passenger/config/reopen_logs_command.rb +110 -0
- data/lib/phusion_passenger/config/restart_app_command.rb +61 -14
- data/lib/phusion_passenger/config/system_metrics_command.rb +2 -1
- data/lib/phusion_passenger/config/utils.rb +64 -39
- data/lib/phusion_passenger/config/validate_install_command.rb +2 -2
- data/lib/phusion_passenger/constants.rb +27 -6
- data/lib/phusion_passenger/debug_logging.rb +32 -15
- data/lib/phusion_passenger/loader_shared_helpers.rb +2 -5
- data/lib/phusion_passenger/message_client.rb +21 -22
- data/lib/phusion_passenger/native_support.rb +26 -31
- data/lib/phusion_passenger/nginx/config_options.rb +32 -19
- data/lib/phusion_passenger/packaging.rb +7 -3
- data/lib/phusion_passenger/platform_info/cxx_portability.rb +1 -2
- data/lib/phusion_passenger/platform_info/depcheck_specs/libs.rb +3 -4
- data/lib/phusion_passenger/platform_info/operating_system.rb +6 -6
- data/lib/phusion_passenger/preloader_shared_helpers.rb +2 -2
- data/lib/phusion_passenger/rack/out_of_band_gc.rb +2 -2
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +168 -65
- data/lib/phusion_passenger/request_handler.rb +47 -82
- data/lib/phusion_passenger/request_handler/thread_handler.rb +46 -10
- data/lib/phusion_passenger/ruby_core_enhancements.rb +25 -77
- data/lib/phusion_passenger/ruby_core_io_enhancements.rb +108 -0
- data/lib/phusion_passenger/standalone/app_finder.rb +39 -59
- data/lib/phusion_passenger/standalone/command.rb +27 -275
- data/lib/phusion_passenger/standalone/command2.rb +292 -0
- data/lib/phusion_passenger/standalone/config_utils.rb +87 -0
- data/lib/phusion_passenger/standalone/control_utils.rb +88 -0
- data/lib/phusion_passenger/standalone/main.rb +69 -71
- data/lib/phusion_passenger/standalone/start2_command.rb +799 -0
- data/lib/phusion_passenger/standalone/start_command.rb +406 -467
- data/lib/phusion_passenger/standalone/start_command/builtin_engine.rb +167 -0
- data/lib/phusion_passenger/standalone/start_command/nginx_engine.rb +165 -0
- data/lib/phusion_passenger/standalone/status_command.rb +64 -23
- data/lib/phusion_passenger/standalone/stop_command.rb +69 -32
- data/lib/phusion_passenger/standalone/version_command.rb +1 -5
- data/lib/phusion_passenger/utils.rb +0 -4
- data/lib/phusion_passenger/utils/json.rb +70 -4
- data/lib/phusion_passenger/utils/progress_bar.rb +56 -0
- data/lib/phusion_passenger/utils/tee_input.rb +3 -3
- data/lib/phusion_passenger/utils/unseekable_socket.rb +30 -0
- data/packaging/rpm/nginx_spec/nginx.spec.template +4 -3
- data/packaging/rpm/passenger_spec/passenger.spec.template +6 -10
- data/packaging/rpm/setup-system +2 -1
- data/resources/oss-binaries.phusionpassenger.com.crt +208 -0
- data/resources/templates/config/agent_compiler/confirm_enable_optimizations.txt.erb +5 -0
- data/resources/templates/config/installation_utils/cannot_create_user_support_binaries_dir.txt.erb +15 -0
- data/resources/templates/config/installation_utils/download_tool_missing.txt.erb +7 -0
- data/resources/templates/config/installation_utils/passenger_not_installed_as_root.txt.erb +12 -0
- data/resources/templates/config/installation_utils/support_binaries_dir_not_writable_despite_running_as_root.txt.erb +13 -0
- data/resources/templates/config/installation_utils/unexpected_filesystem_problem.txt.erb +16 -0
- data/{packaging/debian/debian_specs/passenger/patches/series → resources/templates/config/installation_utils/user_support_binaries_dir_not_writable.txt.erb} +0 -0
- data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +2 -2
- data/resources/templates/standalone/config.erb +14 -16
- data/resources/templates/standalone/possible_solutions_for_download_and_extraction_problems.txt.erb +1 -1
- data/test/.rspec +1 -0
- data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +20 -17
- data/test/cxx/ApplicationPool2/OptionsTest.cpp +0 -14
- data/test/cxx/ApplicationPool2/PoolTest.cpp +113 -90
- data/test/cxx/ApplicationPool2/ProcessTest.cpp +18 -27
- data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +51 -53
- data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +55 -57
- data/test/cxx/BufferedIOTest.cpp +40 -40
- data/test/cxx/CxxTestMain.cpp +4 -22
- data/test/cxx/DataStructures/LStringTest.cpp +275 -0
- data/test/cxx/DataStructures/StringKeyTableTest.cpp +199 -0
- data/test/cxx/MemoryKit/MbufTest.cpp +213 -0
- data/test/cxx/MessageServerTest.cpp +62 -55
- data/test/cxx/RequestHandlerTest.cpp +26 -27
- data/test/cxx/ServerKit/ChannelTest.cpp +1467 -0
- data/test/cxx/ServerKit/FileBufferedChannelTest.cpp +817 -0
- data/test/cxx/ServerKit/HeaderTableTest.cpp +171 -0
- data/test/cxx/ServerKit/HttpServerTest.cpp +1503 -0
- data/test/cxx/ServerKit/ServerTest.cpp +408 -0
- data/test/cxx/TestSupport.cpp +51 -15
- data/test/cxx/TestSupport.h +31 -21
- data/test/cxx/UnionStationTest.cpp +121 -122
- data/test/cxx/UtilsTest.cpp +9 -33
- data/test/integration_tests/apache2_tests.rb +65 -27
- data/test/integration_tests/downloaded_binaries_tests.rb +30 -6
- data/test/integration_tests/native_packaging_spec.rb +32 -17
- data/test/integration_tests/nginx_tests.rb +28 -10
- data/test/integration_tests/shared/example_webapp_tests.rb +40 -27
- data/test/integration_tests/standalone_tests.rb +232 -169
- data/test/ruby/debug_logging_spec.rb +44 -40
- data/test/ruby/rails3.0/preloader_spec.rb +1 -1
- data/test/ruby/rails3.1/preloader_spec.rb +1 -1
- data/test/ruby/rails3.2/preloader_spec.rb +1 -1
- data/test/ruby/rails4.0/preloader_spec.rb +1 -1
- data/test/ruby/rails4.1/preloader_spec.rb +1 -1
- data/test/ruby/request_handler_spec.rb +62 -24
- data/test/ruby/shared/loader_sharedspec.rb +10 -9
- data/test/ruby/shared/rails/union_station_extensions_sharedspec.rb +23 -22
- data/test/ruby/spec_helper.rb +2 -11
- data/test/ruby/standalone/runtime_installer_spec.rb +15 -13
- data/test/ruby/union_station_spec.rb +45 -40
- data/test/ruby/utils/tee_input_spec.rb +5 -5
- data/test/ruby/utils_spec.rb +3 -39
- data/test/stub/apache2/httpd.conf.erb +5 -2
- data/test/stub/nginx/nginx.conf.erb +3 -1
- data/test/support/apache2_controller.rb +25 -25
- data/test/support/nginx_controller.rb +14 -14
- data/test/support/test_helper.rb +74 -75
- metadata +439 -643
- metadata.gz.asc +7 -7
- data/ext/common/MultiLibeio.cpp +0 -204
- data/ext/common/MultiLibeio.h +0 -67
- data/ext/common/ServerInstanceDir.h +0 -402
- data/ext/common/Utils/Base64.cpp +0 -143
- data/ext/common/Utils/Base64.h +0 -83
- data/ext/common/Utils/HttpHeaderBufferer.h +0 -184
- data/ext/common/Utils/PriorityQueue.h +0 -54
- data/ext/common/Utils/StreamBoyerMooreHorspool.h +0 -512
- data/ext/common/Utils/fib.c +0 -699
- data/ext/common/Utils/fib.h +0 -101
- data/ext/common/Utils/fibpriv.h +0 -67
- data/ext/common/agents/EnvPrinter.c +0 -16
- data/ext/common/agents/HelperAgent/AgentOptions.h +0 -109
- data/ext/common/agents/HelperAgent/FileBackedPipe.h +0 -732
- data/ext/common/agents/HelperAgent/RequestHandler.cpp +0 -294
- data/ext/common/agents/HelperAgent/ScgiRequestParser.h +0 -457
- data/ext/common/agents/LoggingAgent/AdminController.h +0 -96
- data/ext/common/agents/SpawnPreparer.cpp +0 -206
- data/ext/common/agents/TempDirToucher.c +0 -383
- data/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp +0 -116
- data/helper-scripts/classic-rails-loader.rb +0 -166
- data/helper-scripts/classic-rails-preloader.rb +0 -193
- data/lib/phusion_passenger/admin_tools/server_instance.rb +0 -339
- data/lib/phusion_passenger/classic_rails/cgi_fixed.rb +0 -68
- data/lib/phusion_passenger/classic_rails/thread_handler_extension.rb +0 -40
- data/lib/phusion_passenger/platform_info/openssl.rb +0 -61
- data/lib/phusion_passenger/standalone/config_file.rb +0 -119
- data/lib/phusion_passenger/standalone/help_command.rb +0 -57
- data/lib/phusion_passenger/standalone/runtime_installer.rb +0 -712
- data/lib/phusion_passenger/standalone/runtime_locator.rb +0 -170
- data/lib/phusion_passenger/standalone/utils.rb +0 -58
- data/lib/phusion_passenger/utils/tmpdir.rb +0 -69
- data/packaging/debian/LICENSE.md +0 -19
- data/packaging/debian/README.md +0 -320
- data/packaging/debian/Vagrantfile +0 -25
- data/packaging/debian/build +0 -210
- data/packaging/debian/debian_specs/nginx/changelog +0 -1989
- data/packaging/debian/debian_specs/nginx/compat.erb +0 -5
- data/packaging/debian/debian_specs/nginx/conf/fastcgi.conf +0 -25
- data/packaging/debian/debian_specs/nginx/conf/fastcgi_params +0 -24
- data/packaging/debian/debian_specs/nginx/conf/koi-utf +0 -109
- data/packaging/debian/debian_specs/nginx/conf/koi-win +0 -103
- data/packaging/debian/debian_specs/nginx/conf/mime.types +0 -89
- data/packaging/debian/debian_specs/nginx/conf/nginx.conf.erb +0 -97
- data/packaging/debian/debian_specs/nginx/conf/proxy_params +0 -4
- data/packaging/debian/debian_specs/nginx/conf/scgi_params +0 -16
- data/packaging/debian/debian_specs/nginx/conf/sites-available/default.erb +0 -93
- data/packaging/debian/debian_specs/nginx/conf/snippets/fastcgi-php.conf +0 -13
- data/packaging/debian/debian_specs/nginx/conf/snippets/snakeoil.conf +0 -5
- data/packaging/debian/debian_specs/nginx/conf/uwsgi_params +0 -16
- data/packaging/debian/debian_specs/nginx/conf/win-utf +0 -125
- data/packaging/debian/debian_specs/nginx/control.erb +0 -226
- data/packaging/debian/debian_specs/nginx/copyright +0 -196
- data/packaging/debian/debian_specs/nginx/debian-full.lintian-overrides +0 -1
- data/packaging/debian/debian_specs/nginx/gbp.conf +0 -2
- data/packaging/debian/debian_specs/nginx/help/docs/fcgiwrap +0 -14
- data/packaging/debian/debian_specs/nginx/help/docs/php +0 -119
- data/packaging/debian/debian_specs/nginx/help/docs/support-irc +0 -28
- data/packaging/debian/debian_specs/nginx/help/docs/upstream +0 -51
- data/packaging/debian/debian_specs/nginx/help/examples/drupal +0 -114
- data/packaging/debian/debian_specs/nginx/help/examples/http +0 -59
- data/packaging/debian/debian_specs/nginx/help/examples/mail +0 -30
- data/packaging/debian/debian_specs/nginx/help/examples/mailman +0 -59
- data/packaging/debian/debian_specs/nginx/help/examples/nginx.conf +0 -34
- data/packaging/debian/debian_specs/nginx/help/examples/nginx_modsite +0 -162
- data/packaging/debian/debian_specs/nginx/help/examples/virtual_hosts +0 -155
- data/packaging/debian/debian_specs/nginx/help/examples/wordpress +0 -74
- data/packaging/debian/debian_specs/nginx/helpers.rb +0 -41
- data/packaging/debian/debian_specs/nginx/index-debian.html.in +0 -32
- data/packaging/debian/debian_specs/nginx/index-ubuntu.html.in +0 -32
- data/packaging/debian/debian_specs/nginx/index.html.erb +0 -10
- data/packaging/debian/debian_specs/nginx/modules/README.Modules-versions +0 -65
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/README.markdown +0 -510
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/config +0 -5
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/doc/HttpHeadersMoreModule.wiki +0 -395
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/src/ddebug.h +0 -119
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/src/ngx_http_headers_more_filter_module.c +0 -348
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/src/ngx_http_headers_more_filter_module.h +0 -80
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_in.c +0 -826
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_in.h +0 -26
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_out.c +0 -716
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/src/ngx_http_headers_more_headers_out.h +0 -26
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/src/ngx_http_headers_more_util.c +0 -380
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/src/ngx_http_headers_more_util.h +0 -52
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/util/build.sh +0 -32
- data/packaging/debian/debian_specs/nginx/modules/headers-more-nginx-module/valgrind.suppress +0 -215
- data/packaging/debian/debian_specs/nginx/modules/nginx-auth-pam/ChangeLog +0 -35
- data/packaging/debian/debian_specs/nginx/modules/nginx-auth-pam/LICENSE +0 -25
- data/packaging/debian/debian_specs/nginx/modules/nginx-auth-pam/README.md +0 -93
- data/packaging/debian/debian_specs/nginx/modules/nginx-auth-pam/config +0 -4
- data/packaging/debian/debian_specs/nginx/modules/nginx-auth-pam/ngx_http_auth_pam_module.c +0 -462
- data/packaging/debian/debian_specs/nginx/modules/nginx-cache-purge/CHANGES +0 -66
- data/packaging/debian/debian_specs/nginx/modules/nginx-cache-purge/LICENSE +0 -26
- data/packaging/debian/debian_specs/nginx/modules/nginx-cache-purge/README.md +0 -171
- data/packaging/debian/debian_specs/nginx/modules/nginx-cache-purge/TODO.md +0 -7
- data/packaging/debian/debian_specs/nginx/modules/nginx-cache-purge/config +0 -21
- data/packaging/debian/debian_specs/nginx/modules/nginx-cache-purge/ngx_cache_purge_module.c +0 -1803
- data/packaging/debian/debian_specs/nginx/modules/nginx-dav-ext-module/README +0 -29
- data/packaging/debian/debian_specs/nginx/modules/nginx-dav-ext-module/config +0 -9
- data/packaging/debian/debian_specs/nginx/modules/nginx-dav-ext-module/ngx_http_dav_ext_module.c +0 -824
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/README +0 -139
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/README_AUTO_LIB +0 -395
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/TODO +0 -1
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/actions/array +0 -10
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/actions/palloc +0 -8
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/build +0 -597
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/action_replacements +0 -5
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/action_types +0 -12
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/conf_args +0 -22
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/conf_locs +0 -25
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/conf_macros +0 -35
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/contexts +0 -22
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/header_files +0 -3
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/headers +0 -4
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/module_dependencies +0 -5
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/modules_optional +0 -15
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/data/prefixes +0 -2
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/src/array.h +0 -7
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/src/conf_cmd_basic.h +0 -43
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/src/conf_merge.h +0 -78
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/src/palloc.h +0 -6
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/auto/text/autogen +0 -12
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/config +0 -49
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/docs/core/action_macros +0 -63
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/docs/core/conf_cmds +0 -62
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/docs/modules/set_var +0 -124
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/docs/patches/more_logging_info +0 -48
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/docs/upstream/list +0 -45
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/examples/README +0 -12
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/examples/http/set_var/config +0 -4
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/examples/http/set_var/ngx_http_set_var_examples_module.c +0 -136
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/ngx_auto_lib_core +0 -797
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/notes/CHANGES +0 -17
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/notes/LICENSE +0 -24
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/objs/ndk_array.h +0 -113
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/objs/ndk_conf_cmd_basic.h +0 -2203
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/objs/ndk_conf_cmd_extra.h +0 -5423
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/objs/ndk_conf_merge.h +0 -227
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/objs/ndk_config.c +0 -72
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/objs/ndk_config.h +0 -98
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/objs/ndk_includes.h +0 -66
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/objs/ndk_palloc.h +0 -112
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/patches/auto_config +0 -16
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/patches/expose_rewrite_functions +0 -291
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/patches/rewrite_phase_handler +0 -19
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/hash/md5.h +0 -117
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/hash/murmurhash2.c +0 -77
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/hash/sha.h +0 -200
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk.c +0 -155
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk.h +0 -58
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_buf.c +0 -43
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_buf.h +0 -5
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_complex_path.c +0 -129
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_complex_path.h +0 -30
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_complex_value.c +0 -192
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_complex_value.h +0 -21
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_conf_file.c +0 -396
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_conf_file.h +0 -44
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_debug.c +0 -72
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_debug.h +0 -171
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_encoding.c +0 -57
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_encoding.h +0 -12
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_hash.c +0 -82
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_hash.h +0 -45
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_http.c +0 -138
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_http.h +0 -3
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_http_headers.h +0 -35
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_log.c +0 -3
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_log.h +0 -165
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_parse.h +0 -67
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_path.c +0 -583
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_path.h +0 -22
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_process.c +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_process.h +0 -12
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_regex.c +0 -215
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_regex.h +0 -7
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_rewrite.c +0 -103
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_rewrite.h +0 -26
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_set_var.c +0 -602
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_set_var.h +0 -44
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_string.c +0 -434
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_string.h +0 -37
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_string_util.h +0 -14
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_upstream_list.c +0 -205
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_upstream_list.h +0 -27
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_uri.c +0 -45
- data/packaging/debian/debian_specs/nginx/modules/nginx-development-kit/src/ndk_uri.h +0 -6
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/LICENSE +0 -25
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/README.markdown +0 -1850
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/config +0 -5
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/doc/HttpEchoModule.wiki +0 -1558
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ddebug.h +0 -109
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_echo.c +0 -344
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_echo.h +0 -25
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_filter.c +0 -282
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_filter.h +0 -15
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_foreach.c +0 -183
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_foreach.h +0 -16
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_handler.c +0 -429
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_handler.h +0 -18
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_location.c +0 -178
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_location.h +0 -13
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_module.c +0 -667
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_module.h +0 -137
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_request_info.c +0 -452
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_request_info.h +0 -31
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_sleep.c +0 -208
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_sleep.h +0 -16
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_subrequest.c +0 -788
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_subrequest.h +0 -19
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_timer.c +0 -96
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_timer.h +0 -13
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_util.c +0 -298
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_util.h +0 -58
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_var.c +0 -110
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/src/ngx_http_echo_var.h +0 -9
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/util/build.sh +0 -45
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/util/releng +0 -8
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/util/wiki2pod.pl +0 -131
- data/packaging/debian/debian_specs/nginx/modules/nginx-echo/valgrind.suppress +0 -38
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/LICENCE +0 -24
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/README +0 -206
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/changelog.txt +0 -54
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/config +0 -26
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/protocol.txt +0 -191
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/ngx_http_push_defs.c +0 -59
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/ngx_http_push_defs.h +0 -73
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/ngx_http_push_module.c +0 -783
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/ngx_http_push_module.h +0 -31
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/ngx_http_push_module_setup.c +0 -361
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/ngx_http_push_types.h +0 -120
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/store/memory/store.c +0 -1180
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/store/memory/store.h +0 -1
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/store/ngx_http_push_module_ipc.c +0 -146
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/store/ngx_http_push_module_ipc.h +0 -5
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/store/ngx_http_push_store.h +0 -51
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/store/ngx_rwlock.c +0 -178
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/store/ngx_rwlock.h +0 -5
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/store/rbtree_util.c +0 -246
- data/packaging/debian/debian_specs/nginx/modules/nginx-http-push/src/store/rbtree_util.h +0 -9
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/Changes +0 -51
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/README.markdown +0 -6954
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/config +0 -363
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/doc/HttpLuaModule.wiki +0 -5898
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/dtrace/ngx_lua_provider.d +0 -61
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/misc/recv-until-pm/Makefile +0 -3
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/misc/recv-until-pm/lib/RecvUntil.pm +0 -138
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/misc/recv-until-pm/t/sanity.t +0 -140
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/api/ngx_http_lua_api.h +0 -52
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ddebug.h +0 -82
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_accessby.c +0 -377
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_accessby.h +0 -22
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_api.c +0 -77
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_args.c +0 -537
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_args.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_bodyfilterby.c +0 -632
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_bodyfilterby.h +0 -31
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_cache.c +0 -296
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_cache.h +0 -24
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_capturefilter.c +0 -175
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_capturefilter.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_clfactory.c +0 -887
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_clfactory.h +0 -22
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_common.h +0 -478
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_config.c +0 -67
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_config.h +0 -19
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_consts.c +0 -148
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_consts.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_contentby.c +0 -369
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_contentby.h +0 -26
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_control.c +0 -483
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_control.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_coroutine.c +0 -379
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_coroutine.h +0 -23
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_ctx.c +0 -216
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_ctx.h +0 -23
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_directive.c +0 -1081
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_directive.h +0 -56
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_exception.c +0 -58
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_exception.h +0 -33
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_headerfilterby.c +0 -302
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_headerfilterby.h +0 -29
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_headers.c +0 -1370
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_headers.h +0 -22
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_headers_in.c +0 -782
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_headers_in.h +0 -22
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_headers_out.c +0 -625
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_headers_out.h +0 -23
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_initby.c +0 -42
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_initby.h +0 -23
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_initworkerby.c +0 -320
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_initworkerby.h +0 -25
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_log.c +0 -300
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_log.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_logby.c +0 -227
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_logby.h +0 -22
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_misc.c +0 -252
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_misc.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_module.c +0 -924
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_ndk.c +0 -184
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_ndk.h +0 -21
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_output.c +0 -794
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_output.h +0 -28
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_pcrefix.c +0 -106
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_pcrefix.h +0 -23
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_phase.c +0 -94
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_phase.h +0 -13
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_probe.h +0 -85
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_regex.c +0 -2468
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_regex.h +0 -22
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_req_body.c +0 -1169
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_req_body.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_req_method.c +0 -252
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_req_method.h +0 -19
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_rewriteby.c +0 -351
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_rewriteby.h +0 -22
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_script.c +0 -538
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_script.h +0 -86
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_setby.c +0 -216
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_setby.h +0 -15
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_shdict.c +0 -1844
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_shdict.h +0 -52
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_sleep.c +0 -191
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_sleep.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_socket_tcp.c +0 -5314
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_socket_tcp.h +0 -156
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_socket_udp.c +0 -1624
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_socket_udp.h +0 -56
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_string.c +0 -704
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_string.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_subrequest.c +0 -1741
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_subrequest.h +0 -46
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_time.c +0 -278
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_time.h +0 -21
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_timer.c +0 -661
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_timer.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_uri.c +0 -110
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_uri.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_uthread.c +0 -283
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_uthread.h +0 -36
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_util.c +0 -3972
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_util.h +0 -423
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_variable.c +0 -499
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_variable.h +0 -20
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_worker.c +0 -64
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/src/ngx_http_lua_worker.h +0 -17
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/tapset/ngx_lua.stp +0 -5
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/build.sh +0 -39
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/build2.sh +0 -55
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/fix-comments +0 -27
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/gdbinit +0 -415
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/ngx-links +0 -62
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/reindex +0 -64
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/releng +0 -8
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/retab +0 -8
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/revim +0 -102
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/run_test.sh +0 -10
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/util/update-readme.sh +0 -4
- data/packaging/debian/debian_specs/nginx/modules/nginx-lua/valgrind.suppress +0 -144
- data/packaging/debian/debian_specs/nginx/modules/nginx-upload-progress/CHANGES +0 -107
- data/packaging/debian/debian_specs/nginx/modules/nginx-upload-progress/LICENSE +0 -25
- data/packaging/debian/debian_specs/nginx/modules/nginx-upload-progress/Makefile +0 -8
- data/packaging/debian/debian_specs/nginx/modules/nginx-upload-progress/README +0 -329
- data/packaging/debian/debian_specs/nginx/modules/nginx-upload-progress/config +0 -3
- data/packaging/debian/debian_specs/nginx/modules/nginx-upload-progress/ngx_http_uploadprogress_module.c +0 -1774
- data/packaging/debian/debian_specs/nginx/modules/nginx-upstream-fair/README +0 -53
- data/packaging/debian/debian_specs/nginx/modules/nginx-upstream-fair/config +0 -3
- data/packaging/debian/debian_specs/nginx/modules/nginx-upstream-fair/ngx_http_upstream_fair_module.c +0 -1356
- data/packaging/debian/debian_specs/nginx/modules/ngx-fancyindex/CHANGELOG.md +0 -37
- data/packaging/debian/debian_specs/nginx/modules/ngx-fancyindex/HACKING.md +0 -24
- data/packaging/debian/debian_specs/nginx/modules/ngx-fancyindex/LICENSE +0 -20
- data/packaging/debian/debian_specs/nginx/modules/ngx-fancyindex/README.rst +0 -182
- data/packaging/debian/debian_specs/nginx/modules/ngx-fancyindex/config +0 -8
- data/packaging/debian/debian_specs/nginx/modules/ngx-fancyindex/nginx-0.6-support.patch +0 -23
- data/packaging/debian/debian_specs/nginx/modules/ngx-fancyindex/ngx_http_fancyindex_module.c +0 -1305
- data/packaging/debian/debian_specs/nginx/modules/ngx-fancyindex/template.awk +0 -52
- data/packaging/debian/debian_specs/nginx/modules/ngx-fancyindex/template.h +0 -103
- data/packaging/debian/debian_specs/nginx/modules/ngx-fancyindex/template.html +0 -102
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/CHANGES +0 -37
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/README +0 -141
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/config +0 -3
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/doc/README.google_code_home_page.wiki +0 -120
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/doc/README.html +0 -199
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/doc/README.wiki +0 -123
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/ngx_http_subs_filter_module.c +0 -1298
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/README +0 -275
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/AutoInstall.pm +0 -820
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install.pm +0 -470
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install/AutoInstall.pm +0 -82
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install/Base.pm +0 -83
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install/Can.pm +0 -81
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install/Fetch.pm +0 -93
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install/Include.pm +0 -34
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install/Makefile.pm +0 -415
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install/Metadata.pm +0 -716
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install/TestBase.pm +0 -29
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install/Win32.pm +0 -64
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Module/Install/WriteAll.pm +0 -63
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Spiffy.pm +0 -539
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Test/Base.pm +0 -682
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Test/Base/Filter.pm +0 -341
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Test/Builder.pm +0 -1413
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Test/Builder/Module.pm +0 -81
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/inc/Test/More.pm +0 -735
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/lib/Test/Nginx.pm +0 -315
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/lib/Test/Nginx/LWP.pm +0 -524
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/lib/Test/Nginx/Socket.pm +0 -1749
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/lib/Test/Nginx/Util.pm +0 -874
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/t/subs.t +0 -136
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/t/subs_capture.t +0 -32
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/t/subs_fix_string.t +0 -32
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/t/subs_regex.t +0 -108
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/t/subs_types.t +0 -59
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/test/test.sh +0 -5
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/util/update-readme.sh +0 -7
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/util/wiki2google_code_homepage.pl +0 -29
- data/packaging/debian/debian_specs/nginx/modules/ngx_http_substitutions_filter_module/util/wiki2pod.pl +0 -129
- data/packaging/debian/debian_specs/nginx/nginx-common.NEWS +0 -135
- data/packaging/debian/debian_specs/nginx/nginx-common.README.Debian +0 -45
- data/packaging/debian/debian_specs/nginx/nginx-common.dirs.erb +0 -32
- data/packaging/debian/debian_specs/nginx/nginx-common.install +0 -3
- data/packaging/debian/debian_specs/nginx/nginx-common.lintian-overrides +0 -2
- data/packaging/debian/debian_specs/nginx/nginx-common.manpages +0 -1
- data/packaging/debian/debian_specs/nginx/nginx-common.nginx.default +0 -10
- data/packaging/debian/debian_specs/nginx/nginx-common.nginx.init.erb +0 -214
- data/packaging/debian/debian_specs/nginx/nginx-common.nginx.logrotate +0 -18
- data/packaging/debian/debian_specs/nginx/nginx-common.nginx.service.erb +0 -37
- data/packaging/debian/debian_specs/nginx/nginx-common.postinst.erb +0 -66
- data/packaging/debian/debian_specs/nginx/nginx-common.postrm.erb +0 -46
- data/packaging/debian/debian_specs/nginx/nginx-common.preinst +0 -47
- data/packaging/debian/debian_specs/nginx/nginx-common.prerm.erb +0 -28
- data/packaging/debian/debian_specs/nginx/nginx-doc.docs +0 -2
- data/packaging/debian/debian_specs/nginx/nginx-doc.examples +0 -1
- data/packaging/debian/debian_specs/nginx/nginx-extras.install.erb +0 -17
- data/packaging/debian/debian_specs/nginx/nginx-extras.lintian-overrides +0 -1
- data/packaging/debian/debian_specs/nginx/nginx-extras.postinst.erb +0 -44
- data/packaging/debian/debian_specs/nginx/nginx-extras.prerm +0 -22
- data/packaging/debian/debian_specs/nginx/nginx.1 +0 -47
- data/packaging/debian/debian_specs/nginx/patches/perl-use-dpkg-buildflags.patch +0 -23
- data/packaging/debian/debian_specs/nginx/patches/series +0 -1
- data/packaging/debian/debian_specs/nginx/rules.erb +0 -185
- data/packaging/debian/debian_specs/nginx/source/format +0 -1
- data/packaging/debian/debian_specs/nginx/tests/control +0 -4
- data/packaging/debian/debian_specs/nginx/ufw/nginx +0 -14
- data/packaging/debian/debian_specs/nginx/upstream/signing-key.asc +0 -34
- data/packaging/debian/debian_specs/nginx/watch +0 -3
- data/packaging/debian/debian_specs/passenger/README.Debian +0 -12
- data/packaging/debian/debian_specs/passenger/changelog +0 -316
- data/packaging/debian/debian_specs/passenger/compat +0 -1
- data/packaging/debian/debian_specs/passenger/control.erb +0 -123
- data/packaging/debian/debian_specs/passenger/copyright +0 -385
- data/packaging/debian/debian_specs/passenger/helpers.rb +0 -24
- data/packaging/debian/debian_specs/passenger/libapache2-mod-passenger.install +0 -3
- data/packaging/debian/debian_specs/passenger/libapache2-mod-passenger.postinst +0 -36
- data/packaging/debian/debian_specs/passenger/libapache2-mod-passenger.prerm +0 -15
- data/packaging/debian/debian_specs/passenger/locations.ini.erb +0 -14
- data/packaging/debian/debian_specs/passenger/passenger-dev.install.erb +0 -3
- data/packaging/debian/debian_specs/passenger/passenger-doc.install.erb +0 -2
- data/packaging/debian/debian_specs/passenger/passenger.conf +0 -6
- data/packaging/debian/debian_specs/passenger/passenger.docs +0 -4
- data/packaging/debian/debian_specs/passenger/passenger.install.erb +0 -16
- data/packaging/debian/debian_specs/passenger/passenger.load +0 -3
- data/packaging/debian/debian_specs/passenger/passenger.manpages +0 -3
- data/packaging/debian/debian_specs/passenger/passenger_free_ruby.c +0 -29
- data/packaging/debian/debian_specs/passenger/passenger_ruby_utils.c +0 -54
- data/packaging/debian/debian_specs/passenger/passenger_system_ruby.c.erb +0 -37
- data/packaging/debian/debian_specs/passenger/rules.erb +0 -84
- data/packaging/debian/debian_specs/passenger/source/format +0 -1
- data/packaging/debian/debian_specs/passenger_enterprise/README.Debian +0 -12
- data/packaging/debian/debian_specs/passenger_enterprise/changelog +0 -316
- data/packaging/debian/debian_specs/passenger_enterprise/compat +0 -1
- data/packaging/debian/debian_specs/passenger_enterprise/control.erb +0 -123
- data/packaging/debian/debian_specs/passenger_enterprise/copyright +0 -385
- data/packaging/debian/debian_specs/passenger_enterprise/helpers.rb +0 -2
- data/packaging/debian/debian_specs/passenger_enterprise/libapache2-mod-passenger-enterprise.install +0 -3
- data/packaging/debian/debian_specs/passenger_enterprise/libapache2-mod-passenger-enterprise.postinst +0 -36
- data/packaging/debian/debian_specs/passenger_enterprise/libapache2-mod-passenger-enterprise.prerm +0 -15
- data/packaging/debian/debian_specs/passenger_enterprise/locations.ini.erb +0 -14
- data/packaging/debian/debian_specs/passenger_enterprise/passenger-enterprise-dev.install.erb +0 -3
- data/packaging/debian/debian_specs/passenger_enterprise/passenger-enterprise-doc.install.erb +0 -2
- data/packaging/debian/debian_specs/passenger_enterprise/passenger-enterprise.docs +0 -4
- data/packaging/debian/debian_specs/passenger_enterprise/passenger-enterprise.install.erb +0 -14
- data/packaging/debian/debian_specs/passenger_enterprise/passenger-enterprise.manpages +0 -3
- data/packaging/debian/debian_specs/passenger_enterprise/passenger.conf +0 -6
- data/packaging/debian/debian_specs/passenger_enterprise/passenger.load +0 -3
- data/packaging/debian/debian_specs/passenger_enterprise/passenger_free_ruby.c.erb +0 -1
- data/packaging/debian/debian_specs/passenger_enterprise/passenger_ruby_utils.c.erb +0 -1
- data/packaging/debian/debian_specs/passenger_enterprise/passenger_system_ruby.c.erb +0 -1
- data/packaging/debian/debian_specs/passenger_enterprise/patches/series +0 -0
- data/packaging/debian/debian_specs/passenger_enterprise/rules.erb +0 -84
- data/packaging/debian/debian_specs/passenger_enterprise/source/format +0 -1
- data/packaging/debian/docker_images/Makefile +0 -38
- data/packaging/debian/docker_images/buildbox/CONTAINER_VERSION.txt +0 -0
- data/packaging/debian/docker_images/buildbox/Dockerfile +0 -3
- data/packaging/debian/docker_images/buildbox/Gemfile +0 -9
- data/packaging/debian/docker_images/buildbox/Gemfile.lock +0 -42
- data/packaging/debian/docker_images/buildbox/install.sh +0 -85
- data/packaging/debian/docker_images/buildbox/pbuilderrc +0 -4
- data/packaging/debian/docker_images/buildbox/sudoers.conf +0 -6
- data/packaging/debian/docker_images/setup-buildbox-docker-image +0 -7
- data/packaging/debian/docker_images/setup-testbox-docker-image-debian-6 +0 -7
- data/packaging/debian/docker_images/setup-testbox-docker-image-debian-7 +0 -7
- data/packaging/debian/docker_images/setup-testbox-docker-image-debian-8 +0 -7
- data/packaging/debian/docker_images/setup-testbox-docker-image-ubuntu-12.04 +0 -7
- data/packaging/debian/docker_images/setup-testbox-docker-image-ubuntu-14.04 +0 -7
- data/packaging/debian/docker_images/setup-testbox-docker-image-ubuntu-15.04 +0 -7
- data/packaging/debian/docker_images/setup-testbox-docker-image-ubuntu-15.10 +0 -7
- data/packaging/debian/docker_images/testbox-debian-6/Dockerfile +0 -3
- data/packaging/debian/docker_images/testbox-debian-6/Gemfile +0 -2
- data/packaging/debian/docker_images/testbox-debian-6/Gemfile.lock +0 -23
- data/packaging/debian/docker_images/testbox-debian-6/argparse.py +0 -2374
- data/packaging/debian/docker_images/testbox-debian-6/install.sh +0 -78
- data/packaging/debian/docker_images/testbox-debian-7/Dockerfile +0 -3
- data/packaging/debian/docker_images/testbox-debian-7/Gemfile +0 -2
- data/packaging/debian/docker_images/testbox-debian-7/Gemfile.lock +0 -23
- data/packaging/debian/docker_images/testbox-debian-7/install.sh +0 -71
- data/packaging/debian/docker_images/testbox-debian-8/Dockerfile +0 -3
- data/packaging/debian/docker_images/testbox-debian-8/Gemfile +0 -2
- data/packaging/debian/docker_images/testbox-debian-8/Gemfile.lock +0 -23
- data/packaging/debian/docker_images/testbox-debian-8/install.sh +0 -70
- data/packaging/debian/docker_images/testbox-ubuntu-12.04/Dockerfile +0 -3
- data/packaging/debian/docker_images/testbox-ubuntu-12.04/Gemfile +0 -2
- data/packaging/debian/docker_images/testbox-ubuntu-12.04/Gemfile.lock +0 -23
- data/packaging/debian/docker_images/testbox-ubuntu-12.04/install.sh +0 -69
- data/packaging/debian/docker_images/testbox-ubuntu-14.04/Dockerfile +0 -3
- data/packaging/debian/docker_images/testbox-ubuntu-14.04/Gemfile +0 -2
- data/packaging/debian/docker_images/testbox-ubuntu-14.04/Gemfile.lock +0 -23
- data/packaging/debian/docker_images/testbox-ubuntu-14.04/install.sh +0 -69
- data/packaging/debian/docker_images/testbox-ubuntu-15.04/Dockerfile +0 -3
- data/packaging/debian/docker_images/testbox-ubuntu-15.04/Gemfile +0 -2
- data/packaging/debian/docker_images/testbox-ubuntu-15.04/Gemfile.lock +0 -23
- data/packaging/debian/docker_images/testbox-ubuntu-15.04/install.sh +0 -69
- data/packaging/debian/docker_images/testbox-ubuntu-15.10/Dockerfile +0 -3
- data/packaging/debian/docker_images/testbox-ubuntu-15.10/Gemfile +0 -2
- data/packaging/debian/docker_images/testbox-ubuntu-15.10/Gemfile.lock +0 -23
- data/packaging/debian/docker_images/testbox-ubuntu-15.10/install.sh +0 -69
- data/packaging/debian/internal/build/Rakefile +0 -235
- data/packaging/debian/internal/build/build-passenger-orig-tarball.sh +0 -76
- data/packaging/debian/internal/build/build-source-package.rb +0 -121
- data/packaging/debian/internal/build/download-nginx-orig-tarball.sh +0 -17
- data/packaging/debian/internal/build/rakefile_support.rb +0 -96
- data/packaging/debian/internal/build/setup-environment-essentials.sh +0 -15
- data/packaging/debian/internal/build/setup-environment.sh +0 -29
- data/packaging/debian/internal/lib/distro_info.rb +0 -82
- data/packaging/debian/internal/lib/distro_info.sh +0 -303
- data/packaging/debian/internal/lib/distro_info.sh.erb +0 -65
- data/packaging/debian/internal/lib/library.sh +0 -83
- data/packaging/debian/internal/lib/preprocessor.rb +0 -173
- data/packaging/debian/internal/lib/tracking.rb +0 -95
- data/packaging/debian/internal/lib/tracking_category.rb +0 -45
- data/packaging/debian/internal/lib/tracking_database.rb +0 -132
- data/packaging/debian/internal/lib/tracking_task.rb +0 -148
- data/packaging/debian/internal/lib/utils.rb +0 -78
- data/packaging/debian/internal/publish/Rakefile +0 -97
- data/packaging/debian/internal/publish/oss-binaries.phusionpassenger.com-fingerprint.txt +0 -1
- data/packaging/debian/internal/publish/packagecloud_fingerprint.txt +0 -1
- data/packaging/debian/internal/publish/passenger_website_fingerprint.txt +0 -1
- data/packaging/debian/internal/publish/preinit.sh +0 -7
- data/packaging/debian/internal/publish/rakefile_support.rb +0 -183
- data/packaging/debian/internal/scripts/gpg_noninteractive/gpg +0 -11
- data/packaging/debian/internal/scripts/initccache.sh +0 -35
- data/packaging/debian/internal/scripts/inituidgid.sh +0 -19
- data/packaging/debian/internal/scripts/my_init +0 -340
- data/packaging/debian/internal/scripts/pin_certificates +0 -34
- data/packaging/debian/internal/scripts/regen_distro_info_script.sh +0 -3
- data/packaging/debian/internal/scripts/setup-vagrant.sh +0 -12
- data/packaging/debian/internal/scripts/setuser +0 -31
- data/packaging/debian/internal/shell/initpbuilder.sh +0 -3
- data/packaging/debian/internal/shell/preinit.sh +0 -28
- data/packaging/debian/internal/shell/sudoers.conf +0 -1
- data/packaging/debian/internal/test/apache/apache-24.conf +0 -5
- data/packaging/debian/internal/test/apache/apache-pre-24.conf +0 -4
- data/packaging/debian/internal/test/apache/vhost.conf +0 -17
- data/packaging/debian/internal/test/misc/config.json +0 -15
- data/packaging/debian/internal/test/misc/hosts.conf +0 -4
- data/packaging/debian/internal/test/misc/init.sh +0 -25
- data/packaging/debian/internal/test/misc/nodejs_test_app.js +0 -6
- data/packaging/debian/internal/test/misc/python_test_app.py +0 -3
- data/packaging/debian/internal/test/misc/ruby_test_app.rb +0 -5
- data/packaging/debian/internal/test/misc/test_support.rb +0 -61
- data/packaging/debian/internal/test/nginx/vhost.conf +0 -23
- data/packaging/debian/internal/test/system_web_server_test.rb +0 -126
- data/packaging/debian/internal/test/test.sh +0 -141
- data/packaging/debian/jenkins/publish/clear_caches.rb +0 -48
- data/packaging/debian/jenkins/publish/publish.sh +0 -69
- data/packaging/debian/jenkins/test/test.sh +0 -63
- data/packaging/debian/passenger_apt_automation.sublime-project +0 -14
- data/packaging/debian/publish +0 -172
- data/packaging/debian/shell +0 -116
- data/packaging/debian/test +0 -142
- data/packaging/rpm/passenger_spec/rubygem-passenger-4.0.18-gcc47-include-sys_types.patch +0 -45
- data/test/cxx/Base64Test.cpp +0 -50
- data/test/cxx/FileBackedPipeTest.cpp +0 -626
- data/test/cxx/HttpHeaderBuffererTest.cpp +0 -257
- data/test/cxx/ScgiRequestParserTest.cpp +0 -423
- data/test/cxx/ServerInstanceDirTest.cpp +0 -175
- data/test/ruby/admin_tools_spec.rb +0 -360
- data/test/ruby/classic_rails/loader_spec.rb +0 -46
- data/test/ruby/classic_rails/preloader_spec.rb +0 -52
- data/test/ruby/standalone/runtime_locator_spec.rb +0 -214
- data/test/stub/rails2.3/Rakefile +0 -10
- data/test/stub/rails2.3/app/controllers/application_controller.rb +0 -10
- data/test/stub/rails2.3/app/controllers/bar_controller_1.rb +0 -5
- data/test/stub/rails2.3/app/controllers/bar_controller_2.rb +0 -5
- data/test/stub/rails2.3/app/controllers/foo_controller.rb +0 -21
- data/test/stub/rails2.3/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails2.3/app/helpers/bar_helper.rb +0 -2
- data/test/stub/rails2.3/app/helpers/foo_helper.rb +0 -2
- data/test/stub/rails2.3/config/boot.rb +0 -110
- data/test/stub/rails2.3/config/database.yml +0 -19
- data/test/stub/rails2.3/config/environment.rb +0 -62
- data/test/stub/rails2.3/config/environments/development.rb +0 -17
- data/test/stub/rails2.3/config/environments/production.rb +0 -18
- data/test/stub/rails2.3/config/environments/staging.rb +0 -18
- data/test/stub/rails2.3/config/initializers/inflections.rb +0 -10
- data/test/stub/rails2.3/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails2.3/config/routes.rb +0 -35
- data/test/stub/rails2.3/log/.gitignore +0 -1
- data/test/stub/rails2.3/public/.gitignore +0 -1
- data/test/stub/rails2.3/script/about +0 -3
- data/test/stub/rails2.3/script/console +0 -3
- data/test/stub/rails2.3/script/dbconsole +0 -3
- data/test/stub/rails2.3/script/destroy +0 -3
- data/test/stub/rails2.3/script/generate +0 -3
- data/test/stub/rails2.3/script/performance/benchmarker +0 -3
- data/test/stub/rails2.3/script/performance/profiler +0 -3
- data/test/stub/rails2.3/script/performance/request +0 -3
- data/test/stub/rails2.3/script/plugin +0 -3
- data/test/stub/rails2.3/script/process/inspector +0 -3
- data/test/stub/rails2.3/script/process/reaper +0 -3
- data/test/stub/rails2.3/script/process/spawner +0 -3
- data/test/stub/rails2.3/script/runner +0 -3
- data/test/stub/rails2.3/script/server +0 -3
- data/test/stub/rails2.3/tmp/cache/.gitignore +0 -1
- data/test/stub/rails2.3/tmp/pids/.gitignore +0 -1
- data/test/stub/rails2.3/tmp/sessions/.gitignore +0 -1
- data/test/stub/rails2.3/tmp/sockets/.gitignore +0 -1
@@ -1,28 +0,0 @@
|
|
1
|
-
|
2
|
-
/*
|
3
|
-
* Copyright (C) Xiaozhe Wang (chaoslawful)
|
4
|
-
* Copyright (C) Yichun Zhang (agentzh)
|
5
|
-
*/
|
6
|
-
|
7
|
-
|
8
|
-
#ifndef _NGX_HTTP_LUA_OUTPUT_H_INCLUDED_
|
9
|
-
#define _NGX_HTTP_LUA_OUTPUT_H_INCLUDED_
|
10
|
-
|
11
|
-
|
12
|
-
#include "ngx_http_lua_common.h"
|
13
|
-
|
14
|
-
|
15
|
-
void ngx_http_lua_inject_output_api(lua_State *L);
|
16
|
-
|
17
|
-
size_t ngx_http_lua_calc_strlen_in_table(lua_State *L, int index, int arg_i,
|
18
|
-
unsigned strict);
|
19
|
-
|
20
|
-
u_char * ngx_http_lua_copy_str_in_table(lua_State *L, int index, u_char *dst);
|
21
|
-
|
22
|
-
ngx_int_t ngx_http_lua_flush_resume_helper(ngx_http_request_t *r,
|
23
|
-
ngx_http_lua_ctx_t *ctx);
|
24
|
-
|
25
|
-
|
26
|
-
#endif /* _NGX_HTTP_LUA_OUTPUT_H_INCLUDED_ */
|
27
|
-
|
28
|
-
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
|
@@ -1,106 +0,0 @@
|
|
1
|
-
|
2
|
-
/*
|
3
|
-
* Copyright (C) Xiaozhe Wang (chaoslawful)
|
4
|
-
* Copyright (C) Yichun Zhang (agentzh)
|
5
|
-
*/
|
6
|
-
|
7
|
-
|
8
|
-
#ifndef DDEBUG
|
9
|
-
#define DDEBUG 0
|
10
|
-
#endif
|
11
|
-
#include "ddebug.h"
|
12
|
-
|
13
|
-
|
14
|
-
#include "ngx_http_lua_pcrefix.h"
|
15
|
-
#include "stdio.h"
|
16
|
-
|
17
|
-
#if (NGX_PCRE)
|
18
|
-
|
19
|
-
static ngx_pool_t *ngx_http_lua_pcre_pool = NULL;
|
20
|
-
|
21
|
-
static void *(*old_pcre_malloc)(size_t);
|
22
|
-
static void (*old_pcre_free)(void *ptr);
|
23
|
-
|
24
|
-
|
25
|
-
/* XXX: work-around to nginx regex subsystem, must init a memory pool
|
26
|
-
* to use PCRE functions. As PCRE still has memory-leaking problems,
|
27
|
-
* and nginx overwrote pcre_malloc/free hooks with its own static
|
28
|
-
* functions, so nobody else can reuse nginx regex subsystem... */
|
29
|
-
static void *
|
30
|
-
ngx_http_lua_pcre_malloc(size_t size)
|
31
|
-
{
|
32
|
-
dd("lua pcre pool is %p", ngx_http_lua_pcre_pool);
|
33
|
-
|
34
|
-
if (ngx_http_lua_pcre_pool) {
|
35
|
-
return ngx_palloc(ngx_http_lua_pcre_pool, size);
|
36
|
-
}
|
37
|
-
|
38
|
-
fprintf(stderr, "error: lua pcre malloc failed due to empty pcre pool");
|
39
|
-
|
40
|
-
return NULL;
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
static void
|
45
|
-
ngx_http_lua_pcre_free(void *ptr)
|
46
|
-
{
|
47
|
-
dd("lua pcre pool is %p", ngx_http_lua_pcre_pool);
|
48
|
-
|
49
|
-
if (ngx_http_lua_pcre_pool) {
|
50
|
-
ngx_pfree(ngx_http_lua_pcre_pool, ptr);
|
51
|
-
return;
|
52
|
-
}
|
53
|
-
|
54
|
-
fprintf(stderr, "error: lua pcre free failed due to empty pcre pool");
|
55
|
-
}
|
56
|
-
|
57
|
-
|
58
|
-
ngx_pool_t *
|
59
|
-
ngx_http_lua_pcre_malloc_init(ngx_pool_t *pool)
|
60
|
-
{
|
61
|
-
ngx_pool_t *old_pool;
|
62
|
-
|
63
|
-
if (pcre_malloc != ngx_http_lua_pcre_malloc) {
|
64
|
-
|
65
|
-
dd("overriding nginx pcre malloc and free");
|
66
|
-
|
67
|
-
ngx_http_lua_pcre_pool = pool;
|
68
|
-
|
69
|
-
old_pcre_malloc = pcre_malloc;
|
70
|
-
old_pcre_free = pcre_free;
|
71
|
-
|
72
|
-
pcre_malloc = ngx_http_lua_pcre_malloc;
|
73
|
-
pcre_free = ngx_http_lua_pcre_free;
|
74
|
-
|
75
|
-
return NULL;
|
76
|
-
}
|
77
|
-
|
78
|
-
dd("lua pcre pool was %p", ngx_http_lua_pcre_pool);
|
79
|
-
|
80
|
-
old_pool = ngx_http_lua_pcre_pool;
|
81
|
-
ngx_http_lua_pcre_pool = pool;
|
82
|
-
|
83
|
-
dd("lua pcre pool is %p", ngx_http_lua_pcre_pool);
|
84
|
-
|
85
|
-
return old_pool;
|
86
|
-
}
|
87
|
-
|
88
|
-
|
89
|
-
void
|
90
|
-
ngx_http_lua_pcre_malloc_done(ngx_pool_t *old_pool)
|
91
|
-
{
|
92
|
-
dd("lua pcre pool was %p", ngx_http_lua_pcre_pool);
|
93
|
-
|
94
|
-
ngx_http_lua_pcre_pool = old_pool;
|
95
|
-
|
96
|
-
dd("lua pcre pool is %p", ngx_http_lua_pcre_pool);
|
97
|
-
|
98
|
-
if (old_pool == NULL) {
|
99
|
-
pcre_malloc = old_pcre_malloc;
|
100
|
-
pcre_free = old_pcre_free;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
#endif /* NGX_PCRE */
|
105
|
-
|
106
|
-
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
|
@@ -1,23 +0,0 @@
|
|
1
|
-
|
2
|
-
/*
|
3
|
-
* Copyright (C) Xiaozhe Wang (chaoslawful)
|
4
|
-
* Copyright (C) Yichun Zhang (agentzh)
|
5
|
-
*/
|
6
|
-
|
7
|
-
|
8
|
-
#ifndef _NGX_HTTP_LUA_PCREFIX_H_INCLUDED_
|
9
|
-
#define _NGX_HTTP_LUA_PCREFIX_H_INCLUDED_
|
10
|
-
|
11
|
-
|
12
|
-
#include "ngx_http_lua_common.h"
|
13
|
-
|
14
|
-
|
15
|
-
#if (NGX_PCRE)
|
16
|
-
ngx_pool_t *ngx_http_lua_pcre_malloc_init(ngx_pool_t *pool);
|
17
|
-
void ngx_http_lua_pcre_malloc_done(ngx_pool_t *old_pool);
|
18
|
-
#endif
|
19
|
-
|
20
|
-
|
21
|
-
#endif /* _NGX_HTTP_LUA_PCREFIX_H_INCLUDED_ */
|
22
|
-
|
23
|
-
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
|
@@ -1,94 +0,0 @@
|
|
1
|
-
|
2
|
-
/*
|
3
|
-
* Copyright (C) Yichun Zhang (agentzh)
|
4
|
-
*/
|
5
|
-
|
6
|
-
|
7
|
-
#ifndef DDEBUG
|
8
|
-
#define DDEBUG 0
|
9
|
-
#endif
|
10
|
-
#include "ddebug.h"
|
11
|
-
|
12
|
-
|
13
|
-
#include "ngx_http_lua_phase.h"
|
14
|
-
#include "ngx_http_lua_util.h"
|
15
|
-
#include "ngx_http_lua_ctx.h"
|
16
|
-
|
17
|
-
|
18
|
-
static int ngx_http_lua_ngx_get_phase(lua_State *L);
|
19
|
-
|
20
|
-
|
21
|
-
static int
|
22
|
-
ngx_http_lua_ngx_get_phase(lua_State *L)
|
23
|
-
{
|
24
|
-
ngx_http_request_t *r;
|
25
|
-
ngx_http_lua_ctx_t *ctx;
|
26
|
-
|
27
|
-
r = ngx_http_lua_get_req(L);
|
28
|
-
|
29
|
-
/* If we have no request object, assume we are called from the "init"
|
30
|
-
* phase. */
|
31
|
-
|
32
|
-
if (r == NULL) {
|
33
|
-
lua_pushliteral(L, "init");
|
34
|
-
return 1;
|
35
|
-
}
|
36
|
-
|
37
|
-
ctx = ngx_http_get_module_ctx(r, ngx_http_lua_module);
|
38
|
-
if (ctx == NULL) {
|
39
|
-
return luaL_error(L, "no request ctx found");
|
40
|
-
}
|
41
|
-
|
42
|
-
switch (ctx->context) {
|
43
|
-
case NGX_HTTP_LUA_CONTEXT_INIT_WORKER:
|
44
|
-
lua_pushliteral(L, "init_worker");
|
45
|
-
break;
|
46
|
-
|
47
|
-
case NGX_HTTP_LUA_CONTEXT_SET:
|
48
|
-
lua_pushliteral(L, "set");
|
49
|
-
break;
|
50
|
-
|
51
|
-
case NGX_HTTP_LUA_CONTEXT_REWRITE:
|
52
|
-
lua_pushliteral(L, "rewrite");
|
53
|
-
break;
|
54
|
-
|
55
|
-
case NGX_HTTP_LUA_CONTEXT_ACCESS:
|
56
|
-
lua_pushliteral(L, "access");
|
57
|
-
break;
|
58
|
-
|
59
|
-
case NGX_HTTP_LUA_CONTEXT_CONTENT:
|
60
|
-
lua_pushliteral(L, "content");
|
61
|
-
break;
|
62
|
-
|
63
|
-
case NGX_HTTP_LUA_CONTEXT_LOG:
|
64
|
-
lua_pushliteral(L, "log");
|
65
|
-
break;
|
66
|
-
|
67
|
-
case NGX_HTTP_LUA_CONTEXT_HEADER_FILTER:
|
68
|
-
lua_pushliteral(L, "header_filter");
|
69
|
-
break;
|
70
|
-
|
71
|
-
case NGX_HTTP_LUA_CONTEXT_BODY_FILTER:
|
72
|
-
lua_pushliteral(L, "body_filter");
|
73
|
-
break;
|
74
|
-
|
75
|
-
case NGX_HTTP_LUA_CONTEXT_TIMER:
|
76
|
-
lua_pushliteral(L, "timer");
|
77
|
-
break;
|
78
|
-
|
79
|
-
default:
|
80
|
-
return luaL_error(L, "unknown phase: %d", (int) ctx->context);
|
81
|
-
}
|
82
|
-
|
83
|
-
return 1;
|
84
|
-
}
|
85
|
-
|
86
|
-
|
87
|
-
void
|
88
|
-
ngx_http_lua_inject_phase_api(lua_State *L)
|
89
|
-
{
|
90
|
-
lua_pushcfunction(L, ngx_http_lua_ngx_get_phase);
|
91
|
-
lua_setfield(L, -2, "get_phase");
|
92
|
-
}
|
93
|
-
|
94
|
-
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
|
@@ -1,13 +0,0 @@
|
|
1
|
-
#ifndef _NGX_HTTP_LUA_PHASE_H_INCLUDED_
|
2
|
-
#define _NGX_HTTP_LUA_PHASE_H_INCLUDED_
|
3
|
-
|
4
|
-
|
5
|
-
#include "ngx_http_lua_common.h"
|
6
|
-
|
7
|
-
|
8
|
-
void ngx_http_lua_inject_phase_api(lua_State *L);
|
9
|
-
|
10
|
-
|
11
|
-
#endif /* _NGX_HTTP_LUA_PHASE_H_INCLUDED_ */
|
12
|
-
|
13
|
-
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
|
@@ -1,85 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* automatically generated from the file dtrace/ngx_lua_provider.d by the
|
3
|
-
* gen-dtrace-probe-header tool in the nginx-devel-utils project:
|
4
|
-
* https://github.com/agentzh/nginx-devel-utils
|
5
|
-
*/
|
6
|
-
|
7
|
-
#ifndef _NGX_HTTP_LUA_PROBE_H_INCLUDED_
|
8
|
-
#define _NGX_HTTP_LUA_PROBE_H_INCLUDED_
|
9
|
-
|
10
|
-
|
11
|
-
#include <ngx_config.h>
|
12
|
-
#include <ngx_core.h>
|
13
|
-
#include <ngx_http.h>
|
14
|
-
|
15
|
-
|
16
|
-
#if defined(NGX_DTRACE) && NGX_DTRACE
|
17
|
-
|
18
|
-
#include <ngx_dtrace_provider.h>
|
19
|
-
|
20
|
-
#define ngx_http_lua_probe_info(s) \
|
21
|
-
NGINX_LUA_HTTP_LUA_INFO(s)
|
22
|
-
|
23
|
-
#define ngx_http_lua_probe_register_preload_package(L, pkg) \
|
24
|
-
NGINX_LUA_HTTP_LUA_REGISTER_PRELOAD_PACKAGE(L, pkg)
|
25
|
-
|
26
|
-
#define ngx_http_lua_probe_req_socket_consume_preread(r, data, len) \
|
27
|
-
NGINX_LUA_HTTP_LUA_REQ_SOCKET_CONSUME_PREREAD(r, data, len)
|
28
|
-
|
29
|
-
#define ngx_http_lua_probe_user_coroutine_create(r, parent, child) \
|
30
|
-
NGINX_LUA_HTTP_LUA_USER_COROUTINE_CREATE(r, parent, child)
|
31
|
-
|
32
|
-
#define ngx_http_lua_probe_user_coroutine_resume(r, parent, child) \
|
33
|
-
NGINX_LUA_HTTP_LUA_USER_COROUTINE_RESUME(r, parent, child)
|
34
|
-
|
35
|
-
#define ngx_http_lua_probe_user_coroutine_yield(r, parent, child) \
|
36
|
-
NGINX_LUA_HTTP_LUA_USER_COROUTINE_YIELD(r, parent, child)
|
37
|
-
|
38
|
-
#define ngx_http_lua_probe_thread_yield(r, L) \
|
39
|
-
NGINX_LUA_HTTP_LUA_THREAD_YIELD(r, L)
|
40
|
-
|
41
|
-
#define ngx_http_lua_probe_socket_tcp_send_start(r, u, data, len) \
|
42
|
-
NGINX_LUA_HTTP_LUA_SOCKET_TCP_SEND_START(r, u, data, len)
|
43
|
-
|
44
|
-
#define ngx_http_lua_probe_socket_tcp_receive_done(r, u, data, len) \
|
45
|
-
NGINX_LUA_HTTP_LUA_SOCKET_TCP_RECEIVE_DONE(r, u, data, len)
|
46
|
-
|
47
|
-
#define ngx_http_lua_probe_socket_tcp_setkeepalive_buf_unread(r, u, data, len)\
|
48
|
-
NGINX_LUA_HTTP_LUA_SOCKET_TCP_SETKEEPALIVE_BUF_UNREAD(r, u, data, len)
|
49
|
-
|
50
|
-
#define ngx_http_lua_probe_user_thread_spawn(r, creator, newthread) \
|
51
|
-
NGINX_LUA_HTTP_LUA_USER_THREAD_SPAWN(r, creator, newthread)
|
52
|
-
|
53
|
-
#define ngx_http_lua_probe_thread_delete(r, thread, ctx) \
|
54
|
-
NGINX_LUA_HTTP_LUA_THREAD_DELETE(r, thread, ctx)
|
55
|
-
|
56
|
-
#define ngx_http_lua_probe_run_posted_thread(r, thread, status) \
|
57
|
-
NGINX_LUA_HTTP_LUA_RUN_POSTED_THREAD(r, thread, status)
|
58
|
-
|
59
|
-
#define ngx_http_lua_probe_coroutine_done(r, co, success) \
|
60
|
-
NGINX_LUA_HTTP_LUA_COROUTINE_DONE(r, co, success)
|
61
|
-
|
62
|
-
#define ngx_http_lua_probe_user_thread_wait(parent, child) \
|
63
|
-
NGINX_LUA_HTTP_LUA_USER_THREAD_WAIT(parent, child)
|
64
|
-
|
65
|
-
#else /* !(NGX_DTRACE) */
|
66
|
-
|
67
|
-
#define ngx_http_lua_probe_info(s)
|
68
|
-
#define ngx_http_lua_probe_register_preload_package(L, pkg)
|
69
|
-
#define ngx_http_lua_probe_req_socket_consume_preread(r, data, len)
|
70
|
-
#define ngx_http_lua_probe_user_coroutine_create(r, parent, child)
|
71
|
-
#define ngx_http_lua_probe_user_coroutine_resume(r, parent, child)
|
72
|
-
#define ngx_http_lua_probe_user_coroutine_yield(r, parent, child)
|
73
|
-
#define ngx_http_lua_probe_thread_yield(r, L)
|
74
|
-
#define ngx_http_lua_probe_socket_tcp_send_start(r, u, data, len)
|
75
|
-
#define ngx_http_lua_probe_socket_tcp_receive_done(r, u, data, len)
|
76
|
-
#define ngx_http_lua_probe_socket_tcp_setkeepalive_buf_unread(r, u, data, len)
|
77
|
-
#define ngx_http_lua_probe_user_thread_spawn(r, creator, newthread)
|
78
|
-
#define ngx_http_lua_probe_thread_delete(r, thread, ctx)
|
79
|
-
#define ngx_http_lua_probe_run_posted_thread(r, thread, status)
|
80
|
-
#define ngx_http_lua_probe_coroutine_done(r, co, success)
|
81
|
-
#define ngx_http_lua_probe_user_thread_wait(parent, child)
|
82
|
-
|
83
|
-
#endif
|
84
|
-
|
85
|
-
#endif /* _NGX_HTTP_LUA_PROBE_H_INCLUDED_ */
|
@@ -1,2468 +0,0 @@
|
|
1
|
-
|
2
|
-
/*
|
3
|
-
* Copyright (C) Yichun Zhang (agentzh)
|
4
|
-
*/
|
5
|
-
|
6
|
-
|
7
|
-
#ifndef DDEBUG
|
8
|
-
#define DDEBUG 0
|
9
|
-
#endif
|
10
|
-
#include "ddebug.h"
|
11
|
-
|
12
|
-
|
13
|
-
#if (NGX_PCRE)
|
14
|
-
|
15
|
-
#include "ngx_http_lua_regex.h"
|
16
|
-
#include "ngx_http_lua_pcrefix.h"
|
17
|
-
#include "ngx_http_lua_script.h"
|
18
|
-
#include "ngx_http_lua_pcrefix.h"
|
19
|
-
#include "ngx_http_lua_util.h"
|
20
|
-
#include <pcre.h>
|
21
|
-
|
22
|
-
|
23
|
-
#if (PCRE_MAJOR > 8) || (PCRE_MAJOR == 8 && PCRE_MINOR >= 21)
|
24
|
-
# define LUA_HAVE_PCRE_JIT 1
|
25
|
-
#else
|
26
|
-
# define LUA_HAVE_PCRE_JIT 0
|
27
|
-
#endif
|
28
|
-
|
29
|
-
|
30
|
-
#if (PCRE_MAJOR >= 6)
|
31
|
-
# define LUA_HAVE_PCRE_DFA 1
|
32
|
-
#else
|
33
|
-
# define LUA_HAVE_PCRE_DFA 0
|
34
|
-
#endif
|
35
|
-
|
36
|
-
|
37
|
-
#define NGX_LUA_RE_COMPILE_ONCE (1<<0)
|
38
|
-
#define NGX_LUA_RE_MODE_DFA (1<<1)
|
39
|
-
#define NGX_LUA_RE_MODE_JIT (1<<2)
|
40
|
-
#define NGX_LUA_RE_MODE_DUPNAMES (1<<3)
|
41
|
-
#define NGX_LUA_RE_NO_UTF8_CHECK (1<<4)
|
42
|
-
|
43
|
-
#define NGX_LUA_RE_DFA_MODE_WORKSPACE_COUNT (100)
|
44
|
-
|
45
|
-
|
46
|
-
typedef struct {
|
47
|
-
#ifndef NGX_LUA_NO_FFI_API
|
48
|
-
ngx_pool_t *pool;
|
49
|
-
u_char *name_table;
|
50
|
-
int name_count;
|
51
|
-
int name_entry_size;
|
52
|
-
#endif
|
53
|
-
|
54
|
-
int ncaptures;
|
55
|
-
int *captures;
|
56
|
-
|
57
|
-
pcre *regex;
|
58
|
-
pcre_extra *regex_sd;
|
59
|
-
|
60
|
-
ngx_http_lua_complex_value_t *replace;
|
61
|
-
|
62
|
-
#ifndef NGX_LUA_NO_FFI_API
|
63
|
-
/* only for (stap) debugging, and may be an invalid pointer */
|
64
|
-
const u_char *pattern;
|
65
|
-
#endif
|
66
|
-
} ngx_http_lua_regex_t;
|
67
|
-
|
68
|
-
|
69
|
-
typedef struct {
|
70
|
-
ngx_str_t pattern;
|
71
|
-
ngx_pool_t *pool;
|
72
|
-
ngx_int_t options;
|
73
|
-
|
74
|
-
pcre *regex;
|
75
|
-
int captures;
|
76
|
-
ngx_str_t err;
|
77
|
-
} ngx_http_lua_regex_compile_t;
|
78
|
-
|
79
|
-
|
80
|
-
typedef struct {
|
81
|
-
ngx_http_cleanup_pt *cleanup;
|
82
|
-
ngx_http_request_t *request;
|
83
|
-
pcre *regex;
|
84
|
-
pcre_extra *regex_sd;
|
85
|
-
int ncaptures;
|
86
|
-
int *captures;
|
87
|
-
int captures_len;
|
88
|
-
uint8_t flags;
|
89
|
-
} ngx_http_lua_regex_ctx_t;
|
90
|
-
|
91
|
-
|
92
|
-
static int ngx_http_lua_ngx_re_gmatch_iterator(lua_State *L);
|
93
|
-
static ngx_uint_t ngx_http_lua_ngx_re_parse_opts(lua_State *L,
|
94
|
-
ngx_http_lua_regex_compile_t *re, ngx_str_t *opts, int narg);
|
95
|
-
static int ngx_http_lua_ngx_re_sub_helper(lua_State *L, unsigned global);
|
96
|
-
static int ngx_http_lua_ngx_re_match_helper(lua_State *L, int wantcaps);
|
97
|
-
static int ngx_http_lua_ngx_re_find(lua_State *L);
|
98
|
-
static int ngx_http_lua_ngx_re_match(lua_State *L);
|
99
|
-
static int ngx_http_lua_ngx_re_gmatch(lua_State *L);
|
100
|
-
static int ngx_http_lua_ngx_re_sub(lua_State *L);
|
101
|
-
static int ngx_http_lua_ngx_re_gsub(lua_State *L);
|
102
|
-
static void ngx_http_lua_regex_free_study_data(ngx_pool_t *pool,
|
103
|
-
pcre_extra *sd);
|
104
|
-
static ngx_int_t ngx_http_lua_regex_compile(ngx_http_lua_regex_compile_t *rc);
|
105
|
-
static void ngx_http_lua_ngx_re_gmatch_cleanup(void *data);
|
106
|
-
static int ngx_http_lua_ngx_re_gmatch_gc(lua_State *L);
|
107
|
-
static void ngx_http_lua_re_collect_named_captures(lua_State *L,
|
108
|
-
int res_tb_idx, u_char *name_table, int name_count, int name_entry_size,
|
109
|
-
unsigned flags, ngx_str_t *subj);
|
110
|
-
|
111
|
-
|
112
|
-
#define ngx_http_lua_regex_exec(re, e, s, start, captures, size, opts) \
|
113
|
-
pcre_exec(re, e, (const char *) (s)->data, (s)->len, start, opts, \
|
114
|
-
captures, size)
|
115
|
-
|
116
|
-
|
117
|
-
#define ngx_http_lua_regex_dfa_exec(re, e, s, start, captures, size, ws, \
|
118
|
-
wscount, opts) \
|
119
|
-
pcre_dfa_exec(re, e, (const char *) (s)->data, (s)->len, start, opts, \
|
120
|
-
captures, size, ws, wscount)
|
121
|
-
|
122
|
-
|
123
|
-
static int
|
124
|
-
ngx_http_lua_ngx_re_match(lua_State *L)
|
125
|
-
{
|
126
|
-
return ngx_http_lua_ngx_re_match_helper(L, 1 /* want captures */);
|
127
|
-
}
|
128
|
-
|
129
|
-
|
130
|
-
static int
|
131
|
-
ngx_http_lua_ngx_re_find(lua_State *L)
|
132
|
-
{
|
133
|
-
return ngx_http_lua_ngx_re_match_helper(L, 0 /* want captures */);
|
134
|
-
}
|
135
|
-
|
136
|
-
|
137
|
-
static int
|
138
|
-
ngx_http_lua_ngx_re_match_helper(lua_State *L, int wantcaps)
|
139
|
-
{
|
140
|
-
/* u_char *p; */
|
141
|
-
int res_tb_idx = 0;
|
142
|
-
ngx_http_request_t *r;
|
143
|
-
ngx_str_t subj;
|
144
|
-
ngx_str_t pat;
|
145
|
-
ngx_str_t opts;
|
146
|
-
ngx_http_lua_regex_t *re;
|
147
|
-
const char *msg;
|
148
|
-
ngx_int_t rc;
|
149
|
-
ngx_uint_t n;
|
150
|
-
int i;
|
151
|
-
ngx_int_t pos = 0;
|
152
|
-
int nargs;
|
153
|
-
int *cap = NULL;
|
154
|
-
int ovecsize;
|
155
|
-
ngx_uint_t flags;
|
156
|
-
ngx_pool_t *pool, *old_pool;
|
157
|
-
ngx_http_lua_main_conf_t *lmcf;
|
158
|
-
u_char errstr[NGX_MAX_CONF_ERRSTR + 1];
|
159
|
-
pcre_extra *sd = NULL;
|
160
|
-
int name_entry_size = 0, name_count;
|
161
|
-
u_char *name_table = NULL;
|
162
|
-
int exec_opts;
|
163
|
-
int group_id = 0;
|
164
|
-
|
165
|
-
ngx_http_lua_regex_compile_t re_comp;
|
166
|
-
|
167
|
-
nargs = lua_gettop(L);
|
168
|
-
|
169
|
-
if (nargs != 2 && nargs != 3 && nargs != 4 && nargs != 5) {
|
170
|
-
return luaL_error(L, "expecting 2, 3, 4 or 5 arguments, "
|
171
|
-
"but got %d", nargs);
|
172
|
-
}
|
173
|
-
|
174
|
-
r = ngx_http_lua_get_req(L);
|
175
|
-
if (r == NULL) {
|
176
|
-
return luaL_error(L, "no request object found");
|
177
|
-
}
|
178
|
-
|
179
|
-
subj.data = (u_char *) luaL_checklstring(L, 1, &subj.len);
|
180
|
-
pat.data = (u_char *) luaL_checklstring(L, 2, &pat.len);
|
181
|
-
|
182
|
-
ngx_memzero(&re_comp, sizeof(ngx_http_lua_regex_compile_t));
|
183
|
-
|
184
|
-
if (nargs >= 3) {
|
185
|
-
opts.data = (u_char *) luaL_checklstring(L, 3, &opts.len);
|
186
|
-
|
187
|
-
if (nargs == 4) {
|
188
|
-
luaL_checktype(L, 4, LUA_TTABLE);
|
189
|
-
lua_getfield(L, 4, "pos");
|
190
|
-
if (lua_isnumber(L, -1)) {
|
191
|
-
pos = (ngx_int_t) lua_tointeger(L, -1);
|
192
|
-
if (pos <= 0) {
|
193
|
-
pos = 0;
|
194
|
-
|
195
|
-
} else {
|
196
|
-
pos--; /* 1-based on the Lua land */
|
197
|
-
}
|
198
|
-
|
199
|
-
} else if (lua_isnil(L, -1)) {
|
200
|
-
pos = 0;
|
201
|
-
|
202
|
-
} else {
|
203
|
-
msg = lua_pushfstring(L, "bad pos field type in the ctx table "
|
204
|
-
"argument: %s", luaL_typename(L, -1));
|
205
|
-
|
206
|
-
return luaL_argerror(L, 4, msg);
|
207
|
-
}
|
208
|
-
|
209
|
-
lua_pop(L, 1);
|
210
|
-
}
|
211
|
-
|
212
|
-
} else {
|
213
|
-
opts.data = (u_char *) "";
|
214
|
-
opts.len = 0;
|
215
|
-
}
|
216
|
-
|
217
|
-
if (nargs == 5) {
|
218
|
-
if (wantcaps) {
|
219
|
-
luaL_checktype(L, 5, LUA_TTABLE);
|
220
|
-
res_tb_idx = 5;
|
221
|
-
|
222
|
-
#if 0
|
223
|
-
/* clear the Lua table */
|
224
|
-
lua_pushnil(L);
|
225
|
-
while (lua_next(L, res_tb_idx) != 0) {
|
226
|
-
lua_pop(L, 1);
|
227
|
-
lua_pushvalue(L, -1);
|
228
|
-
lua_pushnil(L);
|
229
|
-
lua_rawset(L, res_tb_idx);
|
230
|
-
}
|
231
|
-
#endif
|
232
|
-
|
233
|
-
} else {
|
234
|
-
group_id = luaL_checkint(L, 5);
|
235
|
-
if (group_id < 0) {
|
236
|
-
group_id = 0;
|
237
|
-
}
|
238
|
-
}
|
239
|
-
}
|
240
|
-
|
241
|
-
re_comp.options = 0;
|
242
|
-
|
243
|
-
flags = ngx_http_lua_ngx_re_parse_opts(L, &re_comp, &opts, 3);
|
244
|
-
|
245
|
-
lmcf = ngx_http_get_module_main_conf(r, ngx_http_lua_module);
|
246
|
-
|
247
|
-
if (flags & NGX_LUA_RE_COMPILE_ONCE) {
|
248
|
-
pool = lmcf->pool;
|
249
|
-
|
250
|
-
dd("server pool %p", lmcf->pool);
|
251
|
-
|
252
|
-
lua_pushlightuserdata(L, &ngx_http_lua_regex_cache_key);
|
253
|
-
lua_rawget(L, LUA_REGISTRYINDEX); /* table */
|
254
|
-
|
255
|
-
lua_pushliteral(L, "m");
|
256
|
-
lua_pushvalue(L, 2); /* table regex */
|
257
|
-
|
258
|
-
dd("options size: %d", (int) sizeof(re_comp.options));
|
259
|
-
|
260
|
-
lua_pushlstring(L, (char *) &re_comp.options, sizeof(re_comp.options));
|
261
|
-
/* table regex opts */
|
262
|
-
|
263
|
-
lua_concat(L, 3); /* table key */
|
264
|
-
lua_pushvalue(L, -1); /* table key key */
|
265
|
-
|
266
|
-
dd("regex cache key: %.*s", (int) (pat.len + sizeof(re_comp.options)),
|
267
|
-
lua_tostring(L, -1));
|
268
|
-
|
269
|
-
lua_rawget(L, -3); /* table key re */
|
270
|
-
re = lua_touserdata(L, -1);
|
271
|
-
|
272
|
-
lua_pop(L, 1); /* table key */
|
273
|
-
|
274
|
-
if (re) {
|
275
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
276
|
-
"lua regex cache hit for match regex \"%s\" with "
|
277
|
-
"options \"%s\"", pat.data, opts.data);
|
278
|
-
|
279
|
-
lua_pop(L, 2);
|
280
|
-
|
281
|
-
dd("restoring regex %p, ncaptures %d, captures %p", re->regex,
|
282
|
-
re->ncaptures, re->captures);
|
283
|
-
|
284
|
-
re_comp.regex = re->regex;
|
285
|
-
sd = re->regex_sd;
|
286
|
-
re_comp.captures = re->ncaptures;
|
287
|
-
cap = re->captures;
|
288
|
-
|
289
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
290
|
-
ovecsize = 2;
|
291
|
-
|
292
|
-
} else {
|
293
|
-
ovecsize = (re->ncaptures + 1) * 3;
|
294
|
-
}
|
295
|
-
|
296
|
-
goto exec;
|
297
|
-
}
|
298
|
-
|
299
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
300
|
-
"lua regex cache miss for match regex \"%s\" "
|
301
|
-
"with options \"%s\"", pat.data, opts.data);
|
302
|
-
|
303
|
-
if (lmcf->regex_cache_entries >= lmcf->regex_cache_max_entries) {
|
304
|
-
|
305
|
-
if (lmcf->regex_cache_entries == lmcf->regex_cache_max_entries) {
|
306
|
-
ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
|
307
|
-
"lua exceeding regex cache max entries (%i)",
|
308
|
-
lmcf->regex_cache_max_entries);
|
309
|
-
|
310
|
-
lmcf->regex_cache_entries++;
|
311
|
-
}
|
312
|
-
|
313
|
-
pool = r->pool;
|
314
|
-
flags &= ~NGX_LUA_RE_COMPILE_ONCE;
|
315
|
-
}
|
316
|
-
|
317
|
-
} else {
|
318
|
-
pool = r->pool;
|
319
|
-
}
|
320
|
-
|
321
|
-
dd("pool %p, r pool %p", pool, r->pool);
|
322
|
-
|
323
|
-
re_comp.pattern = pat;
|
324
|
-
re_comp.err.len = NGX_MAX_CONF_ERRSTR;
|
325
|
-
re_comp.err.data = errstr;
|
326
|
-
re_comp.pool = pool;
|
327
|
-
|
328
|
-
ngx_log_debug5(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
329
|
-
"lua compiling match regex \"%s\" with options \"%s\" "
|
330
|
-
"(compile once: %d) (dfa mode: %d) (jit mode: %d)",
|
331
|
-
pat.data, opts.data,
|
332
|
-
(flags & NGX_LUA_RE_COMPILE_ONCE) != 0,
|
333
|
-
(flags & NGX_LUA_RE_MODE_DFA) != 0,
|
334
|
-
(flags & NGX_LUA_RE_MODE_JIT) != 0);
|
335
|
-
|
336
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
337
|
-
|
338
|
-
rc = ngx_http_lua_regex_compile(&re_comp);
|
339
|
-
|
340
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
341
|
-
|
342
|
-
if (rc != NGX_OK) {
|
343
|
-
dd("compile failed");
|
344
|
-
|
345
|
-
lua_pushnil(L);
|
346
|
-
if (!wantcaps) {
|
347
|
-
lua_pushnil(L);
|
348
|
-
}
|
349
|
-
lua_pushlstring(L, (char *) re_comp.err.data, re_comp.err.len);
|
350
|
-
return wantcaps ? 2 : 3;
|
351
|
-
}
|
352
|
-
|
353
|
-
#if (LUA_HAVE_PCRE_JIT)
|
354
|
-
|
355
|
-
if (flags & NGX_LUA_RE_MODE_JIT) {
|
356
|
-
|
357
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
358
|
-
|
359
|
-
sd = pcre_study(re_comp.regex, PCRE_STUDY_JIT_COMPILE, &msg);
|
360
|
-
|
361
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
362
|
-
|
363
|
-
# if (NGX_DEBUG)
|
364
|
-
dd("sd = %p", sd);
|
365
|
-
|
366
|
-
if (msg != NULL) {
|
367
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
368
|
-
"pcre study failed with PCRE_STUDY_JIT_COMPILE: "
|
369
|
-
"%s (%p)", msg, sd);
|
370
|
-
}
|
371
|
-
|
372
|
-
if (sd != NULL) {
|
373
|
-
int jitted;
|
374
|
-
|
375
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
376
|
-
|
377
|
-
pcre_fullinfo(re_comp.regex, sd, PCRE_INFO_JIT, &jitted);
|
378
|
-
|
379
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
380
|
-
|
381
|
-
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
382
|
-
"pcre JIT compiling result: %d", jitted);
|
383
|
-
}
|
384
|
-
# endif /* !(NGX_DEBUG) */
|
385
|
-
|
386
|
-
} else {
|
387
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
388
|
-
|
389
|
-
sd = pcre_study(re_comp.regex, 0, &msg);
|
390
|
-
|
391
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
392
|
-
|
393
|
-
# if (NGX_DEBUG)
|
394
|
-
dd("sd = %p", sd);
|
395
|
-
|
396
|
-
if (msg != NULL) {
|
397
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
398
|
-
"pcre_study failed with PCRE_STUDY_JIT_COMPILE: "
|
399
|
-
"%s (%p)", msg, sd);
|
400
|
-
}
|
401
|
-
# endif /* NGX_DEBUG */
|
402
|
-
}
|
403
|
-
|
404
|
-
#else /* !(LUA_HAVE_PCRE_JIT) */
|
405
|
-
|
406
|
-
if (flags & NGX_LUA_RE_MODE_JIT) {
|
407
|
-
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
408
|
-
"your pcre build does not have JIT support and "
|
409
|
-
"the \"j\" regex option is ignored");
|
410
|
-
}
|
411
|
-
|
412
|
-
#endif /* LUA_HAVE_PCRE_JIT */
|
413
|
-
|
414
|
-
if (sd && lmcf->regex_match_limit > 0) {
|
415
|
-
sd->flags |= PCRE_EXTRA_MATCH_LIMIT;
|
416
|
-
sd->match_limit = lmcf->regex_match_limit;
|
417
|
-
}
|
418
|
-
|
419
|
-
dd("compile done, captures %d", (int) re_comp.captures);
|
420
|
-
|
421
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
422
|
-
ovecsize = 2;
|
423
|
-
|
424
|
-
} else {
|
425
|
-
ovecsize = (re_comp.captures + 1) * 3;
|
426
|
-
}
|
427
|
-
|
428
|
-
dd("allocating cap with size: %d", (int) ovecsize);
|
429
|
-
|
430
|
-
cap = ngx_palloc(pool, ovecsize * sizeof(int));
|
431
|
-
|
432
|
-
if (cap == NULL) {
|
433
|
-
flags &= ~NGX_LUA_RE_COMPILE_ONCE;
|
434
|
-
msg = "no memory";
|
435
|
-
goto error;
|
436
|
-
}
|
437
|
-
|
438
|
-
if (flags & NGX_LUA_RE_COMPILE_ONCE) {
|
439
|
-
|
440
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
441
|
-
"lua saving compiled regex (%d captures) into the cache "
|
442
|
-
"(entries %i)", re_comp.captures,
|
443
|
-
lmcf->regex_cache_entries);
|
444
|
-
|
445
|
-
re = ngx_palloc(pool, sizeof(ngx_http_lua_regex_t));
|
446
|
-
if (re == NULL) {
|
447
|
-
msg = "no memory";
|
448
|
-
goto error;
|
449
|
-
}
|
450
|
-
|
451
|
-
dd("saving regex %p, ncaptures %d, captures %p", re_comp.regex,
|
452
|
-
re_comp.captures, cap);
|
453
|
-
|
454
|
-
re->regex = re_comp.regex;
|
455
|
-
re->regex_sd = sd;
|
456
|
-
re->ncaptures = re_comp.captures;
|
457
|
-
re->captures = cap;
|
458
|
-
re->replace = NULL;
|
459
|
-
|
460
|
-
lua_pushlightuserdata(L, re); /* table key value */
|
461
|
-
lua_rawset(L, -3); /* table */
|
462
|
-
lua_pop(L, 1);
|
463
|
-
|
464
|
-
if (lmcf) {
|
465
|
-
lmcf->regex_cache_entries++;
|
466
|
-
}
|
467
|
-
}
|
468
|
-
|
469
|
-
exec:
|
470
|
-
|
471
|
-
if (pcre_fullinfo(re_comp.regex, NULL, PCRE_INFO_NAMECOUNT,
|
472
|
-
&name_count) != 0)
|
473
|
-
{
|
474
|
-
msg = "cannot acquire named subpattern count";
|
475
|
-
goto error;
|
476
|
-
}
|
477
|
-
|
478
|
-
if (name_count > 0) {
|
479
|
-
if (pcre_fullinfo(re_comp.regex, NULL, PCRE_INFO_NAMEENTRYSIZE,
|
480
|
-
&name_entry_size) != 0)
|
481
|
-
{
|
482
|
-
msg = "cannot acquire named subpattern entry size";
|
483
|
-
goto error;
|
484
|
-
}
|
485
|
-
|
486
|
-
if (pcre_fullinfo(re_comp.regex, NULL, PCRE_INFO_NAMETABLE,
|
487
|
-
&name_table) != 0)
|
488
|
-
{
|
489
|
-
msg = "cannot acquire named subpattern table";
|
490
|
-
goto error;
|
491
|
-
}
|
492
|
-
}
|
493
|
-
|
494
|
-
if (flags & NGX_LUA_RE_NO_UTF8_CHECK) {
|
495
|
-
exec_opts = PCRE_NO_UTF8_CHECK;
|
496
|
-
|
497
|
-
} else {
|
498
|
-
exec_opts = 0;
|
499
|
-
}
|
500
|
-
|
501
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
502
|
-
|
503
|
-
#if LUA_HAVE_PCRE_DFA
|
504
|
-
|
505
|
-
int ws[NGX_LUA_RE_DFA_MODE_WORKSPACE_COUNT];
|
506
|
-
rc = ngx_http_lua_regex_dfa_exec(re_comp.regex, sd, &subj,
|
507
|
-
(int) pos, cap, ovecsize, ws,
|
508
|
-
sizeof(ws)/sizeof(ws[0]), exec_opts);
|
509
|
-
|
510
|
-
#else /* LUA_HAVE_PCRE_DFA */
|
511
|
-
|
512
|
-
msg = "at least pcre 6.0 is required for the DFA mode";
|
513
|
-
goto error;
|
514
|
-
|
515
|
-
#endif /* LUA_HAVE_PCRE_DFA */
|
516
|
-
|
517
|
-
} else {
|
518
|
-
rc = ngx_http_lua_regex_exec(re_comp.regex, sd, &subj, (int) pos, cap,
|
519
|
-
ovecsize, exec_opts);
|
520
|
-
}
|
521
|
-
|
522
|
-
if (rc == NGX_REGEX_NO_MATCHED) {
|
523
|
-
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
524
|
-
"regex \"%V\" not matched on string \"%V\" starting "
|
525
|
-
"from %i", &pat, &subj, pos);
|
526
|
-
|
527
|
-
if (!(flags & NGX_LUA_RE_COMPILE_ONCE)) {
|
528
|
-
if (sd) {
|
529
|
-
ngx_http_lua_regex_free_study_data(pool, sd);
|
530
|
-
}
|
531
|
-
|
532
|
-
ngx_pfree(pool, re_comp.regex);
|
533
|
-
ngx_pfree(pool, cap);
|
534
|
-
}
|
535
|
-
|
536
|
-
lua_pushnil(L);
|
537
|
-
return 1;
|
538
|
-
}
|
539
|
-
|
540
|
-
if (rc < 0) {
|
541
|
-
msg = lua_pushfstring(L, ngx_regex_exec_n " failed: %d", (int) rc);
|
542
|
-
goto error;
|
543
|
-
}
|
544
|
-
|
545
|
-
if (rc == 0) {
|
546
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
547
|
-
rc = 1;
|
548
|
-
|
549
|
-
} else {
|
550
|
-
msg = "capture size too small";
|
551
|
-
goto error;
|
552
|
-
}
|
553
|
-
}
|
554
|
-
|
555
|
-
dd("rc = %d", (int) rc);
|
556
|
-
|
557
|
-
if (nargs == 4) { /* having ctx table */
|
558
|
-
pos = cap[1];
|
559
|
-
lua_pushinteger(L, (lua_Integer) (pos + 1));
|
560
|
-
lua_setfield(L, 4, "pos");
|
561
|
-
}
|
562
|
-
|
563
|
-
if (!wantcaps) {
|
564
|
-
if (group_id > re_comp.captures) {
|
565
|
-
lua_pushnil(L);
|
566
|
-
lua_pushnil(L);
|
567
|
-
lua_pushliteral(L, "nth out of bound");
|
568
|
-
return 3;
|
569
|
-
}
|
570
|
-
|
571
|
-
if (group_id >= rc) {
|
572
|
-
lua_pushnil(L);
|
573
|
-
lua_pushnil(L);
|
574
|
-
return 2;
|
575
|
-
}
|
576
|
-
|
577
|
-
{
|
578
|
-
int from, to;
|
579
|
-
|
580
|
-
from = cap[group_id * 2] + 1;
|
581
|
-
to = cap[group_id * 2 + 1];
|
582
|
-
if (from < 0 || to < 0) {
|
583
|
-
lua_pushnil(L);
|
584
|
-
lua_pushnil(L);
|
585
|
-
return 2;
|
586
|
-
}
|
587
|
-
|
588
|
-
lua_pushinteger(L, from);
|
589
|
-
lua_pushinteger(L, to);
|
590
|
-
return 2;
|
591
|
-
}
|
592
|
-
}
|
593
|
-
|
594
|
-
if (res_tb_idx == 0) {
|
595
|
-
lua_createtable(L, rc /* narr */, 0 /* nrec */);
|
596
|
-
res_tb_idx = lua_gettop(L);
|
597
|
-
}
|
598
|
-
|
599
|
-
for (i = 0, n = 0; i < rc; i++, n += 2) {
|
600
|
-
dd("capture %d: %d %d", i, cap[n], cap[n + 1]);
|
601
|
-
if (cap[n] < 0) {
|
602
|
-
lua_pushnil(L);
|
603
|
-
|
604
|
-
} else {
|
605
|
-
lua_pushlstring(L, (char *) &subj.data[cap[n]],
|
606
|
-
cap[n + 1] - cap[n]);
|
607
|
-
|
608
|
-
dd("pushing capture %s at %d", lua_tostring(L, -1), (int) i);
|
609
|
-
}
|
610
|
-
|
611
|
-
lua_rawseti(L, res_tb_idx, (int) i);
|
612
|
-
}
|
613
|
-
|
614
|
-
if (name_count > 0) {
|
615
|
-
ngx_http_lua_re_collect_named_captures(L, res_tb_idx, name_table,
|
616
|
-
name_count, name_entry_size,
|
617
|
-
flags, &subj);
|
618
|
-
}
|
619
|
-
|
620
|
-
if (!(flags & NGX_LUA_RE_COMPILE_ONCE)) {
|
621
|
-
|
622
|
-
if (sd) {
|
623
|
-
ngx_http_lua_regex_free_study_data(pool, sd);
|
624
|
-
}
|
625
|
-
|
626
|
-
ngx_pfree(pool, re_comp.regex);
|
627
|
-
ngx_pfree(pool, cap);
|
628
|
-
}
|
629
|
-
|
630
|
-
return 1;
|
631
|
-
|
632
|
-
error:
|
633
|
-
|
634
|
-
if (!(flags & NGX_LUA_RE_COMPILE_ONCE)) {
|
635
|
-
if (sd) {
|
636
|
-
ngx_http_lua_regex_free_study_data(pool, sd);
|
637
|
-
}
|
638
|
-
|
639
|
-
if (re_comp.regex) {
|
640
|
-
ngx_pfree(pool, re_comp.regex);
|
641
|
-
}
|
642
|
-
|
643
|
-
if (cap) {
|
644
|
-
ngx_pfree(pool, cap);
|
645
|
-
}
|
646
|
-
}
|
647
|
-
|
648
|
-
lua_pushnil(L);
|
649
|
-
if (!wantcaps) {
|
650
|
-
lua_pushnil(L);
|
651
|
-
}
|
652
|
-
lua_pushstring(L, msg);
|
653
|
-
return wantcaps ? 2 : 3;
|
654
|
-
}
|
655
|
-
|
656
|
-
|
657
|
-
static int
|
658
|
-
ngx_http_lua_ngx_re_gmatch(lua_State *L)
|
659
|
-
{
|
660
|
-
ngx_http_lua_main_conf_t *lmcf;
|
661
|
-
ngx_http_request_t *r;
|
662
|
-
ngx_str_t subj;
|
663
|
-
ngx_str_t pat;
|
664
|
-
ngx_str_t opts;
|
665
|
-
int ovecsize;
|
666
|
-
ngx_http_lua_regex_t *re;
|
667
|
-
ngx_http_lua_regex_ctx_t *ctx;
|
668
|
-
const char *msg;
|
669
|
-
int nargs;
|
670
|
-
ngx_int_t flags;
|
671
|
-
int *cap = NULL;
|
672
|
-
ngx_int_t rc;
|
673
|
-
ngx_pool_t *pool, *old_pool;
|
674
|
-
u_char errstr[NGX_MAX_CONF_ERRSTR + 1];
|
675
|
-
pcre_extra *sd = NULL;
|
676
|
-
ngx_http_cleanup_t *cln;
|
677
|
-
|
678
|
-
ngx_http_lua_regex_compile_t re_comp;
|
679
|
-
|
680
|
-
nargs = lua_gettop(L);
|
681
|
-
|
682
|
-
if (nargs != 2 && nargs != 3) {
|
683
|
-
return luaL_error(L, "expecting two or three arguments, but got %d",
|
684
|
-
nargs);
|
685
|
-
}
|
686
|
-
|
687
|
-
r = ngx_http_lua_get_req(L);
|
688
|
-
if (r == NULL) {
|
689
|
-
return luaL_error(L, "no request object found");
|
690
|
-
}
|
691
|
-
|
692
|
-
subj.data = (u_char *) luaL_checklstring(L, 1, &subj.len);
|
693
|
-
pat.data = (u_char *) luaL_checklstring(L, 2, &pat.len);
|
694
|
-
|
695
|
-
if (nargs == 3) {
|
696
|
-
opts.data = (u_char *) luaL_checklstring(L, 3, &opts.len);
|
697
|
-
lua_pop(L, 1);
|
698
|
-
|
699
|
-
} else {
|
700
|
-
opts.data = (u_char *) "";
|
701
|
-
opts.len = 0;
|
702
|
-
}
|
703
|
-
|
704
|
-
/* stack: subj regex */
|
705
|
-
|
706
|
-
re_comp.options = 0;
|
707
|
-
|
708
|
-
flags = ngx_http_lua_ngx_re_parse_opts(L, &re_comp, &opts, 3);
|
709
|
-
|
710
|
-
lmcf = ngx_http_get_module_main_conf(r, ngx_http_lua_module);
|
711
|
-
|
712
|
-
if (flags & NGX_LUA_RE_COMPILE_ONCE) {
|
713
|
-
pool = lmcf->pool;
|
714
|
-
|
715
|
-
dd("server pool %p", lmcf->pool);
|
716
|
-
|
717
|
-
lua_pushlightuserdata(L, &ngx_http_lua_regex_cache_key);
|
718
|
-
lua_rawget(L, LUA_REGISTRYINDEX); /* table */
|
719
|
-
|
720
|
-
lua_pushliteral(L, "m");
|
721
|
-
lua_pushvalue(L, 2); /* table regex */
|
722
|
-
|
723
|
-
dd("options size: %d", (int) sizeof(re_comp.options));
|
724
|
-
|
725
|
-
lua_pushlstring(L, (char *) &re_comp.options,
|
726
|
-
sizeof(re_comp.options)); /* table regex opts */
|
727
|
-
|
728
|
-
lua_concat(L, 3); /* table key */
|
729
|
-
lua_pushvalue(L, -1); /* table key key */
|
730
|
-
|
731
|
-
dd("regex cache key: %.*s", (int) (pat.len + sizeof(re_comp.options)),
|
732
|
-
lua_tostring(L, -1));
|
733
|
-
|
734
|
-
lua_rawget(L, -3); /* table key re */
|
735
|
-
re = lua_touserdata(L, -1);
|
736
|
-
|
737
|
-
lua_pop(L, 1); /* table key */
|
738
|
-
|
739
|
-
if (re) {
|
740
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
741
|
-
"lua regex cache hit for match regex \"%s\" "
|
742
|
-
"with options \"%s\"", pat.data, opts.data);
|
743
|
-
|
744
|
-
lua_pop(L, 2);
|
745
|
-
|
746
|
-
dd("restoring regex %p, ncaptures %d, captures %p", re->regex,
|
747
|
-
re->ncaptures, re->captures);
|
748
|
-
|
749
|
-
re_comp.regex = re->regex;
|
750
|
-
sd = re->regex_sd;
|
751
|
-
re_comp.captures = re->ncaptures;
|
752
|
-
cap = re->captures;
|
753
|
-
|
754
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
755
|
-
ovecsize = 2;
|
756
|
-
|
757
|
-
} else {
|
758
|
-
ovecsize = (re->ncaptures + 1) * 3;
|
759
|
-
}
|
760
|
-
|
761
|
-
goto compiled;
|
762
|
-
}
|
763
|
-
|
764
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
765
|
-
"lua regex cache miss for match regex \"%s\" "
|
766
|
-
"with options \"%s\"", pat.data, opts.data);
|
767
|
-
|
768
|
-
if (lmcf->regex_cache_entries >= lmcf->regex_cache_max_entries) {
|
769
|
-
|
770
|
-
if (lmcf->regex_cache_entries == lmcf->regex_cache_max_entries) {
|
771
|
-
ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
|
772
|
-
"lua exceeding regex cache max entries (%i)",
|
773
|
-
lmcf->regex_cache_max_entries);
|
774
|
-
|
775
|
-
lmcf->regex_cache_entries++;
|
776
|
-
}
|
777
|
-
|
778
|
-
pool = r->pool;
|
779
|
-
flags &= ~NGX_LUA_RE_COMPILE_ONCE;
|
780
|
-
}
|
781
|
-
|
782
|
-
} else {
|
783
|
-
pool = r->pool;
|
784
|
-
}
|
785
|
-
|
786
|
-
re_comp.pattern = pat;
|
787
|
-
re_comp.err.len = NGX_MAX_CONF_ERRSTR;
|
788
|
-
re_comp.err.data = errstr;
|
789
|
-
re_comp.pool = pool;
|
790
|
-
|
791
|
-
ngx_log_debug5(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
792
|
-
"lua compiling gmatch regex \"%s\" with options \"%s\" "
|
793
|
-
"(compile once: %d) (dfa mode: %d) (jit mode: %d)",
|
794
|
-
pat.data, opts.data,
|
795
|
-
(flags & NGX_LUA_RE_COMPILE_ONCE) != 0,
|
796
|
-
(flags & NGX_LUA_RE_MODE_DFA) != 0,
|
797
|
-
(flags & NGX_LUA_RE_MODE_JIT) != 0);
|
798
|
-
|
799
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
800
|
-
|
801
|
-
rc = ngx_http_lua_regex_compile(&re_comp);
|
802
|
-
|
803
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
804
|
-
|
805
|
-
if (rc != NGX_OK) {
|
806
|
-
dd("compile failed");
|
807
|
-
|
808
|
-
lua_pushnil(L);
|
809
|
-
lua_pushlstring(L, (char *) re_comp.err.data, re_comp.err.len);
|
810
|
-
return 2;
|
811
|
-
}
|
812
|
-
|
813
|
-
#if LUA_HAVE_PCRE_JIT
|
814
|
-
|
815
|
-
if (flags & NGX_LUA_RE_MODE_JIT) {
|
816
|
-
|
817
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
818
|
-
|
819
|
-
sd = pcre_study(re_comp.regex, PCRE_STUDY_JIT_COMPILE, &msg);
|
820
|
-
|
821
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
822
|
-
|
823
|
-
# if (NGX_DEBUG)
|
824
|
-
dd("sd = %p", sd);
|
825
|
-
|
826
|
-
if (msg != NULL) {
|
827
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
828
|
-
"pcre_study failed with PCRE_STUDY_JIT_COMPILE: "
|
829
|
-
"%s (%p)", msg, sd);
|
830
|
-
}
|
831
|
-
|
832
|
-
if (sd != NULL) {
|
833
|
-
int jitted;
|
834
|
-
|
835
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
836
|
-
|
837
|
-
pcre_fullinfo(re_comp.regex, sd, PCRE_INFO_JIT, &jitted);
|
838
|
-
|
839
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
840
|
-
|
841
|
-
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
842
|
-
"pcre JIT compiling result: %d", jitted);
|
843
|
-
}
|
844
|
-
# endif /* NGX_DEBUG */
|
845
|
-
|
846
|
-
} else {
|
847
|
-
|
848
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
849
|
-
|
850
|
-
sd = pcre_study(re_comp.regex, 0, &msg);
|
851
|
-
|
852
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
853
|
-
|
854
|
-
# if (NGX_DEBUG)
|
855
|
-
dd("sd = %p", sd);
|
856
|
-
|
857
|
-
if (msg != NULL) {
|
858
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
859
|
-
"pcre study failed with PCRE_STUDY_JIT_COMPILE: "
|
860
|
-
"%s (%p)", msg, sd);
|
861
|
-
}
|
862
|
-
# endif /* NGX_DEBUG */
|
863
|
-
}
|
864
|
-
|
865
|
-
#else /* LUA_HAVE_PCRE_JIT */
|
866
|
-
|
867
|
-
if (flags & NGX_LUA_RE_MODE_JIT) {
|
868
|
-
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
869
|
-
"your pcre build does not have JIT support and "
|
870
|
-
"the \"j\" regex option is ignored");
|
871
|
-
}
|
872
|
-
|
873
|
-
#endif /* LUA_HAVE_PCRE_JIT */
|
874
|
-
|
875
|
-
if (sd && lmcf->regex_match_limit > 0) {
|
876
|
-
sd->flags |= PCRE_EXTRA_MATCH_LIMIT;
|
877
|
-
sd->match_limit = lmcf->regex_match_limit;
|
878
|
-
}
|
879
|
-
|
880
|
-
dd("compile done, captures %d", re_comp.captures);
|
881
|
-
|
882
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
883
|
-
ovecsize = 2;
|
884
|
-
|
885
|
-
} else {
|
886
|
-
ovecsize = (re_comp.captures + 1) * 3;
|
887
|
-
}
|
888
|
-
|
889
|
-
cap = ngx_palloc(pool, ovecsize * sizeof(int));
|
890
|
-
if (cap == NULL) {
|
891
|
-
flags &= ~NGX_LUA_RE_COMPILE_ONCE;
|
892
|
-
msg = "no memory";
|
893
|
-
goto error;
|
894
|
-
}
|
895
|
-
|
896
|
-
if (flags & NGX_LUA_RE_COMPILE_ONCE) {
|
897
|
-
|
898
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
899
|
-
"lua saving compiled regex (%d captures) into the cache "
|
900
|
-
"(entries %i)", re_comp.captures,
|
901
|
-
lmcf->regex_cache_entries);
|
902
|
-
|
903
|
-
re = ngx_palloc(pool, sizeof(ngx_http_lua_regex_t));
|
904
|
-
if (re == NULL) {
|
905
|
-
msg = "no memory";
|
906
|
-
goto error;
|
907
|
-
}
|
908
|
-
|
909
|
-
dd("saving regex %p, ncaptures %d, captures %p", re_comp.regex,
|
910
|
-
re_comp.captures, cap);
|
911
|
-
|
912
|
-
re->regex = re_comp.regex;
|
913
|
-
re->regex_sd = sd;
|
914
|
-
re->ncaptures = re_comp.captures;
|
915
|
-
re->captures = cap;
|
916
|
-
re->replace = NULL;
|
917
|
-
|
918
|
-
lua_pushlightuserdata(L, re); /* table key value */
|
919
|
-
lua_rawset(L, -3); /* table */
|
920
|
-
lua_pop(L, 1);
|
921
|
-
|
922
|
-
if (lmcf) {
|
923
|
-
lmcf->regex_cache_entries++;
|
924
|
-
}
|
925
|
-
}
|
926
|
-
|
927
|
-
compiled:
|
928
|
-
|
929
|
-
lua_settop(L, 1);
|
930
|
-
|
931
|
-
ctx = lua_newuserdata(L, sizeof(ngx_http_lua_regex_ctx_t));
|
932
|
-
|
933
|
-
ctx->request = r;
|
934
|
-
ctx->regex = re_comp.regex;
|
935
|
-
ctx->regex_sd = sd;
|
936
|
-
ctx->ncaptures = re_comp.captures;
|
937
|
-
ctx->captures = cap;
|
938
|
-
ctx->captures_len = ovecsize;
|
939
|
-
ctx->flags = (uint8_t) flags;
|
940
|
-
|
941
|
-
if (!(flags & NGX_LUA_RE_COMPILE_ONCE)) {
|
942
|
-
lua_createtable(L, 0 /* narr */, 1 /* nrec */); /* metatable */
|
943
|
-
lua_pushcfunction(L, ngx_http_lua_ngx_re_gmatch_gc);
|
944
|
-
lua_setfield(L, -2, "__gc");
|
945
|
-
lua_setmetatable(L, -2);
|
946
|
-
|
947
|
-
cln = ngx_http_cleanup_add(r, 0);
|
948
|
-
if (cln == NULL) {
|
949
|
-
msg = "no memory";
|
950
|
-
goto error;
|
951
|
-
}
|
952
|
-
|
953
|
-
cln->handler = ngx_http_lua_ngx_re_gmatch_cleanup;
|
954
|
-
cln->data = ctx;
|
955
|
-
ctx->cleanup = &cln->handler;
|
956
|
-
|
957
|
-
} else {
|
958
|
-
ctx->cleanup = NULL;
|
959
|
-
}
|
960
|
-
|
961
|
-
lua_pushinteger(L, 0);
|
962
|
-
|
963
|
-
/* upvalues in order: subj ctx offset */
|
964
|
-
lua_pushcclosure(L, ngx_http_lua_ngx_re_gmatch_iterator, 3);
|
965
|
-
|
966
|
-
return 1;
|
967
|
-
|
968
|
-
error:
|
969
|
-
|
970
|
-
if (!(flags & NGX_LUA_RE_COMPILE_ONCE)) {
|
971
|
-
if (sd) {
|
972
|
-
ngx_http_lua_regex_free_study_data(pool, sd);
|
973
|
-
}
|
974
|
-
|
975
|
-
if (re_comp.regex) {
|
976
|
-
ngx_pfree(pool, re_comp.regex);
|
977
|
-
}
|
978
|
-
|
979
|
-
if (cap) {
|
980
|
-
ngx_pfree(pool, cap);
|
981
|
-
}
|
982
|
-
}
|
983
|
-
|
984
|
-
lua_pushnil(L);
|
985
|
-
lua_pushstring(L, msg);
|
986
|
-
return 2;
|
987
|
-
}
|
988
|
-
|
989
|
-
|
990
|
-
static int
|
991
|
-
ngx_http_lua_ngx_re_gmatch_iterator(lua_State *L)
|
992
|
-
{
|
993
|
-
ngx_http_lua_regex_ctx_t *ctx;
|
994
|
-
ngx_http_request_t *r;
|
995
|
-
int *cap;
|
996
|
-
ngx_int_t rc;
|
997
|
-
ngx_uint_t n;
|
998
|
-
int i;
|
999
|
-
ngx_str_t subj;
|
1000
|
-
int offset;
|
1001
|
-
const char *msg = NULL;
|
1002
|
-
int name_entry_size = 0, name_count;
|
1003
|
-
u_char *name_table = NULL;
|
1004
|
-
int exec_opts;
|
1005
|
-
|
1006
|
-
/* upvalues in order: subj ctx offset */
|
1007
|
-
|
1008
|
-
subj.data = (u_char *) lua_tolstring(L, lua_upvalueindex(1), &subj.len);
|
1009
|
-
ctx = (ngx_http_lua_regex_ctx_t *) lua_touserdata(L, lua_upvalueindex(2));
|
1010
|
-
offset = (int) lua_tointeger(L, lua_upvalueindex(3));
|
1011
|
-
|
1012
|
-
if (offset < 0) {
|
1013
|
-
lua_pushnil(L);
|
1014
|
-
return 1;
|
1015
|
-
}
|
1016
|
-
|
1017
|
-
cap = ctx->captures;
|
1018
|
-
|
1019
|
-
dd("offset %d, r %p, subj %s", (int) offset, ctx->request, subj.data);
|
1020
|
-
|
1021
|
-
r = ngx_http_lua_get_req(L);
|
1022
|
-
if (r == NULL) {
|
1023
|
-
return luaL_error(L, "no request object found");
|
1024
|
-
}
|
1025
|
-
|
1026
|
-
if (r != ctx->request || r->pool != ctx->request->pool) {
|
1027
|
-
return luaL_error(L, "attempt to use ngx.re.gmatch iterator in a "
|
1028
|
-
"request that did not create it");
|
1029
|
-
}
|
1030
|
-
|
1031
|
-
dd("regex exec...");
|
1032
|
-
|
1033
|
-
if (pcre_fullinfo(ctx->regex, NULL, PCRE_INFO_NAMECOUNT,
|
1034
|
-
&name_count) != 0)
|
1035
|
-
{
|
1036
|
-
msg = "cannot acquire named subpattern count";
|
1037
|
-
goto error;
|
1038
|
-
}
|
1039
|
-
|
1040
|
-
if (name_count > 0) {
|
1041
|
-
if (pcre_fullinfo(ctx->regex, NULL, PCRE_INFO_NAMEENTRYSIZE,
|
1042
|
-
&name_entry_size) != 0)
|
1043
|
-
{
|
1044
|
-
msg = "cannot acquire named subpattern entry size";
|
1045
|
-
goto error;
|
1046
|
-
}
|
1047
|
-
|
1048
|
-
if (pcre_fullinfo(ctx->regex, NULL, PCRE_INFO_NAMETABLE,
|
1049
|
-
&name_table) != 0)
|
1050
|
-
{
|
1051
|
-
msg = "cannot acquire named subpattern table";
|
1052
|
-
goto error;
|
1053
|
-
}
|
1054
|
-
}
|
1055
|
-
|
1056
|
-
if (ctx->flags & NGX_LUA_RE_NO_UTF8_CHECK) {
|
1057
|
-
exec_opts = PCRE_NO_UTF8_CHECK;
|
1058
|
-
|
1059
|
-
} else {
|
1060
|
-
exec_opts = 0;
|
1061
|
-
}
|
1062
|
-
|
1063
|
-
if (ctx->flags & NGX_LUA_RE_MODE_DFA) {
|
1064
|
-
|
1065
|
-
#if LUA_HAVE_PCRE_DFA
|
1066
|
-
|
1067
|
-
int ws[NGX_LUA_RE_DFA_MODE_WORKSPACE_COUNT];
|
1068
|
-
|
1069
|
-
rc = ngx_http_lua_regex_dfa_exec(ctx->regex, ctx->regex_sd, &subj,
|
1070
|
-
offset, cap, ctx->captures_len, ws,
|
1071
|
-
sizeof(ws)/sizeof(ws[0]), exec_opts);
|
1072
|
-
|
1073
|
-
#else /* LUA_HAVE_PCRE_DFA */
|
1074
|
-
msg = "at least pcre 6.0 is required for the DFA mode";
|
1075
|
-
goto error;
|
1076
|
-
|
1077
|
-
#endif /* LUA_HAVE_PCRE_DFA */
|
1078
|
-
|
1079
|
-
} else {
|
1080
|
-
rc = ngx_http_lua_regex_exec(ctx->regex, ctx->regex_sd, &subj,
|
1081
|
-
offset, cap, ctx->captures_len,
|
1082
|
-
exec_opts);
|
1083
|
-
}
|
1084
|
-
|
1085
|
-
if (rc == NGX_REGEX_NO_MATCHED) {
|
1086
|
-
/* set upvalue "offset" to -1 */
|
1087
|
-
lua_pushinteger(L, -1);
|
1088
|
-
lua_replace(L, lua_upvalueindex(3));
|
1089
|
-
|
1090
|
-
if (!(ctx->flags & NGX_LUA_RE_COMPILE_ONCE)) {
|
1091
|
-
if (ctx->regex_sd) {
|
1092
|
-
ngx_http_lua_regex_free_study_data(r->pool, ctx->regex_sd);
|
1093
|
-
ctx->regex_sd = NULL;
|
1094
|
-
}
|
1095
|
-
|
1096
|
-
ngx_pfree(r->pool, cap);
|
1097
|
-
}
|
1098
|
-
|
1099
|
-
lua_pushnil(L);
|
1100
|
-
return 1;
|
1101
|
-
}
|
1102
|
-
|
1103
|
-
if (rc < 0) {
|
1104
|
-
msg = lua_pushfstring(L, ngx_regex_exec_n " failed: %d", (int) rc);
|
1105
|
-
goto error;
|
1106
|
-
}
|
1107
|
-
|
1108
|
-
if (rc == 0) {
|
1109
|
-
if (ctx->flags & NGX_LUA_RE_MODE_DFA) {
|
1110
|
-
rc = 1;
|
1111
|
-
|
1112
|
-
} else {
|
1113
|
-
goto error;
|
1114
|
-
}
|
1115
|
-
}
|
1116
|
-
|
1117
|
-
dd("rc = %d", (int) rc);
|
1118
|
-
|
1119
|
-
lua_createtable(L, rc /* narr */, 0 /* nrec */);
|
1120
|
-
|
1121
|
-
for (i = 0, n = 0; i < rc; i++, n += 2) {
|
1122
|
-
dd("capture %d: %d %d", i, cap[n], cap[n + 1]);
|
1123
|
-
if (cap[n] < 0) {
|
1124
|
-
lua_pushnil(L);
|
1125
|
-
|
1126
|
-
} else {
|
1127
|
-
lua_pushlstring(L, (char *) &subj.data[cap[n]],
|
1128
|
-
cap[n + 1] - cap[n]);
|
1129
|
-
|
1130
|
-
dd("pushing capture %s at %d", lua_tostring(L, -1), (int) i);
|
1131
|
-
}
|
1132
|
-
|
1133
|
-
lua_rawseti(L, -2, (int) i);
|
1134
|
-
}
|
1135
|
-
|
1136
|
-
if (name_count > 0) {
|
1137
|
-
ngx_http_lua_re_collect_named_captures(L, lua_gettop(L), name_table,
|
1138
|
-
name_count, name_entry_size,
|
1139
|
-
ctx->flags, &subj);
|
1140
|
-
}
|
1141
|
-
|
1142
|
-
offset = cap[1];
|
1143
|
-
if (offset == cap[0]) {
|
1144
|
-
offset++;
|
1145
|
-
}
|
1146
|
-
|
1147
|
-
if (offset > (ssize_t) subj.len) {
|
1148
|
-
offset = -1;
|
1149
|
-
|
1150
|
-
if (!(ctx->flags & NGX_LUA_RE_COMPILE_ONCE)) {
|
1151
|
-
if (ctx->regex_sd) {
|
1152
|
-
ngx_http_lua_regex_free_study_data(r->pool, ctx->regex_sd);
|
1153
|
-
ctx->regex_sd = NULL;
|
1154
|
-
}
|
1155
|
-
|
1156
|
-
ngx_pfree(r->pool, cap);
|
1157
|
-
}
|
1158
|
-
}
|
1159
|
-
|
1160
|
-
lua_pushinteger(L, offset);
|
1161
|
-
lua_replace(L, lua_upvalueindex(3));
|
1162
|
-
|
1163
|
-
return 1;
|
1164
|
-
|
1165
|
-
error:
|
1166
|
-
|
1167
|
-
lua_pushinteger(L, -1);
|
1168
|
-
lua_replace(L, lua_upvalueindex(3));
|
1169
|
-
|
1170
|
-
if (!(ctx->flags & NGX_LUA_RE_COMPILE_ONCE)) {
|
1171
|
-
if (ctx->regex_sd) {
|
1172
|
-
ngx_http_lua_regex_free_study_data(r->pool, ctx->regex_sd);
|
1173
|
-
ctx->regex_sd = NULL;
|
1174
|
-
}
|
1175
|
-
|
1176
|
-
ngx_pfree(r->pool, cap);
|
1177
|
-
}
|
1178
|
-
|
1179
|
-
lua_pushnil(L);
|
1180
|
-
lua_pushstring(L, msg);
|
1181
|
-
return 2;
|
1182
|
-
}
|
1183
|
-
|
1184
|
-
|
1185
|
-
static ngx_uint_t
|
1186
|
-
ngx_http_lua_ngx_re_parse_opts(lua_State *L, ngx_http_lua_regex_compile_t *re,
|
1187
|
-
ngx_str_t *opts, int narg)
|
1188
|
-
{
|
1189
|
-
u_char *p;
|
1190
|
-
const char *msg;
|
1191
|
-
ngx_uint_t flags;
|
1192
|
-
|
1193
|
-
flags = 0;
|
1194
|
-
p = opts->data;
|
1195
|
-
|
1196
|
-
while (*p != '\0') {
|
1197
|
-
switch (*p) {
|
1198
|
-
case 'i':
|
1199
|
-
re->options |= NGX_REGEX_CASELESS;
|
1200
|
-
break;
|
1201
|
-
|
1202
|
-
case 's':
|
1203
|
-
re->options |= PCRE_DOTALL;
|
1204
|
-
break;
|
1205
|
-
|
1206
|
-
case 'm':
|
1207
|
-
re->options |= PCRE_MULTILINE;
|
1208
|
-
break;
|
1209
|
-
|
1210
|
-
case 'u':
|
1211
|
-
re->options |= PCRE_UTF8;
|
1212
|
-
break;
|
1213
|
-
|
1214
|
-
case 'U':
|
1215
|
-
re->options |= PCRE_UTF8;
|
1216
|
-
flags |= NGX_LUA_RE_NO_UTF8_CHECK;
|
1217
|
-
break;
|
1218
|
-
|
1219
|
-
case 'x':
|
1220
|
-
re->options |= PCRE_EXTENDED;
|
1221
|
-
break;
|
1222
|
-
|
1223
|
-
case 'o':
|
1224
|
-
flags |= NGX_LUA_RE_COMPILE_ONCE;
|
1225
|
-
break;
|
1226
|
-
|
1227
|
-
case 'j':
|
1228
|
-
flags |= NGX_LUA_RE_MODE_JIT;
|
1229
|
-
break;
|
1230
|
-
|
1231
|
-
case 'd':
|
1232
|
-
flags |= NGX_LUA_RE_MODE_DFA;
|
1233
|
-
break;
|
1234
|
-
|
1235
|
-
case 'a':
|
1236
|
-
re->options |= PCRE_ANCHORED;
|
1237
|
-
break;
|
1238
|
-
|
1239
|
-
#if (PCRE_MAJOR > 8) || (PCRE_MAJOR == 8 && PCRE_MINOR >= 12)
|
1240
|
-
case 'D':
|
1241
|
-
re->options |= PCRE_DUPNAMES;
|
1242
|
-
flags |= NGX_LUA_RE_MODE_DUPNAMES;
|
1243
|
-
break;
|
1244
|
-
|
1245
|
-
case 'J':
|
1246
|
-
re->options |= PCRE_JAVASCRIPT_COMPAT;
|
1247
|
-
break;
|
1248
|
-
#endif
|
1249
|
-
|
1250
|
-
default:
|
1251
|
-
msg = lua_pushfstring(L, "unknown flag \"%c\" (flags \"%s\")",
|
1252
|
-
*p, opts->data);
|
1253
|
-
return luaL_argerror(L, narg, msg);
|
1254
|
-
}
|
1255
|
-
|
1256
|
-
p++;
|
1257
|
-
}
|
1258
|
-
|
1259
|
-
/* pcre does not support JIT for DFA mode yet,
|
1260
|
-
* so if DFA mode is specified, we turn off JIT automatically
|
1261
|
-
* */
|
1262
|
-
if ((flags & NGX_LUA_RE_MODE_JIT) && (flags & NGX_LUA_RE_MODE_DFA)) {
|
1263
|
-
flags &= ~NGX_LUA_RE_MODE_JIT;
|
1264
|
-
}
|
1265
|
-
|
1266
|
-
return flags;
|
1267
|
-
}
|
1268
|
-
|
1269
|
-
|
1270
|
-
static int
|
1271
|
-
ngx_http_lua_ngx_re_sub(lua_State *L)
|
1272
|
-
{
|
1273
|
-
return ngx_http_lua_ngx_re_sub_helper(L, 0 /* global */);
|
1274
|
-
}
|
1275
|
-
|
1276
|
-
|
1277
|
-
static int
|
1278
|
-
ngx_http_lua_ngx_re_gsub(lua_State *L)
|
1279
|
-
{
|
1280
|
-
return ngx_http_lua_ngx_re_sub_helper(L, 1 /* global */);
|
1281
|
-
}
|
1282
|
-
|
1283
|
-
|
1284
|
-
static int
|
1285
|
-
ngx_http_lua_ngx_re_sub_helper(lua_State *L, unsigned global)
|
1286
|
-
{
|
1287
|
-
ngx_http_lua_regex_t *re;
|
1288
|
-
ngx_http_request_t *r;
|
1289
|
-
ngx_str_t subj;
|
1290
|
-
ngx_str_t pat;
|
1291
|
-
ngx_str_t opts;
|
1292
|
-
ngx_str_t tpl;
|
1293
|
-
ngx_http_lua_main_conf_t *lmcf;
|
1294
|
-
ngx_pool_t *pool, *old_pool;
|
1295
|
-
const char *msg;
|
1296
|
-
ngx_int_t rc;
|
1297
|
-
ngx_uint_t n;
|
1298
|
-
ngx_int_t i;
|
1299
|
-
int nargs;
|
1300
|
-
int *cap = NULL;
|
1301
|
-
int ovecsize;
|
1302
|
-
int type;
|
1303
|
-
unsigned func;
|
1304
|
-
int offset;
|
1305
|
-
int cp_offset;
|
1306
|
-
size_t count;
|
1307
|
-
luaL_Buffer luabuf;
|
1308
|
-
ngx_int_t flags;
|
1309
|
-
u_char *p;
|
1310
|
-
u_char errstr[NGX_MAX_CONF_ERRSTR + 1];
|
1311
|
-
pcre_extra *sd = NULL;
|
1312
|
-
int name_entry_size = 0, name_count;
|
1313
|
-
u_char *name_table = NULL;
|
1314
|
-
int exec_opts;
|
1315
|
-
|
1316
|
-
ngx_http_lua_regex_compile_t re_comp;
|
1317
|
-
ngx_http_lua_complex_value_t *ctpl = NULL;
|
1318
|
-
ngx_http_lua_compile_complex_value_t ccv;
|
1319
|
-
|
1320
|
-
nargs = lua_gettop(L);
|
1321
|
-
|
1322
|
-
if (nargs != 3 && nargs != 4) {
|
1323
|
-
return luaL_error(L, "expecting three or four arguments, but got %d",
|
1324
|
-
nargs);
|
1325
|
-
}
|
1326
|
-
|
1327
|
-
r = ngx_http_lua_get_req(L);
|
1328
|
-
if (r == NULL) {
|
1329
|
-
return luaL_error(L, "no request object found");
|
1330
|
-
}
|
1331
|
-
|
1332
|
-
subj.data = (u_char *) luaL_checklstring(L, 1, &subj.len);
|
1333
|
-
pat.data = (u_char *) luaL_checklstring(L, 2, &pat.len);
|
1334
|
-
|
1335
|
-
func = 0;
|
1336
|
-
|
1337
|
-
type = lua_type(L, 3);
|
1338
|
-
switch (type) {
|
1339
|
-
case LUA_TFUNCTION:
|
1340
|
-
func = 1;
|
1341
|
-
tpl.len = 0;
|
1342
|
-
tpl.data = (u_char *) "";
|
1343
|
-
break;
|
1344
|
-
|
1345
|
-
case LUA_TNUMBER:
|
1346
|
-
case LUA_TSTRING:
|
1347
|
-
tpl.data = (u_char *) lua_tolstring(L, 3, &tpl.len);
|
1348
|
-
break;
|
1349
|
-
|
1350
|
-
default:
|
1351
|
-
msg = lua_pushfstring(L, "string, number, or function expected, "
|
1352
|
-
"got %s", lua_typename(L, type));
|
1353
|
-
return luaL_argerror(L, 3, msg);
|
1354
|
-
}
|
1355
|
-
|
1356
|
-
ngx_memzero(&re_comp, sizeof(ngx_http_lua_regex_compile_t));
|
1357
|
-
|
1358
|
-
if (nargs == 4) {
|
1359
|
-
opts.data = (u_char *) luaL_checklstring(L, 4, &opts.len);
|
1360
|
-
lua_pop(L, 1);
|
1361
|
-
|
1362
|
-
} else { /* nargs == 3 */
|
1363
|
-
opts.data = (u_char *) "";
|
1364
|
-
opts.len = 0;
|
1365
|
-
}
|
1366
|
-
|
1367
|
-
/* stack: subj regex repl */
|
1368
|
-
|
1369
|
-
re_comp.options = 0;
|
1370
|
-
|
1371
|
-
flags = ngx_http_lua_ngx_re_parse_opts(L, &re_comp, &opts, 4);
|
1372
|
-
|
1373
|
-
lmcf = ngx_http_get_module_main_conf(r, ngx_http_lua_module);
|
1374
|
-
|
1375
|
-
if (flags & NGX_LUA_RE_COMPILE_ONCE) {
|
1376
|
-
pool = lmcf->pool;
|
1377
|
-
|
1378
|
-
dd("server pool %p", lmcf->pool);
|
1379
|
-
|
1380
|
-
lua_pushlightuserdata(L, &ngx_http_lua_regex_cache_key);
|
1381
|
-
lua_rawget(L, LUA_REGISTRYINDEX); /* table */
|
1382
|
-
|
1383
|
-
lua_pushliteral(L, "s");
|
1384
|
-
lua_pushinteger(L, tpl.len);
|
1385
|
-
lua_pushliteral(L, ":");
|
1386
|
-
lua_pushvalue(L, 2);
|
1387
|
-
|
1388
|
-
if (tpl.len != 0) {
|
1389
|
-
lua_pushvalue(L, 3);
|
1390
|
-
}
|
1391
|
-
|
1392
|
-
dd("options size: %d", (int) sizeof(re_comp.options));
|
1393
|
-
|
1394
|
-
lua_pushlstring(L, (char *) &re_comp.options, sizeof(re_comp.options));
|
1395
|
-
/* table regex opts */
|
1396
|
-
|
1397
|
-
if (tpl.len == 0) {
|
1398
|
-
lua_concat(L, 5); /* table key */
|
1399
|
-
|
1400
|
-
} else {
|
1401
|
-
lua_concat(L, 6); /* table key */
|
1402
|
-
}
|
1403
|
-
|
1404
|
-
lua_pushvalue(L, -1); /* table key key */
|
1405
|
-
|
1406
|
-
dd("regex cache key: %.*s", (int) (pat.len + sizeof(re_comp.options)),
|
1407
|
-
lua_tostring(L, -1));
|
1408
|
-
|
1409
|
-
lua_rawget(L, -3); /* table key re */
|
1410
|
-
re = lua_touserdata(L, -1);
|
1411
|
-
|
1412
|
-
lua_pop(L, 1); /* table key */
|
1413
|
-
|
1414
|
-
if (re) {
|
1415
|
-
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1416
|
-
"lua regex cache hit for sub regex \"%s\" with "
|
1417
|
-
"options \"%s\" and replace \"%s\"",
|
1418
|
-
pat.data, opts.data,
|
1419
|
-
func ? (u_char *) "<func>" : tpl.data);
|
1420
|
-
|
1421
|
-
lua_pop(L, 2);
|
1422
|
-
|
1423
|
-
dd("restoring regex %p, ncaptures %d, captures %p", re->regex,
|
1424
|
-
re->ncaptures, re->captures);
|
1425
|
-
|
1426
|
-
re_comp.regex = re->regex;
|
1427
|
-
sd = re->regex_sd;
|
1428
|
-
re_comp.captures = re->ncaptures;
|
1429
|
-
cap = re->captures;
|
1430
|
-
ctpl = re->replace;
|
1431
|
-
|
1432
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
1433
|
-
ovecsize = 2;
|
1434
|
-
|
1435
|
-
} else {
|
1436
|
-
ovecsize = (re->ncaptures + 1) * 3;
|
1437
|
-
}
|
1438
|
-
|
1439
|
-
goto exec;
|
1440
|
-
}
|
1441
|
-
|
1442
|
-
ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1443
|
-
"lua regex cache miss for %ssub regex \"%s\" with "
|
1444
|
-
"options \"%s\" and replace \"%s\"",
|
1445
|
-
global ? "g" : "", pat.data, opts.data,
|
1446
|
-
func ? (u_char *) "<func>" : tpl.data);
|
1447
|
-
|
1448
|
-
if (lmcf->regex_cache_entries >= lmcf->regex_cache_max_entries) {
|
1449
|
-
|
1450
|
-
if (lmcf->regex_cache_entries == lmcf->regex_cache_max_entries) {
|
1451
|
-
ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
|
1452
|
-
"lua exceeding regex cache max entries (%i)",
|
1453
|
-
lmcf->regex_cache_max_entries);
|
1454
|
-
|
1455
|
-
lmcf->regex_cache_entries++;
|
1456
|
-
}
|
1457
|
-
|
1458
|
-
pool = r->pool;
|
1459
|
-
flags &= ~NGX_LUA_RE_COMPILE_ONCE;
|
1460
|
-
}
|
1461
|
-
|
1462
|
-
} else {
|
1463
|
-
pool = r->pool;
|
1464
|
-
}
|
1465
|
-
|
1466
|
-
re_comp.pattern = pat;
|
1467
|
-
re_comp.err.len = NGX_MAX_CONF_ERRSTR;
|
1468
|
-
re_comp.err.data = errstr;
|
1469
|
-
re_comp.pool = pool;
|
1470
|
-
|
1471
|
-
dd("compiling regex");
|
1472
|
-
|
1473
|
-
ngx_log_debug6(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1474
|
-
"lua compiling %ssub regex \"%s\" with options \"%s\" "
|
1475
|
-
"(compile once: %d) (dfa mode: %d) (jit mode: %d)",
|
1476
|
-
global ? "g" : "", pat.data, opts.data,
|
1477
|
-
(flags & NGX_LUA_RE_COMPILE_ONCE) != 0,
|
1478
|
-
(flags & NGX_LUA_RE_MODE_DFA) != 0,
|
1479
|
-
(flags & NGX_LUA_RE_MODE_JIT) != 0);
|
1480
|
-
|
1481
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
1482
|
-
|
1483
|
-
rc = ngx_http_lua_regex_compile(&re_comp);
|
1484
|
-
|
1485
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
1486
|
-
|
1487
|
-
if (rc != NGX_OK) {
|
1488
|
-
dd("compile failed");
|
1489
|
-
|
1490
|
-
lua_pushnil(L);
|
1491
|
-
lua_pushnil(L);
|
1492
|
-
lua_pushlstring(L, (char *) re_comp.err.data, re_comp.err.len);
|
1493
|
-
return 3;
|
1494
|
-
}
|
1495
|
-
|
1496
|
-
#if LUA_HAVE_PCRE_JIT
|
1497
|
-
|
1498
|
-
if (flags & NGX_LUA_RE_MODE_JIT) {
|
1499
|
-
|
1500
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
1501
|
-
|
1502
|
-
sd = pcre_study(re_comp.regex, PCRE_STUDY_JIT_COMPILE, &msg);
|
1503
|
-
|
1504
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
1505
|
-
|
1506
|
-
# if (NGX_DEBUG)
|
1507
|
-
dd("sd = %p", sd);
|
1508
|
-
|
1509
|
-
if (msg != NULL) {
|
1510
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1511
|
-
"pcre study failed with PCRE_STUDY_JIT_COMPILE: "
|
1512
|
-
"%s (%p)", msg, sd);
|
1513
|
-
}
|
1514
|
-
|
1515
|
-
if (sd != NULL) {
|
1516
|
-
int jitted;
|
1517
|
-
|
1518
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
1519
|
-
|
1520
|
-
pcre_fullinfo(re_comp.regex, sd, PCRE_INFO_JIT, &jitted);
|
1521
|
-
|
1522
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
1523
|
-
|
1524
|
-
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1525
|
-
"pcre JIT compiling result: %d", jitted);
|
1526
|
-
}
|
1527
|
-
# endif /* NGX_DEBUG */
|
1528
|
-
|
1529
|
-
} else {
|
1530
|
-
|
1531
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
1532
|
-
|
1533
|
-
sd = pcre_study(re_comp.regex, 0, &msg);
|
1534
|
-
|
1535
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
1536
|
-
|
1537
|
-
# if (NGX_DEBUG)
|
1538
|
-
dd("sd = %p", sd);
|
1539
|
-
|
1540
|
-
if (msg != NULL) {
|
1541
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1542
|
-
"pcre_study failed with PCRE_STUDY_JIT_COMPILE: "
|
1543
|
-
"%s (%p)", msg, sd);
|
1544
|
-
}
|
1545
|
-
# endif /* NGX_DEBUG */
|
1546
|
-
}
|
1547
|
-
|
1548
|
-
#else /* LUA_HAVE_PCRE_JIT */
|
1549
|
-
|
1550
|
-
if (flags & NGX_LUA_RE_MODE_JIT) {
|
1551
|
-
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1552
|
-
"your pcre build does not have JIT support and "
|
1553
|
-
"the \"j\" regex option is ignored");
|
1554
|
-
}
|
1555
|
-
|
1556
|
-
#endif /* LUA_HAVE_PCRE_JIT */
|
1557
|
-
|
1558
|
-
if (sd && lmcf->regex_match_limit > 0) {
|
1559
|
-
sd->flags |= PCRE_EXTRA_MATCH_LIMIT;
|
1560
|
-
sd->match_limit = lmcf->regex_match_limit;
|
1561
|
-
}
|
1562
|
-
|
1563
|
-
dd("compile done, captures %d", re_comp.captures);
|
1564
|
-
|
1565
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
1566
|
-
ovecsize = 2;
|
1567
|
-
|
1568
|
-
} else {
|
1569
|
-
ovecsize = (re_comp.captures + 1) * 3;
|
1570
|
-
}
|
1571
|
-
|
1572
|
-
cap = ngx_palloc(pool, ovecsize * sizeof(int));
|
1573
|
-
if (cap == NULL) {
|
1574
|
-
flags &= ~NGX_LUA_RE_COMPILE_ONCE;
|
1575
|
-
msg = "no memory";
|
1576
|
-
goto error;
|
1577
|
-
}
|
1578
|
-
|
1579
|
-
if (func) {
|
1580
|
-
ctpl = NULL;
|
1581
|
-
|
1582
|
-
} else {
|
1583
|
-
ctpl = ngx_palloc(pool, sizeof(ngx_http_lua_complex_value_t));
|
1584
|
-
if (ctpl == NULL) {
|
1585
|
-
flags &= ~NGX_LUA_RE_COMPILE_ONCE;
|
1586
|
-
msg = "no memory";
|
1587
|
-
goto error;
|
1588
|
-
}
|
1589
|
-
|
1590
|
-
if ((flags & NGX_LUA_RE_COMPILE_ONCE) && tpl.len != 0) {
|
1591
|
-
/* copy the string buffer pointed to by tpl.data from Lua VM */
|
1592
|
-
p = ngx_palloc(pool, tpl.len + 1);
|
1593
|
-
if (p == NULL) {
|
1594
|
-
flags &= ~NGX_LUA_RE_COMPILE_ONCE;
|
1595
|
-
msg = "no memory";
|
1596
|
-
goto error;
|
1597
|
-
}
|
1598
|
-
|
1599
|
-
ngx_memcpy(p, tpl.data, tpl.len);
|
1600
|
-
p[tpl.len] = '\0';
|
1601
|
-
|
1602
|
-
tpl.data = p;
|
1603
|
-
}
|
1604
|
-
|
1605
|
-
ngx_memzero(&ccv, sizeof(ngx_http_lua_compile_complex_value_t));
|
1606
|
-
ccv.pool = pool;
|
1607
|
-
ccv.log = r->connection->log;
|
1608
|
-
ccv.value = &tpl;
|
1609
|
-
ccv.complex_value = ctpl;
|
1610
|
-
|
1611
|
-
if (ngx_http_lua_compile_complex_value(&ccv) != NGX_OK) {
|
1612
|
-
ngx_pfree(pool, cap);
|
1613
|
-
ngx_pfree(pool, ctpl);
|
1614
|
-
|
1615
|
-
if ((flags & NGX_LUA_RE_COMPILE_ONCE) && tpl.len != 0) {
|
1616
|
-
ngx_pfree(pool, tpl.data);
|
1617
|
-
}
|
1618
|
-
|
1619
|
-
if (sd) {
|
1620
|
-
ngx_http_lua_regex_free_study_data(pool, sd);
|
1621
|
-
}
|
1622
|
-
|
1623
|
-
ngx_pfree(pool, re_comp.regex);
|
1624
|
-
|
1625
|
-
lua_pushnil(L);
|
1626
|
-
lua_pushnil(L);
|
1627
|
-
lua_pushliteral(L, "failed to compile the replacement template");
|
1628
|
-
return 3;
|
1629
|
-
}
|
1630
|
-
}
|
1631
|
-
|
1632
|
-
if (flags & NGX_LUA_RE_COMPILE_ONCE) {
|
1633
|
-
|
1634
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1635
|
-
"lua saving compiled sub regex (%d captures) into "
|
1636
|
-
"the cache (entries %i)", re_comp.captures,
|
1637
|
-
lmcf->regex_cache_entries);
|
1638
|
-
|
1639
|
-
re = ngx_palloc(pool, sizeof(ngx_http_lua_regex_t));
|
1640
|
-
if (re == NULL) {
|
1641
|
-
msg = "no memory";
|
1642
|
-
goto error;
|
1643
|
-
}
|
1644
|
-
|
1645
|
-
dd("saving regex %p, ncaptures %d, captures %p", re_comp.regex,
|
1646
|
-
re_comp.captures, cap);
|
1647
|
-
|
1648
|
-
re->regex = re_comp.regex;
|
1649
|
-
re->regex_sd = sd;
|
1650
|
-
re->ncaptures = re_comp.captures;
|
1651
|
-
re->captures = cap;
|
1652
|
-
re->replace = ctpl;
|
1653
|
-
|
1654
|
-
lua_pushlightuserdata(L, re); /* table key value */
|
1655
|
-
lua_rawset(L, -3); /* table */
|
1656
|
-
lua_pop(L, 1);
|
1657
|
-
|
1658
|
-
if (lmcf) {
|
1659
|
-
lmcf->regex_cache_entries++;
|
1660
|
-
}
|
1661
|
-
}
|
1662
|
-
|
1663
|
-
exec:
|
1664
|
-
|
1665
|
-
count = 0;
|
1666
|
-
offset = 0;
|
1667
|
-
cp_offset = 0;
|
1668
|
-
|
1669
|
-
if (pcre_fullinfo(re_comp.regex, NULL, PCRE_INFO_NAMECOUNT,
|
1670
|
-
&name_count) != 0)
|
1671
|
-
{
|
1672
|
-
msg = "cannot acquire named subpattern count";
|
1673
|
-
goto error;
|
1674
|
-
}
|
1675
|
-
|
1676
|
-
if (name_count > 0) {
|
1677
|
-
if (pcre_fullinfo(re_comp.regex, NULL, PCRE_INFO_NAMEENTRYSIZE,
|
1678
|
-
&name_entry_size) != 0)
|
1679
|
-
{
|
1680
|
-
msg = "cannot acquire named subpattern entry size";
|
1681
|
-
goto error;
|
1682
|
-
}
|
1683
|
-
|
1684
|
-
if (pcre_fullinfo(re_comp.regex, NULL, PCRE_INFO_NAMETABLE,
|
1685
|
-
&name_table) != 0)
|
1686
|
-
{
|
1687
|
-
msg = "cannot acquire named subpattern table";
|
1688
|
-
goto error;
|
1689
|
-
}
|
1690
|
-
}
|
1691
|
-
|
1692
|
-
if (flags & NGX_LUA_RE_NO_UTF8_CHECK) {
|
1693
|
-
exec_opts = PCRE_NO_UTF8_CHECK;
|
1694
|
-
|
1695
|
-
} else {
|
1696
|
-
exec_opts = 0;
|
1697
|
-
}
|
1698
|
-
|
1699
|
-
for (;;) {
|
1700
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
1701
|
-
|
1702
|
-
#if LUA_HAVE_PCRE_DFA
|
1703
|
-
|
1704
|
-
int ws[NGX_LUA_RE_DFA_MODE_WORKSPACE_COUNT];
|
1705
|
-
rc = ngx_http_lua_regex_dfa_exec(re_comp.regex, sd, &subj,
|
1706
|
-
offset, cap, ovecsize, ws,
|
1707
|
-
sizeof(ws)/sizeof(ws[0]),
|
1708
|
-
exec_opts);
|
1709
|
-
|
1710
|
-
#else /* LUA_HAVE_PCRE_DFA */
|
1711
|
-
|
1712
|
-
msg = "at least pcre 6.0 is required for the DFA mode";
|
1713
|
-
goto error;
|
1714
|
-
|
1715
|
-
#endif /* LUA_HAVE_PCRE_DFA */
|
1716
|
-
|
1717
|
-
} else {
|
1718
|
-
rc = ngx_http_lua_regex_exec(re_comp.regex, sd, &subj, offset, cap,
|
1719
|
-
ovecsize, exec_opts);
|
1720
|
-
}
|
1721
|
-
|
1722
|
-
if (rc == NGX_REGEX_NO_MATCHED) {
|
1723
|
-
break;
|
1724
|
-
}
|
1725
|
-
|
1726
|
-
if (rc < 0) {
|
1727
|
-
msg = lua_pushfstring(L, ngx_regex_exec_n " failed: %d",
|
1728
|
-
(int) rc);
|
1729
|
-
goto error;
|
1730
|
-
}
|
1731
|
-
|
1732
|
-
if (rc == 0) {
|
1733
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
1734
|
-
rc = 1;
|
1735
|
-
|
1736
|
-
} else {
|
1737
|
-
msg = "capture size too small";
|
1738
|
-
goto error;
|
1739
|
-
}
|
1740
|
-
}
|
1741
|
-
|
1742
|
-
dd("rc = %d", (int) rc);
|
1743
|
-
|
1744
|
-
count++;
|
1745
|
-
|
1746
|
-
if (count == 1) {
|
1747
|
-
luaL_buffinit(L, &luabuf);
|
1748
|
-
}
|
1749
|
-
|
1750
|
-
if (func) {
|
1751
|
-
lua_pushvalue(L, 3);
|
1752
|
-
|
1753
|
-
lua_createtable(L, rc - 1 /* narr */, 1 /* nrec */);
|
1754
|
-
|
1755
|
-
for (i = 0, n = 0; i < rc; i++, n += 2) {
|
1756
|
-
dd("capture %d: %d %d", (int) i, cap[n], cap[n + 1]);
|
1757
|
-
if (cap[n] < 0) {
|
1758
|
-
lua_pushnil(L);
|
1759
|
-
|
1760
|
-
} else {
|
1761
|
-
lua_pushlstring(L, (char *) &subj.data[cap[n]],
|
1762
|
-
cap[n + 1] - cap[n]);
|
1763
|
-
|
1764
|
-
dd("pushing capture %s at %d", lua_tostring(L, -1),
|
1765
|
-
(int) i);
|
1766
|
-
}
|
1767
|
-
|
1768
|
-
lua_rawseti(L, -2, (int) i);
|
1769
|
-
}
|
1770
|
-
|
1771
|
-
if (name_count > 0) {
|
1772
|
-
ngx_http_lua_re_collect_named_captures(L, lua_gettop(L),
|
1773
|
-
name_table,
|
1774
|
-
name_count,
|
1775
|
-
name_entry_size,
|
1776
|
-
flags, &subj);
|
1777
|
-
}
|
1778
|
-
|
1779
|
-
dd("stack size at call: %d", lua_gettop(L));
|
1780
|
-
|
1781
|
-
lua_call(L, 1 /* nargs */, 1 /* nresults */);
|
1782
|
-
type = lua_type(L, -1);
|
1783
|
-
switch (type) {
|
1784
|
-
case LUA_TNUMBER:
|
1785
|
-
case LUA_TSTRING:
|
1786
|
-
tpl.data = (u_char *) lua_tolstring(L, -1, &tpl.len);
|
1787
|
-
break;
|
1788
|
-
|
1789
|
-
default:
|
1790
|
-
msg = lua_pushfstring(L, "string or number expected to be "
|
1791
|
-
"returned by the replace "
|
1792
|
-
"function, got %s",
|
1793
|
-
lua_typename(L, type));
|
1794
|
-
return luaL_argerror(L, 3, msg);
|
1795
|
-
}
|
1796
|
-
|
1797
|
-
lua_insert(L, 1);
|
1798
|
-
|
1799
|
-
luaL_addlstring(&luabuf, (char *) &subj.data[cp_offset],
|
1800
|
-
cap[0] - cp_offset);
|
1801
|
-
|
1802
|
-
luaL_addlstring(&luabuf, (char *) tpl.data, tpl.len);
|
1803
|
-
|
1804
|
-
lua_remove(L, 1);
|
1805
|
-
|
1806
|
-
cp_offset = cap[1];
|
1807
|
-
offset = cp_offset;
|
1808
|
-
if (offset == cap[0]) {
|
1809
|
-
offset++;
|
1810
|
-
if (offset > (ssize_t) subj.len) {
|
1811
|
-
break;
|
1812
|
-
}
|
1813
|
-
}
|
1814
|
-
|
1815
|
-
if (global) {
|
1816
|
-
continue;
|
1817
|
-
}
|
1818
|
-
|
1819
|
-
break;
|
1820
|
-
}
|
1821
|
-
|
1822
|
-
rc = ngx_http_lua_complex_value(r, &subj, cp_offset, rc, cap, ctpl,
|
1823
|
-
&luabuf);
|
1824
|
-
|
1825
|
-
if (rc != NGX_OK) {
|
1826
|
-
msg = lua_pushfstring(L, "failed to eval the template for "
|
1827
|
-
"replacement: \"%s\"", tpl.data);
|
1828
|
-
goto error;
|
1829
|
-
}
|
1830
|
-
|
1831
|
-
cp_offset = cap[1];
|
1832
|
-
offset = cp_offset;
|
1833
|
-
if (offset == cap[0]) {
|
1834
|
-
offset++;
|
1835
|
-
if (offset > (ssize_t) subj.len) {
|
1836
|
-
break;
|
1837
|
-
}
|
1838
|
-
}
|
1839
|
-
|
1840
|
-
if (global) {
|
1841
|
-
continue;
|
1842
|
-
}
|
1843
|
-
|
1844
|
-
break;
|
1845
|
-
}
|
1846
|
-
|
1847
|
-
if (count == 0) {
|
1848
|
-
dd("no match, just the original subject");
|
1849
|
-
lua_settop(L, 1);
|
1850
|
-
|
1851
|
-
} else {
|
1852
|
-
if (offset < (int) subj.len) {
|
1853
|
-
dd("adding trailer: %s (len %d)", &subj.data[cp_offset],
|
1854
|
-
(int) (subj.len - cp_offset));
|
1855
|
-
|
1856
|
-
|
1857
|
-
luaL_addlstring(&luabuf, (char *) &subj.data[cp_offset],
|
1858
|
-
subj.len - cp_offset);
|
1859
|
-
}
|
1860
|
-
|
1861
|
-
luaL_pushresult(&luabuf);
|
1862
|
-
|
1863
|
-
dd("the dst string: %s", lua_tostring(L, -1));
|
1864
|
-
}
|
1865
|
-
|
1866
|
-
if (!(flags & NGX_LUA_RE_COMPILE_ONCE)) {
|
1867
|
-
if (sd) {
|
1868
|
-
ngx_http_lua_regex_free_study_data(pool, sd);
|
1869
|
-
}
|
1870
|
-
|
1871
|
-
if (re_comp.regex) {
|
1872
|
-
ngx_pfree(pool, re_comp.regex);
|
1873
|
-
}
|
1874
|
-
|
1875
|
-
if (ctpl) {
|
1876
|
-
ngx_pfree(pool, ctpl);
|
1877
|
-
}
|
1878
|
-
|
1879
|
-
if (cap) {
|
1880
|
-
ngx_pfree(pool, cap);
|
1881
|
-
}
|
1882
|
-
}
|
1883
|
-
|
1884
|
-
lua_pushinteger(L, count);
|
1885
|
-
return 2;
|
1886
|
-
|
1887
|
-
error:
|
1888
|
-
|
1889
|
-
if (!(flags & NGX_LUA_RE_COMPILE_ONCE)) {
|
1890
|
-
if (sd) {
|
1891
|
-
ngx_http_lua_regex_free_study_data(pool, sd);
|
1892
|
-
}
|
1893
|
-
|
1894
|
-
if (re_comp.regex) {
|
1895
|
-
ngx_pfree(pool, re_comp.regex);
|
1896
|
-
}
|
1897
|
-
|
1898
|
-
if (ctpl) {
|
1899
|
-
ngx_pfree(pool, ctpl);
|
1900
|
-
}
|
1901
|
-
|
1902
|
-
if (cap) {
|
1903
|
-
ngx_pfree(pool, cap);
|
1904
|
-
}
|
1905
|
-
}
|
1906
|
-
|
1907
|
-
lua_pushnil(L);
|
1908
|
-
lua_pushnil(L);
|
1909
|
-
lua_pushstring(L, msg);
|
1910
|
-
return 3;
|
1911
|
-
}
|
1912
|
-
|
1913
|
-
|
1914
|
-
void
|
1915
|
-
ngx_http_lua_inject_regex_api(lua_State *L)
|
1916
|
-
{
|
1917
|
-
/* ngx.re */
|
1918
|
-
|
1919
|
-
lua_createtable(L, 0, 5 /* nrec */); /* .re */
|
1920
|
-
|
1921
|
-
lua_pushcfunction(L, ngx_http_lua_ngx_re_find);
|
1922
|
-
lua_setfield(L, -2, "find");
|
1923
|
-
|
1924
|
-
lua_pushcfunction(L, ngx_http_lua_ngx_re_match);
|
1925
|
-
lua_setfield(L, -2, "match");
|
1926
|
-
|
1927
|
-
lua_pushcfunction(L, ngx_http_lua_ngx_re_gmatch);
|
1928
|
-
lua_setfield(L, -2, "gmatch");
|
1929
|
-
|
1930
|
-
lua_pushcfunction(L, ngx_http_lua_ngx_re_sub);
|
1931
|
-
lua_setfield(L, -2, "sub");
|
1932
|
-
|
1933
|
-
lua_pushcfunction(L, ngx_http_lua_ngx_re_gsub);
|
1934
|
-
lua_setfield(L, -2, "gsub");
|
1935
|
-
|
1936
|
-
lua_setfield(L, -2, "re");
|
1937
|
-
}
|
1938
|
-
|
1939
|
-
|
1940
|
-
static void
|
1941
|
-
ngx_http_lua_regex_free_study_data(ngx_pool_t *pool, pcre_extra *sd)
|
1942
|
-
{
|
1943
|
-
ngx_pool_t *old_pool;
|
1944
|
-
|
1945
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
1946
|
-
|
1947
|
-
#if LUA_HAVE_PCRE_JIT
|
1948
|
-
pcre_free_study(sd);
|
1949
|
-
#else
|
1950
|
-
pcre_free(sd);
|
1951
|
-
#endif
|
1952
|
-
|
1953
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
1954
|
-
}
|
1955
|
-
|
1956
|
-
|
1957
|
-
static ngx_int_t
|
1958
|
-
ngx_http_lua_regex_compile(ngx_http_lua_regex_compile_t *rc)
|
1959
|
-
{
|
1960
|
-
int n, erroff;
|
1961
|
-
char *p;
|
1962
|
-
const char *errstr;
|
1963
|
-
pcre *re;
|
1964
|
-
ngx_pool_t *old_pool;
|
1965
|
-
|
1966
|
-
old_pool = ngx_http_lua_pcre_malloc_init(rc->pool);
|
1967
|
-
|
1968
|
-
re = pcre_compile((const char *) rc->pattern.data, (int) rc->options,
|
1969
|
-
&errstr, &erroff, NULL);
|
1970
|
-
|
1971
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
1972
|
-
|
1973
|
-
if (re == NULL) {
|
1974
|
-
if ((size_t) erroff == rc->pattern.len) {
|
1975
|
-
rc->err.len = ngx_snprintf(rc->err.data, rc->err.len,
|
1976
|
-
"pcre_compile() failed: %s in \"%V\"",
|
1977
|
-
errstr, &rc->pattern)
|
1978
|
-
- rc->err.data;
|
1979
|
-
|
1980
|
-
} else {
|
1981
|
-
rc->err.len = ngx_snprintf(rc->err.data, rc->err.len,
|
1982
|
-
"pcre_compile() failed: %s in \"%V\" "
|
1983
|
-
"at \"%s\"", errstr, &rc->pattern,
|
1984
|
-
rc->pattern.data + erroff)
|
1985
|
-
- rc->err.data;
|
1986
|
-
}
|
1987
|
-
|
1988
|
-
return NGX_ERROR;
|
1989
|
-
}
|
1990
|
-
|
1991
|
-
rc->regex = re;
|
1992
|
-
|
1993
|
-
#if 1
|
1994
|
-
n = pcre_fullinfo(re, NULL, PCRE_INFO_CAPTURECOUNT, &rc->captures);
|
1995
|
-
if (n < 0) {
|
1996
|
-
p = "pcre_fullinfo(\"%V\", PCRE_INFO_CAPTURECOUNT) failed: %d";
|
1997
|
-
goto failed;
|
1998
|
-
}
|
1999
|
-
#endif
|
2000
|
-
|
2001
|
-
return NGX_OK;
|
2002
|
-
|
2003
|
-
failed:
|
2004
|
-
|
2005
|
-
rc->err.len = ngx_snprintf(rc->err.data, rc->err.len, p, &rc->pattern, n)
|
2006
|
-
- rc->err.data;
|
2007
|
-
return NGX_OK;
|
2008
|
-
}
|
2009
|
-
|
2010
|
-
|
2011
|
-
static void
|
2012
|
-
ngx_http_lua_ngx_re_gmatch_cleanup(void *data)
|
2013
|
-
{
|
2014
|
-
ngx_http_lua_regex_ctx_t *ctx = data;
|
2015
|
-
|
2016
|
-
if (ctx) {
|
2017
|
-
if (ctx->regex_sd) {
|
2018
|
-
ngx_http_lua_regex_free_study_data(ctx->request->pool,
|
2019
|
-
ctx->regex_sd);
|
2020
|
-
ctx->regex_sd = NULL;
|
2021
|
-
}
|
2022
|
-
|
2023
|
-
if (ctx->cleanup) {
|
2024
|
-
*ctx->cleanup = NULL;
|
2025
|
-
ctx->cleanup = NULL;
|
2026
|
-
}
|
2027
|
-
|
2028
|
-
ctx->request = NULL;
|
2029
|
-
}
|
2030
|
-
|
2031
|
-
return;
|
2032
|
-
}
|
2033
|
-
|
2034
|
-
|
2035
|
-
static int
|
2036
|
-
ngx_http_lua_ngx_re_gmatch_gc(lua_State *L)
|
2037
|
-
{
|
2038
|
-
ngx_http_lua_regex_ctx_t *ctx;
|
2039
|
-
|
2040
|
-
ctx = lua_touserdata(L, 1);
|
2041
|
-
|
2042
|
-
if (ctx && ctx->cleanup) {
|
2043
|
-
ngx_http_lua_ngx_re_gmatch_cleanup(ctx);
|
2044
|
-
}
|
2045
|
-
|
2046
|
-
return 0;
|
2047
|
-
}
|
2048
|
-
|
2049
|
-
|
2050
|
-
static void
|
2051
|
-
ngx_http_lua_re_collect_named_captures(lua_State *L, int res_tb_idx,
|
2052
|
-
u_char *name_table, int name_count, int name_entry_size, unsigned flags,
|
2053
|
-
ngx_str_t *subj)
|
2054
|
-
{
|
2055
|
-
int i, n;
|
2056
|
-
size_t len;
|
2057
|
-
u_char *name_entry;
|
2058
|
-
char *name;
|
2059
|
-
|
2060
|
-
for (i = 0; i < name_count; i++) {
|
2061
|
-
dd("top: %d", lua_gettop(L));
|
2062
|
-
|
2063
|
-
name_entry = &name_table[i * name_entry_size];
|
2064
|
-
n = (name_entry[0] << 8) | name_entry[1];
|
2065
|
-
name = (char *) &name_entry[2];
|
2066
|
-
|
2067
|
-
lua_rawgeti(L, -1, n);
|
2068
|
-
if (lua_isnil(L, -1)) {
|
2069
|
-
lua_pop(L, 1);
|
2070
|
-
continue;
|
2071
|
-
}
|
2072
|
-
|
2073
|
-
if (flags & NGX_LUA_RE_MODE_DUPNAMES) {
|
2074
|
-
|
2075
|
-
lua_getfield(L, -2, name); /* big_tb cap small_tb */
|
2076
|
-
|
2077
|
-
if (lua_isnil(L, -1)) {
|
2078
|
-
lua_pop(L, 1);
|
2079
|
-
|
2080
|
-
/* assuming named submatches are usually unique */
|
2081
|
-
lua_createtable(L, 1 /* narr */, 0 /* nrec */);
|
2082
|
-
lua_pushstring(L, name);
|
2083
|
-
lua_pushvalue(L, -2); /* big_tb cap small_tb key small_tb */
|
2084
|
-
lua_rawset(L, res_tb_idx); /* big_tb cap small_tb */
|
2085
|
-
len = 0;
|
2086
|
-
|
2087
|
-
} else {
|
2088
|
-
len = lua_objlen(L, -1);
|
2089
|
-
}
|
2090
|
-
|
2091
|
-
lua_pushvalue(L, -2); /* big_tb cap small_tb cap */
|
2092
|
-
lua_rawseti(L, -2, (int) len + 1); /* big_tb cap small_tb */
|
2093
|
-
lua_pop(L, 2);
|
2094
|
-
|
2095
|
-
} else {
|
2096
|
-
lua_pushstring(L, name); /* big_tb cap key */
|
2097
|
-
lua_pushvalue(L, -2); /* big_tb cap key cap */
|
2098
|
-
lua_rawset(L, res_tb_idx); /* big_tb cap */
|
2099
|
-
lua_pop(L, 1);
|
2100
|
-
}
|
2101
|
-
|
2102
|
-
dd("top 2: %d", lua_gettop(L));
|
2103
|
-
}
|
2104
|
-
}
|
2105
|
-
|
2106
|
-
|
2107
|
-
#ifndef NGX_LUA_NO_FFI_API
|
2108
|
-
ngx_http_lua_regex_t *
|
2109
|
-
ngx_http_lua_ffi_compile_regex(const unsigned char *pat, size_t pat_len,
|
2110
|
-
int flags, int pcre_opts, u_char *errstr,
|
2111
|
-
size_t errstr_size)
|
2112
|
-
{
|
2113
|
-
int *cap = NULL, ovecsize;
|
2114
|
-
u_char *p;
|
2115
|
-
ngx_int_t rc;
|
2116
|
-
const char *msg;
|
2117
|
-
ngx_pool_t *pool, *old_pool;
|
2118
|
-
pcre_extra *sd = NULL;
|
2119
|
-
ngx_http_lua_regex_t *re;
|
2120
|
-
|
2121
|
-
ngx_http_lua_main_conf_t *lmcf;
|
2122
|
-
ngx_http_lua_regex_compile_t re_comp;
|
2123
|
-
|
2124
|
-
pool = ngx_create_pool(512, ngx_cycle->log);
|
2125
|
-
if (pool == NULL) {
|
2126
|
-
msg = "no memory";
|
2127
|
-
goto error;
|
2128
|
-
}
|
2129
|
-
|
2130
|
-
re = ngx_palloc(pool, sizeof(ngx_http_lua_regex_t));
|
2131
|
-
if (re == NULL) {
|
2132
|
-
ngx_destroy_pool(pool);
|
2133
|
-
pool = NULL;
|
2134
|
-
msg = "no memory";
|
2135
|
-
goto error;
|
2136
|
-
}
|
2137
|
-
|
2138
|
-
re->pool = pool;
|
2139
|
-
|
2140
|
-
re_comp.options = pcre_opts;
|
2141
|
-
re_comp.pattern.data = (u_char *) pat;
|
2142
|
-
re_comp.pattern.len = pat_len;
|
2143
|
-
re_comp.err.len = errstr_size - 1;
|
2144
|
-
re_comp.err.data = errstr;
|
2145
|
-
re_comp.pool = pool;
|
2146
|
-
|
2147
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
2148
|
-
rc = ngx_http_lua_regex_compile(&re_comp);
|
2149
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
2150
|
-
|
2151
|
-
if (rc != NGX_OK) {
|
2152
|
-
re_comp.err.data[re_comp.err.len] = '\0';
|
2153
|
-
msg = (char *) re_comp.err.data;
|
2154
|
-
goto error;
|
2155
|
-
}
|
2156
|
-
|
2157
|
-
#if (LUA_HAVE_PCRE_JIT)
|
2158
|
-
|
2159
|
-
if (flags & NGX_LUA_RE_MODE_JIT) {
|
2160
|
-
|
2161
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
2162
|
-
sd = pcre_study(re_comp.regex, PCRE_STUDY_JIT_COMPILE, &msg);
|
2163
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
2164
|
-
|
2165
|
-
# if (NGX_DEBUG)
|
2166
|
-
if (msg != NULL) {
|
2167
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
|
2168
|
-
"pcre study failed with PCRE_STUDY_JIT_COMPILE: "
|
2169
|
-
"%s (%p)", msg, sd);
|
2170
|
-
}
|
2171
|
-
|
2172
|
-
if (sd != NULL) {
|
2173
|
-
int jitted;
|
2174
|
-
|
2175
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
2176
|
-
|
2177
|
-
pcre_fullinfo(re_comp.regex, sd, PCRE_INFO_JIT, &jitted);
|
2178
|
-
|
2179
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
2180
|
-
|
2181
|
-
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
|
2182
|
-
"pcre JIT compiling result: %d", jitted);
|
2183
|
-
}
|
2184
|
-
# endif /* !(NGX_DEBUG) */
|
2185
|
-
|
2186
|
-
} else {
|
2187
|
-
old_pool = ngx_http_lua_pcre_malloc_init(pool);
|
2188
|
-
sd = pcre_study(re_comp.regex, 0, &msg);
|
2189
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
2190
|
-
}
|
2191
|
-
|
2192
|
-
#endif /* LUA_HAVE_PCRE_JIT */
|
2193
|
-
|
2194
|
-
lmcf = ngx_http_cycle_get_module_main_conf(ngx_cycle,
|
2195
|
-
ngx_http_lua_module);
|
2196
|
-
|
2197
|
-
if (sd && lmcf && lmcf->regex_match_limit > 0) {
|
2198
|
-
sd->flags |= PCRE_EXTRA_MATCH_LIMIT;
|
2199
|
-
sd->match_limit = lmcf->regex_match_limit;
|
2200
|
-
}
|
2201
|
-
|
2202
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
2203
|
-
ovecsize = 2;
|
2204
|
-
|
2205
|
-
} else {
|
2206
|
-
ovecsize = (re_comp.captures + 1) * 3;
|
2207
|
-
}
|
2208
|
-
|
2209
|
-
dd("allocating cap with size: %d", (int) ovecsize);
|
2210
|
-
|
2211
|
-
cap = ngx_palloc(pool, ovecsize * sizeof(int));
|
2212
|
-
if (cap == NULL) {
|
2213
|
-
msg = "no memory";
|
2214
|
-
goto error;
|
2215
|
-
}
|
2216
|
-
|
2217
|
-
if (pcre_fullinfo(re_comp.regex, NULL, PCRE_INFO_NAMECOUNT,
|
2218
|
-
&re->name_count) != 0)
|
2219
|
-
{
|
2220
|
-
msg = "cannot acquire named subpattern count";
|
2221
|
-
goto error;
|
2222
|
-
}
|
2223
|
-
|
2224
|
-
if (re->name_count > 0) {
|
2225
|
-
if (pcre_fullinfo(re_comp.regex, NULL, PCRE_INFO_NAMEENTRYSIZE,
|
2226
|
-
&re->name_entry_size) != 0)
|
2227
|
-
{
|
2228
|
-
msg = "cannot acquire named subpattern entry size";
|
2229
|
-
goto error;
|
2230
|
-
}
|
2231
|
-
|
2232
|
-
if (pcre_fullinfo(re_comp.regex, NULL, PCRE_INFO_NAMETABLE,
|
2233
|
-
&re->name_table) != 0)
|
2234
|
-
{
|
2235
|
-
msg = "cannot acquire named subpattern table";
|
2236
|
-
goto error;
|
2237
|
-
}
|
2238
|
-
}
|
2239
|
-
|
2240
|
-
re->regex = re_comp.regex;
|
2241
|
-
re->regex_sd = sd;
|
2242
|
-
re->ncaptures = re_comp.captures;
|
2243
|
-
re->captures = cap;
|
2244
|
-
re->replace = NULL;
|
2245
|
-
|
2246
|
-
/* only for (stap) debugging, the pointer might be invalid when the
|
2247
|
-
* string is collected later on.... */
|
2248
|
-
re->pattern = pat;
|
2249
|
-
|
2250
|
-
return re;
|
2251
|
-
|
2252
|
-
error:
|
2253
|
-
|
2254
|
-
p = ngx_snprintf(errstr, errstr_size - 1, "%s", msg);
|
2255
|
-
*p = '\0';
|
2256
|
-
|
2257
|
-
if (sd) {
|
2258
|
-
ngx_http_lua_regex_free_study_data(pool, sd);
|
2259
|
-
}
|
2260
|
-
|
2261
|
-
if (pool) {
|
2262
|
-
ngx_destroy_pool(pool);
|
2263
|
-
}
|
2264
|
-
|
2265
|
-
return NULL;
|
2266
|
-
}
|
2267
|
-
|
2268
|
-
|
2269
|
-
int
|
2270
|
-
ngx_http_lua_ffi_exec_regex(ngx_http_lua_regex_t *re, int flags,
|
2271
|
-
const u_char *s, size_t len, int pos)
|
2272
|
-
{
|
2273
|
-
int rc, ovecsize, exec_opts, *cap;
|
2274
|
-
ngx_str_t subj;
|
2275
|
-
pcre_extra *sd;
|
2276
|
-
|
2277
|
-
cap = re->captures;
|
2278
|
-
sd = re->regex_sd;
|
2279
|
-
|
2280
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
2281
|
-
ovecsize = 2;
|
2282
|
-
|
2283
|
-
} else {
|
2284
|
-
ovecsize = (re->ncaptures + 1) * 3;
|
2285
|
-
}
|
2286
|
-
|
2287
|
-
if (flags & NGX_LUA_RE_NO_UTF8_CHECK) {
|
2288
|
-
exec_opts = PCRE_NO_UTF8_CHECK;
|
2289
|
-
|
2290
|
-
} else {
|
2291
|
-
exec_opts = 0;
|
2292
|
-
}
|
2293
|
-
|
2294
|
-
subj.data = (u_char *) s;
|
2295
|
-
subj.len = len;
|
2296
|
-
|
2297
|
-
if (flags & NGX_LUA_RE_MODE_DFA) {
|
2298
|
-
|
2299
|
-
#if LUA_HAVE_PCRE_DFA
|
2300
|
-
|
2301
|
-
int ws[NGX_LUA_RE_DFA_MODE_WORKSPACE_COUNT];
|
2302
|
-
rc = ngx_http_lua_regex_dfa_exec(re->regex, sd, &subj,
|
2303
|
-
(int) pos, cap, ovecsize, ws,
|
2304
|
-
sizeof(ws)/sizeof(ws[0]), exec_opts);
|
2305
|
-
|
2306
|
-
#else /* LUA_HAVE_PCRE_DFA */
|
2307
|
-
|
2308
|
-
return PCRE_ERROR_INTERNAL;
|
2309
|
-
|
2310
|
-
#endif /* LUA_HAVE_PCRE_DFA */
|
2311
|
-
|
2312
|
-
} else {
|
2313
|
-
rc = ngx_http_lua_regex_exec(re->regex, sd, &subj, (int) pos, cap,
|
2314
|
-
ovecsize, exec_opts);
|
2315
|
-
}
|
2316
|
-
|
2317
|
-
return rc;
|
2318
|
-
}
|
2319
|
-
|
2320
|
-
|
2321
|
-
void
|
2322
|
-
ngx_http_lua_ffi_destroy_regex(ngx_http_lua_regex_t *re)
|
2323
|
-
{
|
2324
|
-
ngx_pool_t *old_pool;
|
2325
|
-
|
2326
|
-
dd("destroy regex called");
|
2327
|
-
|
2328
|
-
if (re == NULL || re->pool == NULL) {
|
2329
|
-
return;
|
2330
|
-
}
|
2331
|
-
|
2332
|
-
if (re->regex_sd) {
|
2333
|
-
old_pool = ngx_http_lua_pcre_malloc_init(re->pool);
|
2334
|
-
#if LUA_HAVE_PCRE_JIT
|
2335
|
-
pcre_free_study(re->regex_sd);
|
2336
|
-
#else
|
2337
|
-
pcre_free(re->regex_sd);
|
2338
|
-
#endif
|
2339
|
-
ngx_http_lua_pcre_malloc_done(old_pool);
|
2340
|
-
re->regex_sd = NULL;
|
2341
|
-
}
|
2342
|
-
|
2343
|
-
ngx_destroy_pool(re->pool);
|
2344
|
-
}
|
2345
|
-
|
2346
|
-
|
2347
|
-
int
|
2348
|
-
ngx_http_lua_ffi_compile_replace_template(ngx_http_lua_regex_t *re,
|
2349
|
-
const u_char *replace_data, size_t replace_len)
|
2350
|
-
{
|
2351
|
-
ngx_int_t rc;
|
2352
|
-
ngx_str_t tpl;
|
2353
|
-
ngx_http_lua_complex_value_t *ctpl;
|
2354
|
-
ngx_http_lua_compile_complex_value_t ccv;
|
2355
|
-
|
2356
|
-
ctpl = ngx_palloc(re->pool, sizeof(ngx_http_lua_complex_value_t));
|
2357
|
-
if (ctpl == NULL) {
|
2358
|
-
return NGX_ERROR;
|
2359
|
-
}
|
2360
|
-
|
2361
|
-
if (replace_len != 0) {
|
2362
|
-
/* copy the string buffer pointed to by tpl.data from Lua VM */
|
2363
|
-
tpl.data = ngx_palloc(re->pool, replace_len + 1);
|
2364
|
-
if (tpl.data == NULL) {
|
2365
|
-
return NGX_ERROR;
|
2366
|
-
}
|
2367
|
-
|
2368
|
-
ngx_memcpy(tpl.data, replace_data, replace_len);
|
2369
|
-
tpl.data[replace_len] = '\0';
|
2370
|
-
|
2371
|
-
} else {
|
2372
|
-
tpl.data = (u_char *) replace_data;
|
2373
|
-
}
|
2374
|
-
|
2375
|
-
tpl.len = replace_len;
|
2376
|
-
|
2377
|
-
ngx_memzero(&ccv, sizeof(ngx_http_lua_compile_complex_value_t));
|
2378
|
-
ccv.pool = re->pool;
|
2379
|
-
ccv.log = ngx_cycle->log;
|
2380
|
-
ccv.value = &tpl;
|
2381
|
-
ccv.complex_value = ctpl;
|
2382
|
-
|
2383
|
-
rc = ngx_http_lua_compile_complex_value(&ccv);
|
2384
|
-
|
2385
|
-
re->replace = ctpl;
|
2386
|
-
|
2387
|
-
return rc;
|
2388
|
-
}
|
2389
|
-
|
2390
|
-
|
2391
|
-
ngx_http_lua_script_engine_t *
|
2392
|
-
ngx_http_lua_ffi_create_script_engine(void)
|
2393
|
-
{
|
2394
|
-
return ngx_calloc(sizeof(ngx_http_lua_script_engine_t), ngx_cycle->log);
|
2395
|
-
}
|
2396
|
-
|
2397
|
-
|
2398
|
-
void
|
2399
|
-
ngx_http_lua_ffi_init_script_engine(ngx_http_lua_script_engine_t *e,
|
2400
|
-
const unsigned char *subj, ngx_http_lua_regex_t *compiled, int count)
|
2401
|
-
{
|
2402
|
-
e->log = ngx_cycle->log;
|
2403
|
-
e->ncaptures = count * 2;
|
2404
|
-
e->captures = compiled->captures;
|
2405
|
-
e->captures_data = (u_char *) subj;
|
2406
|
-
}
|
2407
|
-
|
2408
|
-
|
2409
|
-
void
|
2410
|
-
ngx_http_lua_ffi_destroy_script_engine(ngx_http_lua_script_engine_t *e)
|
2411
|
-
{
|
2412
|
-
ngx_free(e);
|
2413
|
-
}
|
2414
|
-
|
2415
|
-
|
2416
|
-
size_t
|
2417
|
-
ngx_http_lua_ffi_script_eval_len(ngx_http_lua_script_engine_t *e,
|
2418
|
-
ngx_http_lua_complex_value_t *val)
|
2419
|
-
{
|
2420
|
-
size_t len;
|
2421
|
-
|
2422
|
-
ngx_http_lua_script_len_code_pt lcode;
|
2423
|
-
|
2424
|
-
e->ip = val->lengths;
|
2425
|
-
len = 0;
|
2426
|
-
|
2427
|
-
while (*(uintptr_t *) e->ip) {
|
2428
|
-
lcode = *(ngx_http_lua_script_len_code_pt *) e->ip;
|
2429
|
-
len += lcode(e);
|
2430
|
-
}
|
2431
|
-
|
2432
|
-
return len;
|
2433
|
-
}
|
2434
|
-
|
2435
|
-
|
2436
|
-
void
|
2437
|
-
ngx_http_lua_ffi_script_eval_data(ngx_http_lua_script_engine_t *e,
|
2438
|
-
ngx_http_lua_complex_value_t *val, u_char *dst)
|
2439
|
-
{
|
2440
|
-
ngx_http_lua_script_code_pt code;
|
2441
|
-
|
2442
|
-
e->ip = val->values;
|
2443
|
-
e->pos = dst;
|
2444
|
-
|
2445
|
-
while (*(uintptr_t *) e->ip) {
|
2446
|
-
code = *(ngx_http_lua_script_code_pt *) e->ip;
|
2447
|
-
code(e);
|
2448
|
-
}
|
2449
|
-
}
|
2450
|
-
|
2451
|
-
|
2452
|
-
uint32_t
|
2453
|
-
ngx_http_lua_ffi_max_regex_cache_size(void)
|
2454
|
-
{
|
2455
|
-
ngx_http_lua_main_conf_t *lmcf;
|
2456
|
-
lmcf = ngx_http_cycle_get_module_main_conf(ngx_cycle,
|
2457
|
-
ngx_http_lua_module);
|
2458
|
-
if (lmcf == NULL) {
|
2459
|
-
return 0;
|
2460
|
-
}
|
2461
|
-
return (uint32_t) lmcf->regex_cache_max_entries;
|
2462
|
-
}
|
2463
|
-
#endif /* NGX_LUA_NO_FFI_API */
|
2464
|
-
|
2465
|
-
|
2466
|
-
#endif /* NGX_PCRE */
|
2467
|
-
|
2468
|
-
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */
|