zhuomingliang / form-input-nginx-module Goto Github PK
View Code? Open in Web Editor NEWThis project forked from calio/form-input-nginx-module
This project forked from calio/form-input-nginx-module
Name form-input-nginx-module Description This is a nginx module that reads HTTP POST and PUT request body encoded in "application/x-www-form-urlencoded", and parse the arguments in request body into nginx variables. This module depends on the ngx_devel_kit (NDK) module. Installation Get the nginx source code from nginx.net ( http://nginx.net/ ). Get the ngx_devel_kit source code from (http://github.com/simpl/ngx_devel_kit) Unpack the source code and build nginx with this module. $ wget 'http://sysoev.ru/nginx/nginx-0.8.54.tar.gz' $ tar -xzvf nginx-0.8.54.tar.gz $ cd nginx-0.8.54/ $ git-clone http://github.com/simpl/ngx_devel_kit.git $ git-clone http://github.com/calio/form-input-nginx-module.git $ ./configure --add-module=/somepath/form-input-nginx-module --add-module=/somepath/ngx_devel_kit $ make -j2 $ make install Usage set_form_input $variable; set_form_input $variable argument; set_form_input_multi $variable; set_form_input_multi $variable argument; example: #nginx.conf location /foo { # ensure client_max_body_size == client_body_buffer_size client_max_body_size 100k; client_body_buffer_size 100k; set_form_input $data; # read "data" field into $data set_form_input $foo foo; # read "foo" field into $foo } location /bar { # ensure client_max_body_size == client_body_buffer_size client_max_body_size 1m; client_body_buffer_size 1m; set_form_input_multi $data; # read all "data" field into $data set_form_input_multi $foo data; # read all "data" field into $foo array_join ' ' $data; # now $data is an string array_join ' ' $foo; # now $foo is an string } Limitations * ngx_form_input will discard request bodies that are buffered to disk files. When the client_max_body_size setting is larger than client_body_buffer_size, request bodies that are larger than client_body_buffer_size (but no larger than client_max_body_size) will be buffered to disk files. So it's important to ensure these two config settings take the same values to avoid confustion. Compatibility The following versions of Nginx should work with this module: * 1.0.x (last tested: 1.0.5) * 0.9.x (last tested: 0.9.4) * 0.8.0 ~ 0.8.41, 0.8.54+ (0.8.42 ~ 0.8.53 requires a patch, see below, last tested: 0.8.54) * 0.7.x (last tested: 0.7.68) Note that nginx 0.8.42 ~ 0.8.53 won't work due to a famous regression appeared since 0.8.42: <http://forum.nginx.org/read.php?29,103078,103078 >, but a small patch can fix this issue for nginx 0.8.53: http://agentzh.org/misc/nginx/nginx-0.8.53-rewrite_phase_fix.patch This patch may also be applied cleanly for other versions of nginx 0.8.42 ~ 0.8.53 :) Copyright & License Copyright (c) 2010, 2011, Taobao Inc., Alibaba Group ( http://www.taobao.com ). Copyright (c) 2010, 2011, Jiale "calio" Zhi <[email protected]>. Copyright (c) 2010, 2011, Yichun "agentzh" Zhang <[email protected]>. This module is licensed under the terms of the BSD license. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Changelog Changes with form-input-module v0.0.2 *) support set_fomr_input_multi *) support PUT method Changes with form-input-module v0.0.1 *) support set_form_input
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.