nginx-0.4.0-RELEASE import
*) Change in internal API: the HTTP modules initialization was moved from the init module phase to the HTTP postconfiguration phase. *) Change: now the request body is not read beforehand for the ngx_http_perl_module: it's required to start the reading using the $r->has_request_body method. *) Feature: the ngx_http_perl_module supports the DECLINED return code. *) Feature: the ngx_http_dav_module supports the incoming "Date" header line for the PUT method. *) Feature: the "ssi" directive is available inside the "if" block. *) Bugfix: a segmentation fault occurred if there was an "index" directive with variables and the first index name was without variables; the bug had appeared in 0.1.29.
This commit is contained in:
parent
cde56ed39b
commit
a5719ead3e
51 changed files with 1081 additions and 458 deletions
|
@ -182,5 +182,3 @@ CFLAGS="$CFLAGS -g"
|
|||
if [ ".$CPP" = "." ]; then
|
||||
CPP="$CC -E"
|
||||
fi
|
||||
|
||||
NGX_PERL_CFLAGS="$CFLAGS"
|
||||
|
|
|
@ -91,6 +91,8 @@ CFLAGS="$CFLAGS -wd269"
|
|||
CFLAGS="$CFLAGS -wd810"
|
||||
# parameter was never referenced
|
||||
CFLAGS="$CFLAGS -wd869"
|
||||
# attribute "unused" is only allowed in a function definition, warning on pTHX_
|
||||
CFLAGS="$CFLAGS -wd1301"
|
||||
|
||||
# STUB
|
||||
# enumerated type mixed with another type
|
||||
|
|
|
@ -19,9 +19,16 @@ if test -n "$NGX_PERL_VER"; then
|
|||
exit 1;
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS `$NGX_PERL -MExtUtils::Embed -e ccopts`"
|
||||
# gcc 4.1/4.2
|
||||
CFLAGS=`echo $CFLAGS | sed -e 's/-Wunused-value/-Wno-unused-value/'`
|
||||
NGX_PERL_CFLAGS="$CFLAGS `$NGX_PERL -MExtUtils::Embed -e ccopts`"
|
||||
NGX_PM_CFLAGS=`$NGX_PERL -MExtUtils::Embed -e ccopts`
|
||||
|
||||
# gcc 4.1/4.2 warn about unused values in pTHX_
|
||||
NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \
|
||||
| sed -e 's/-Wunused-value/-Wno-unused-value/'`
|
||||
# icc8 warns 'declaration hides parameter "my_perl"' in ENTER and LEAVE
|
||||
NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \
|
||||
| sed -e 's/-wd171/-wd171 -wd1599/'`
|
||||
|
||||
ngx_perl_ldopts=`$NGX_PERL -MExtUtils::Embed -e ldopts`
|
||||
|
||||
if $NGX_PERL -V:usemultiplicity | grep define > /dev/null; then
|
||||
|
|
|
@ -24,9 +24,8 @@ $NGX_OBJS/src/http/modules/perl/Makefile: \
|
|||
cp -p src/http/modules/perl/Makefile.PL $NGX_OBJS/src/http/modules/perl/
|
||||
|
||||
cd $NGX_OBJS/src/http/modules/perl \
|
||||
&& NGX_PERL_CFLAGS="$NGX_PERL_CFLAGS $NGX_CC_OPT" \
|
||||
&& NGX_PM_CFLAGS="\$(NGX_PM_CFLAGS) -g $NGX_CC_OPT" \
|
||||
NGX_PCRE=$PCRE \
|
||||
NGX_ZLIB=$ZLIB \
|
||||
NGX_OBJS=$NGX_OBJS \
|
||||
$NGX_PERL Makefile.PL \
|
||||
LIB=$NGX_PERL_MODULES
|
||||
|
|
25
auto/make
25
auto/make
|
@ -22,6 +22,11 @@ LINK = $LINK
|
|||
|
||||
END
|
||||
|
||||
if test -n "$NGX_PERL_CFLAGS"; then
|
||||
echo NGX_PERL_CFLAGS = $NGX_PERL_CFLAGS >> $NGX_MAKEFILE
|
||||
echo NGX_PM_CFLAGS = $NGX_PM_CFLAGS >> $NGX_MAKEFILE
|
||||
fi
|
||||
|
||||
if [ "$BMAKE" = wmake ]; then
|
||||
echo MAKE = wmake >> $NGX_MAKEFILE
|
||||
|
||||
|
@ -238,23 +243,37 @@ if [ $HTTP = YES ]; then
|
|||
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
|
||||
else
|
||||
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(HTTP_INCS)"
|
||||
ngx_perl_cc="\$(CC) $ngx_compile_opt \$(NGX_PERL_CFLAGS) "
|
||||
ngx_perl_cc="$ngx_perl_cc \$(CORE_INCS) \$(HTTP_INCS)"
|
||||
fi
|
||||
|
||||
for ngx_src in $HTTP_SRCS
|
||||
for ngx_source in $HTTP_SRCS
|
||||
do
|
||||
ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
|
||||
ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
|
||||
ngx_obj=`echo $ngx_src \
|
||||
| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
||||
-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
||||
-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
||||
-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
|
||||
|
||||
cat << END >> $NGX_MAKEFILE
|
||||
if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; then
|
||||
|
||||
cat << END >> $NGX_MAKEFILE
|
||||
|
||||
$ngx_obj: \$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src
|
||||
$ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
|
||||
|
||||
END
|
||||
else
|
||||
|
||||
cat << END >> $NGX_MAKEFILE
|
||||
|
||||
$ngx_obj: \$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src
|
||||
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
|
||||
|
||||
END
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
|
|
53
docs/GNUmakefile
Normal file
53
docs/GNUmakefile
Normal file
|
@ -0,0 +1,53 @@
|
|||
|
||||
VER= $(shell grep NGINX_VER src/core/nginx.h \
|
||||
| sed -e 's%^.*\"nginx/\(.*\)\"%\1%')
|
||||
NGINX= nginx-$(VER)
|
||||
TEMP= tmp
|
||||
CP= $(HOME)/java
|
||||
|
||||
define XSLScript
|
||||
javavm -cp $(CP)/xsls/saxon.jar:$(CP)/xsls/xsls.jar \
|
||||
com.pault.StyleSheet \
|
||||
-x com.pault.XX -y com.pault.XX \
|
||||
$(1) docs/xsls/dump.xsls \
|
||||
| awk 'BEGIN{e=0}/^\n*$$/{e=1;next}{if(e){print"";e=0};print}' > $(2)
|
||||
|
||||
if [ ! -s $(2) ]; then rm $(2); fi; test -s $(2)
|
||||
endef
|
||||
|
||||
define XSLT
|
||||
xsltproc $(shell echo $4 \
|
||||
| sed -e "s/\([^= ]*\)=\([^= ]*\)/--param \1 \"'\2'\"/g") \
|
||||
$3 $1 \
|
||||
> $(HTML)/$(strip $(2))
|
||||
endef
|
||||
|
||||
|
||||
changes: $(TEMP)/$(NGINX)/CHANGES.ru \
|
||||
$(TEMP)/$(NGINX)/CHANGES
|
||||
|
||||
|
||||
$(TEMP)/$(NGINX)/CHANGES.ru: docs/xml/nginx/changes.xml \
|
||||
docs/xslt/changes.xslt
|
||||
|
||||
test -d $(TEMP)/$(NGINX) || mkdir -p $(TEMP)/$(NGINX)
|
||||
|
||||
xsltproc --param lang "'ru'" \
|
||||
-o $(TEMP)/$(NGINX)/CHANGES.ru \
|
||||
docs/xslt/changes.xslt docs/xml/nginx/changes.xml
|
||||
|
||||
|
||||
$(TEMP)/$(NGINX)/CHANGES: docs/xml/nginx/changes.xml \
|
||||
docs/xslt/changes.xslt
|
||||
|
||||
test -d $(TEMP)/$(NGINX) || mkdir - p$(TEMP)/$(NGINX)
|
||||
|
||||
xsltproc --param lang "'en'" \
|
||||
-o $(TEMP)/$(NGINX)/CHANGES \
|
||||
docs/xslt/changes.xslt docs/xml/nginx/changes.xml
|
||||
|
||||
|
||||
docs/xslt/changes.xslt: docs/xsls/changes.xsls
|
||||
|
||||
$(call XSLScript, docs/xsls/changes.xsls, $@)
|
||||
|
|
@ -8,9 +8,8 @@
|
|||
<title lang="ru">éÚÍÅÎÅÎÉÑ × nginx</title>
|
||||
<title lang="en">nginx changelog</title>
|
||||
|
||||
<!--
|
||||
|
||||
<changes ver="0.4.0" date="19.08.2006">
|
||||
<changes ver="0.4.0" date="30.08.2006">
|
||||
|
||||
<change>
|
||||
<para lang="ru">
|
||||
|
@ -23,13 +22,73 @@ from the init module phase to the HTTP postconfiguration phase.
|
|||
</para>
|
||||
</change>
|
||||
|
||||
</changes>
|
||||
<change type="change">
|
||||
<para lang="ru">
|
||||
ÔÅÐÅÒØ ÔÅÌÏ ÚÁÐÒÏÓÁ × ÍÏÄÕÌÅ ngx_http_perl_module ÎÅ ÓÞÉÔÙ×ÁÅÔÓÑ
|
||||
ÚÁÒÁÎÅÅ: ÎÕÖÎÏ Ñ×ÎÏ ÉÎÉÃÉÉÒÏ×ÁÔØ ÞÔÅÎÉÅ Ó ÐÏÍÏÝØÀ ÍÅÔÏÄÁ $r->has_request_body.
|
||||
</para>
|
||||
<para lang="en">
|
||||
now the request body is not read beforehand for the ngx_http_perl_module:
|
||||
it's required to start the reading using the $r->has_request_body method.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
-->
|
||||
<change type="feature">
|
||||
<para lang="ru">
|
||||
ÍÏÄÕÌØ ngx_http_perl_module ÐÏÄÄÅÒÖÉ×ÁÅÔ ËÏÄ ×ÏÚ×ÒÁÔÁ DECLINED.
|
||||
</para>
|
||||
<para lang="en">
|
||||
the ngx_http_perl_module supports the DECLINED return code.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
<change type="feature">
|
||||
<para lang="ru">
|
||||
ÍÏÄÕÌØ ngx_http_dav_module ÐÏÄÄÅÒÖÉ×ÁÅÔ ×ÈÏÄÑÝÕÀ ÓÔÒÏËÕ ÚÁÇÏÌÏ×ËÁ "Date"
|
||||
ÄÌÑ ÍÅÔÏÄÁ PUT.
|
||||
</para>
|
||||
<para lang="en">
|
||||
the ngx_http_dav_module supports the incoming "Date" header line
|
||||
for the PUT method.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
<change type="feature">
|
||||
<para lang="ru">
|
||||
ÄÉÒÅËÔÉ×Á ssi ÒÁÂÏÔÁÅÔ ×ÎÕÔÒÉ ÂÌÏËÁ if.
|
||||
</para>
|
||||
<para lang="en">
|
||||
the "ssi" directive is available inside the "if" block.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
<change type="bugfix">
|
||||
<para lang="ru">
|
||||
ÐÒÏÉÓÈÏÄÉÌ segmentation fault, ÅÓÌÉ × ÄÉÒÅËÔÉ×Å index ÉÓÐÏÌØÚÏ×ÁÌÁÓØ
|
||||
ÐÅÒÅÍÅÎÎÙÅ É ÐÒÉ ÜÔÏÍ ÐÅÒ×ÏÅ ÉÍÑ ÉÎÄÅËÓÎÏÇÏ ÆÁÊÌÁ ÂÙÌÏ ÂÅÚ ÐÅÒÅÍÅÎÎÙÈ;
|
||||
ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.1.29.
|
||||
</para>
|
||||
<para lang="en">
|
||||
a segmentation fault occurred if there was an "index" directive with
|
||||
variables and the first index name was without variables;
|
||||
bug appeared in 0.1.29.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
</changes>
|
||||
|
||||
|
||||
<changes ver="0.3.61" date="28.08.2006">
|
||||
|
||||
<change type="change">
|
||||
<para lang="ru">
|
||||
ÄÉÒÅËÔÉ×Á tcp_nodelay ÔÅÐÅÒØ ÐÏ ÕÍÏÌÞÁÎÉÀ ×ËÌÀÞÅÎÁ.
|
||||
</para>
|
||||
<para lang="en">
|
||||
now the "tcp_nodelay" directive is turned on by default.
|
||||
</para>
|
||||
</change>
|
||||
|
||||
<change type="feature">
|
||||
<para lang="ru">
|
||||
ÄÉÒÅËÔÉ×Á msie_refresh.
|
||||
|
|
69
misc/GNUmakefile
Normal file
69
misc/GNUmakefile
Normal file
|
@ -0,0 +1,69 @@
|
|||
|
||||
VER= $(shell grep NGINX_VER src/core/nginx.h \
|
||||
| sed -e 's%^.*\"nginx/\(.*\)\"%\1%')
|
||||
NGINX= nginx-$(VER)
|
||||
TEMP= tmp
|
||||
|
||||
|
||||
release:
|
||||
rm -rf $(TEMP)
|
||||
|
||||
svn export -rHEAD . $(TEMP)/$(NGINX)
|
||||
|
||||
mv $(TEMP)/$(NGINX)/auto/configure $(TEMP)/$(NGINX)
|
||||
|
||||
# delete incomplete sources
|
||||
rm $(TEMP)/$(NGINX)/src/event/ngx_event_acceptex.c
|
||||
rm $(TEMP)/$(NGINX)/src/event/ngx_event_connectex.c
|
||||
rm $(TEMP)/$(NGINX)/src/event/modules/ngx_iocp_module.*
|
||||
rm -r $(TEMP)/$(NGINX)/src/os/win32
|
||||
|
||||
rm $(TEMP)/$(NGINX)/src/core/ngx_slab.*
|
||||
rm $(TEMP)/$(NGINX)/src/core/ngx_resolver.*
|
||||
|
||||
rm -r $(TEMP)/$(NGINX)/src/mysql
|
||||
|
||||
rm $(TEMP)/$(NGINX)/src/http/modules/ngx_http_status_module.c
|
||||
|
||||
mv $(TEMP)/$(NGINX)/docs/text/LICENSE $(TEMP)/$(NGINX)
|
||||
mv $(TEMP)/$(NGINX)/docs/text/README $(TEMP)/$(NGINX)
|
||||
mv $(TEMP)/$(NGINX)/docs/html $(TEMP)/$(NGINX)
|
||||
|
||||
$(MAKE) -f docs/GNUmakefile changes
|
||||
|
||||
rm -r $(TEMP)/$(NGINX)/docs
|
||||
rm -r $(TEMP)/$(NGINX)/misc
|
||||
|
||||
tar -c -z -f $(NGINX).tar.gz --directory $(TEMP) $(NGINX)
|
||||
|
||||
|
||||
icons: src/os/win32/nginx.ico src/os/win32/nginx_tray.ico
|
||||
|
||||
# 32x32 and 16x16 icons
|
||||
|
||||
src/os/win32/nginx.ico: src/os/win32/nginx_icon32.xpm \
|
||||
src/os/win32/nginx_icon16.xpm
|
||||
|
||||
test -d $(TEMP) || mkdir $(TEMP)
|
||||
|
||||
xpmtoppm --alphaout=$(TEMP)/nginx32.pbm \
|
||||
src/os/win32/nginx_icon32.xpm > $(TEMP)/nginx32.ppm
|
||||
|
||||
xpmtoppm --alphaout=$(TEMP)/nginx16.pbm \
|
||||
src/os/win32/nginx_icon16.xpm > $(TEMP)/nginx16.ppm
|
||||
|
||||
ppmtowinicon -output src/os/win32/nginx.ico -andpgms \
|
||||
$(TEMP)/nginx32.ppm $(TEMP)/nginx32.pbm \
|
||||
$(TEMP)/nginx16.ppm $(TEMP)/nginx16.pbm
|
||||
|
||||
# tray icon
|
||||
|
||||
src/os/win32/nginx_tray.ico: src/os/win32/nginx_tray.xpm
|
||||
|
||||
test -d $(TEMP) || mkdir $(TEMP)
|
||||
|
||||
xpmtoppm --alphaout=$(TEMP)/nginx_tray.pbm \
|
||||
src/os/win32/nginx_tray.xpm > $(TEMP)/nginx_tray.ppm
|
||||
|
||||
ppmtowinicon -output src/os/win32/nginx_tray.ico -andpgms \
|
||||
$(TEMP)/nginx_tray.ppm $(TEMP)/nginx_tray.pbm
|
16
misc/README
Normal file
16
misc/README
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
GNUmakefile, in svn it is available since 0.4.0 only.
|
||||
|
||||
|
||||
make -f misc/GNUmakefile release
|
||||
|
||||
the required tools:
|
||||
*) xsltproc to build CHANGES,
|
||||
*) java and XSLScript ( http://pault.com/pault/XSLScript/ ) to build XSLTs
|
||||
from XSLScript sources.
|
||||
|
||||
|
||||
make -f misc/GNUmakefile icons
|
||||
|
||||
the required tool:
|
||||
*) netpbm to create Win32 icons from xpm sources.
|
|
@ -8,7 +8,7 @@
|
|||
#define _NGINX_H_INCLUDED_
|
||||
|
||||
|
||||
#define NGINX_VER "nginx/0.3.61"
|
||||
#define NGINX_VER "nginx/0.4.0"
|
||||
|
||||
#define NGINX_VAR "NGINX"
|
||||
#define NGX_OLDPID_EXT ".oldbin"
|
||||
|
|
|
@ -29,7 +29,7 @@ static char *ngx_http_access_rule(ngx_conf_t *cf, ngx_command_t *cmd,
|
|||
static void *ngx_http_access_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_access_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
static ngx_int_t ngx_http_access_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_access_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_command_t ngx_http_access_commands[] = {
|
||||
|
@ -57,7 +57,7 @@ static ngx_command_t ngx_http_access_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_access_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_access_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -76,7 +76,7 @@ ngx_module_t ngx_http_access_module = {
|
|||
ngx_http_access_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_access_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -215,12 +215,12 @@ ngx_http_access_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_access_init(ngx_cycle_t *cycle)
|
||||
ngx_http_access_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
|
||||
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
|
|
|
@ -20,10 +20,10 @@ typedef struct {
|
|||
} ngx_http_addition_ctx_t;
|
||||
|
||||
|
||||
static ngx_int_t ngx_http_addition_filter_init(ngx_cycle_t *cycle);
|
||||
static void *ngx_http_addition_create_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_addition_merge_conf(ngx_conf_t *cf, void *parent,
|
||||
void *child);
|
||||
static ngx_int_t ngx_http_addition_filter_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_command_t ngx_http_addition_commands[] = {
|
||||
|
@ -48,7 +48,7 @@ static ngx_command_t ngx_http_addition_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_addition_filter_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_addition_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -67,7 +67,7 @@ ngx_module_t ngx_http_addition_filter_module = {
|
|||
ngx_http_addition_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_addition_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -178,7 +178,7 @@ ngx_http_addition_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_addition_filter_init(ngx_cycle_t *cycle)
|
||||
ngx_http_addition_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_addition_header_filter;
|
||||
|
|
|
@ -32,7 +32,7 @@ static void ngx_http_auth_basic_close(ngx_file_t *file);
|
|||
static void *ngx_http_auth_basic_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_auth_basic_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
static ngx_int_t ngx_http_auth_basic_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_auth_basic_init(ngx_conf_t *cf);
|
||||
static char *ngx_http_auth_basic(ngx_conf_t *cf, void *post, void *data);
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ static ngx_command_t ngx_http_auth_basic_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_auth_basic_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_auth_basic_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -81,7 +81,7 @@ ngx_module_t ngx_http_auth_basic_module = {
|
|||
ngx_http_auth_basic_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_auth_basic_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -351,12 +351,12 @@ ngx_http_auth_basic_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_auth_basic_init(ngx_cycle_t *cycle)
|
||||
ngx_http_auth_basic_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
|
||||
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
|
|
|
@ -48,7 +48,7 @@ static int ngx_libc_cdecl ngx_http_autoindex_cmp_entries(const void *one,
|
|||
const void *two);
|
||||
static ngx_int_t ngx_http_autoindex_error(ngx_http_request_t *r,
|
||||
ngx_dir_t *dir, ngx_str_t *name);
|
||||
static ngx_int_t ngx_http_autoindex_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_autoindex_init(ngx_conf_t *cf);
|
||||
static void *ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_autoindex_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
|
@ -83,7 +83,7 @@ static ngx_command_t ngx_http_autoindex_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_autoindex_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_autoindex_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -102,7 +102,7 @@ ngx_module_t ngx_http_autoindex_module = {
|
|||
ngx_http_autoindex_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_autoindex_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -590,25 +590,6 @@ ngx_http_autoindex_error(ngx_http_request_t *r, ngx_dir_t *dir, ngx_str_t *name)
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_autoindex_init(ngx_cycle_t *cycle)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
*h = ngx_http_autoindex_handler;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf)
|
||||
{
|
||||
|
@ -639,3 +620,22 @@ ngx_http_autoindex_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_autoindex_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
*h = ngx_http_autoindex_handler;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
|
|
@ -102,8 +102,6 @@ static char *ngx_http_set_charset_slot(ngx_conf_t *cf, ngx_command_t *cmd,
|
|||
void *conf);
|
||||
static ngx_int_t ngx_http_add_charset(ngx_array_t *charsets, ngx_str_t *name);
|
||||
|
||||
static ngx_int_t ngx_http_charset_filter_init(ngx_cycle_t *cycle);
|
||||
|
||||
static void *ngx_http_charset_create_main_conf(ngx_conf_t *cf);
|
||||
static void *ngx_http_charset_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_charset_merge_loc_conf(ngx_conf_t *cf,
|
||||
|
@ -169,7 +167,7 @@ ngx_module_t ngx_http_charset_filter_module = {
|
|||
ngx_http_charset_filter_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_charset_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -1334,19 +1332,6 @@ ngx_http_add_charset(ngx_array_t *charsets, ngx_str_t *name)
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_charset_filter_init(ngx_cycle_t *cycle)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_charset_header_filter;
|
||||
|
||||
ngx_http_next_body_filter = ngx_http_top_body_filter;
|
||||
ngx_http_top_body_filter = ngx_http_charset_body_filter;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
ngx_http_charset_create_main_conf(ngx_conf_t *cf)
|
||||
{
|
||||
|
@ -1516,5 +1501,11 @@ ngx_http_charset_postconfiguration(ngx_conf_t *cf)
|
|||
dst[tables[t].src] = tables[t].dst2src;
|
||||
}
|
||||
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_charset_header_filter;
|
||||
|
||||
ngx_http_next_body_filter = ngx_http_top_body_filter;
|
||||
ngx_http_top_body_filter = ngx_http_charset_body_filter;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
#include <ngx_http.h>
|
||||
|
||||
|
||||
static ngx_int_t ngx_http_chunked_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_chunked_filter_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_http_module_t ngx_http_chunked_filter_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_chunked_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -33,7 +33,7 @@ ngx_module_t ngx_http_chunked_filter_module = {
|
|||
NULL, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_chunked_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -183,7 +183,7 @@ ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_chunked_filter_init(ngx_cycle_t *cycle)
|
||||
ngx_http_chunked_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_chunked_header_filter;
|
||||
|
|
|
@ -28,7 +28,7 @@ static char *ngx_http_dav_access(ngx_conf_t *cf, ngx_command_t *cmd,
|
|||
static void *ngx_http_dav_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_dav_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
static ngx_int_t ngx_http_dav_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_dav_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_conf_bitmask_t ngx_http_dav_methods_mask[] = {
|
||||
|
@ -69,7 +69,7 @@ static ngx_command_t ngx_http_dav_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_dav_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_dav_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -88,7 +88,7 @@ ngx_module_t ngx_http_dav_module = {
|
|||
ngx_http_dav_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_dav_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -245,6 +245,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
|
|||
{
|
||||
char *failed;
|
||||
u_char *name;
|
||||
time_t date;
|
||||
ngx_err_t err;
|
||||
ngx_str_t *temp, path;
|
||||
ngx_uint_t status;
|
||||
|
@ -295,6 +296,24 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
|
|||
|
||||
#endif
|
||||
|
||||
if (r->headers_in.date) {
|
||||
date = ngx_http_parse_time(r->headers_in.date->value.data,
|
||||
r->headers_in.date->value.len);
|
||||
|
||||
if (date != NGX_ERROR) {
|
||||
if (ngx_set_file_time(temp->data,
|
||||
r->request_body->temp_file->file.fd, date)
|
||||
!= NGX_OK)
|
||||
{
|
||||
err = ngx_errno;
|
||||
failed = ngx_set_file_time_n;
|
||||
name = temp->data;
|
||||
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
failed = ngx_rename_file_n;
|
||||
name = path.data;
|
||||
|
||||
|
@ -332,13 +351,10 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
|
|||
err = ngx_errno;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
failed:
|
||||
|
||||
#endif
|
||||
|
||||
if (ngx_delete_file(temp->data) == NGX_FILE_ERROR) {
|
||||
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
|
||||
ngx_delete_file_n " \"%s\" failed",
|
||||
|
@ -543,12 +559,12 @@ ngx_http_dav_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_dav_init(ngx_cycle_t *cycle)
|
||||
ngx_http_dav_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
|
||||
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
|
|
|
@ -83,7 +83,7 @@ static ngx_int_t ngx_http_gzip_add_variables(ngx_conf_t *cf);
|
|||
static ngx_int_t ngx_http_gzip_ratio_variable(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
|
||||
static ngx_int_t ngx_http_gzip_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_gzip_filter_init(ngx_conf_t *cf);
|
||||
static void *ngx_http_gzip_create_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
|
@ -201,7 +201,7 @@ static ngx_command_t ngx_http_gzip_filter_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_gzip_filter_module_ctx = {
|
||||
ngx_http_gzip_add_variables, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_gzip_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -220,7 +220,7 @@ ngx_module_t ngx_http_gzip_filter_module = {
|
|||
ngx_http_gzip_filter_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_gzip_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -1030,19 +1030,6 @@ ngx_http_gzip_ratio_variable(ngx_http_request_t *r,
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_gzip_filter_init(ngx_cycle_t *cycle)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_gzip_header_filter;
|
||||
|
||||
ngx_http_next_body_filter = ngx_http_top_body_filter;
|
||||
ngx_http_top_body_filter = ngx_http_gzip_body_filter;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
ngx_http_gzip_create_conf(ngx_conf_t *cf)
|
||||
{
|
||||
|
@ -1123,6 +1110,19 @@ ngx_http_gzip_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_gzip_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_gzip_header_filter;
|
||||
|
||||
ngx_http_next_body_filter = ngx_http_top_body_filter;
|
||||
ngx_http_top_body_filter = ngx_http_gzip_body_filter;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
ngx_http_gzip_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
|
|
|
@ -28,10 +28,10 @@ typedef struct {
|
|||
#define NGX_HTTP_EXPIRES_EPOCH -2147483645
|
||||
|
||||
|
||||
static ngx_int_t ngx_http_headers_filter_init(ngx_cycle_t *cycle);
|
||||
static void *ngx_http_headers_create_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_headers_merge_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
static ngx_int_t ngx_http_headers_filter_init(ngx_conf_t *cf);
|
||||
static char *ngx_http_headers_expires(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
void *conf);
|
||||
static char *ngx_http_headers_add(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
|
@ -62,7 +62,7 @@ static ngx_command_t ngx_http_headers_filter_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_headers_filter_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_headers_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -81,7 +81,7 @@ ngx_module_t ngx_http_headers_filter_module = {
|
|||
ngx_http_headers_filter_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_headers_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -274,16 +274,6 @@ ngx_http_headers_filter(ngx_http_request_t *r)
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_headers_filter_init(ngx_cycle_t *cycle)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_headers_filter;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
ngx_http_headers_create_conf(ngx_conf_t *cf)
|
||||
{
|
||||
|
@ -331,6 +321,16 @@ ngx_http_headers_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_headers_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_headers_filter;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
ngx_http_headers_expires(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ static ngx_int_t ngx_http_index_test_dir(ngx_http_request_t *r,
|
|||
static ngx_int_t ngx_http_index_error(ngx_http_request_t *r,
|
||||
ngx_http_index_ctx_t *ctx, ngx_err_t err);
|
||||
|
||||
static ngx_int_t ngx_http_index_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_index_init(ngx_conf_t *cf);
|
||||
static void *ngx_http_index_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_index_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
|
@ -74,7 +74,7 @@ static ngx_command_t ngx_http_index_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_index_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_index_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -93,7 +93,7 @@ ngx_module_t ngx_http_index_module = {
|
|||
ngx_http_index_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_index_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -198,7 +198,7 @@ ngx_http_index_handler(ngx_http_request_t *r)
|
|||
len += 16;
|
||||
}
|
||||
|
||||
if (len > ctx->path.len) {
|
||||
if (len > (size_t) (ctx->path.data + ctx->path.len - ctx->index.data)) {
|
||||
|
||||
last = ngx_http_map_uri_to_path(r, &ctx->path, len);
|
||||
if (last == NULL) {
|
||||
|
@ -378,7 +378,7 @@ ngx_http_index_create_loc_conf(ngx_conf_t *cf)
|
|||
}
|
||||
|
||||
conf->indices = NULL;
|
||||
conf->max_index_len = 1;
|
||||
conf->max_index_len = 0;
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
@ -422,6 +422,25 @@ ngx_http_index_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_index_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
*h = ngx_http_index_handler;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
/* TODO: warn about duplicate indices */
|
||||
|
||||
static char *
|
||||
|
@ -429,8 +448,8 @@ ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
{
|
||||
ngx_http_index_loc_conf_t *ilcf = conf;
|
||||
|
||||
ngx_uint_t i, n;
|
||||
ngx_str_t *value;
|
||||
ngx_uint_t i, n;
|
||||
ngx_http_index_t *index;
|
||||
ngx_http_script_compile_t sc;
|
||||
|
||||
|
@ -471,9 +490,7 @@ ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
n = ngx_http_script_variables_count(&value[i]);
|
||||
|
||||
if (n == 0) {
|
||||
if (ilcf->max_index_len != 0
|
||||
&& ilcf->max_index_len < index->name.len)
|
||||
{
|
||||
if (ilcf->max_index_len < index->name.len) {
|
||||
ilcf->max_index_len = index->name.len;
|
||||
}
|
||||
|
||||
|
@ -496,28 +513,7 @@ ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
if (ngx_http_script_compile(&sc) != NGX_OK) {
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
ilcf->max_index_len = 0;
|
||||
}
|
||||
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_index_init(ngx_cycle_t *cycle)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
*h = ngx_http_index_handler;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
|
||||
|
||||
static ngx_int_t ngx_http_not_modified_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_not_modified_filter_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_http_module_t ngx_http_not_modified_filter_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_not_modified_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -34,7 +34,7 @@ ngx_module_t ngx_http_not_modified_filter_module = {
|
|||
NULL, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_not_modified_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -47,7 +47,8 @@ ngx_module_t ngx_http_not_modified_filter_module = {
|
|||
static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
|
||||
|
||||
|
||||
static ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r)
|
||||
static
|
||||
ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r)
|
||||
{
|
||||
time_t ims;
|
||||
|
||||
|
@ -80,7 +81,8 @@ static ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r)
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t ngx_http_not_modified_filter_init(ngx_cycle_t *cycle)
|
||||
static
|
||||
ngx_int_t ngx_http_not_modified_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_not_modified_header_filter;
|
||||
|
|
|
@ -49,13 +49,13 @@ typedef struct {
|
|||
} ngx_http_range_filter_ctx_t;
|
||||
|
||||
|
||||
static ngx_int_t ngx_http_range_header_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_range_body_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_range_header_filter_init(ngx_conf_t *cf);
|
||||
static ngx_int_t ngx_http_range_body_filter_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_http_module_t ngx_http_range_header_filter_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_range_header_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -74,7 +74,7 @@ ngx_module_t ngx_http_range_header_filter_module = {
|
|||
NULL, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_range_header_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -86,7 +86,7 @@ ngx_module_t ngx_http_range_header_filter_module = {
|
|||
|
||||
static ngx_http_module_t ngx_http_range_body_filter_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_range_body_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -105,7 +105,7 @@ ngx_module_t ngx_http_range_body_filter_module = {
|
|||
NULL, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_range_body_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -588,7 +588,7 @@ ngx_http_range_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_range_header_filter_init(ngx_cycle_t *cycle)
|
||||
ngx_http_range_header_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_range_header_filter;
|
||||
|
@ -598,7 +598,7 @@ ngx_http_range_header_filter_init(ngx_cycle_t *cycle)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_range_body_filter_init(ngx_cycle_t *cycle)
|
||||
ngx_http_range_body_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_body_filter = ngx_http_top_body_filter;
|
||||
ngx_http_top_body_filter = ngx_http_range_body_filter;
|
||||
|
|
|
@ -30,7 +30,7 @@ static char *ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd,
|
|||
static void *ngx_http_realip_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_realip_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
static ngx_int_t ngx_http_realip_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_realip_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_conf_enum_t ngx_http_realip_header[] = {
|
||||
|
@ -63,7 +63,7 @@ static ngx_command_t ngx_http_realip_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_realip_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_realip_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -82,7 +82,7 @@ ngx_module_t ngx_http_realip_module = {
|
|||
ngx_http_realip_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_realip_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -250,12 +250,12 @@ ngx_http_realip_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_realip_init(ngx_cycle_t *cycle)
|
||||
ngx_http_realip_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
|
||||
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_POST_READ_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
|
|
|
@ -23,7 +23,7 @@ typedef struct {
|
|||
static void *ngx_http_rewrite_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_rewrite_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
static ngx_int_t ngx_http_rewrite_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_rewrite_init(ngx_conf_t *cf);
|
||||
static char *ngx_http_rewrite(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||
static char *ngx_http_rewrite_return(ngx_conf_t *cf, ngx_command_t *cmd,
|
||||
void *conf);
|
||||
|
@ -104,7 +104,7 @@ static ngx_command_t ngx_http_rewrite_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_rewrite_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_rewrite_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -123,7 +123,7 @@ ngx_module_t ngx_http_rewrite_module = {
|
|||
ngx_http_rewrite_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_rewrite_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -267,12 +267,12 @@ ngx_http_rewrite_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_rewrite_init(ngx_cycle_t *cycle)
|
||||
ngx_http_rewrite_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
|
||||
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_SERVER_REWRITE_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
|
|
|
@ -106,13 +106,14 @@ static char *ngx_http_ssi_init_main_conf(ngx_conf_t *cf, void *conf);
|
|||
static void *ngx_http_ssi_create_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_ssi_merge_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
static ngx_int_t ngx_http_ssi_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_ssi_filter_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_command_t ngx_http_ssi_filter_commands[] = {
|
||||
|
||||
{ ngx_string("ssi"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||||
|NGX_CONF_FLAG,
|
||||
ngx_conf_set_flag_slot,
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
offsetof(ngx_http_ssi_loc_conf_t, enable),
|
||||
|
@ -160,7 +161,7 @@ static ngx_command_t ngx_http_ssi_filter_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_ssi_filter_module_ctx = {
|
||||
ngx_http_ssi_preconfiguration, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_ssi_filter_init, /* postconfiguration */
|
||||
|
||||
ngx_http_ssi_create_main_conf, /* create main configuration */
|
||||
ngx_http_ssi_init_main_conf, /* init main configuration */
|
||||
|
@ -179,7 +180,7 @@ ngx_module_t ngx_http_ssi_filter_module = {
|
|||
ngx_http_ssi_filter_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_ssi_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -2654,7 +2655,7 @@ ngx_http_ssi_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_ssi_filter_init(ngx_cycle_t *cycle)
|
||||
ngx_http_ssi_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_ssi_header_filter;
|
||||
|
|
|
@ -18,7 +18,7 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r);
|
|||
static void *ngx_http_static_create_loc_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_static_merge_loc_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
static ngx_int_t ngx_http_static_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_static_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_command_t ngx_http_static_commands[] = {
|
||||
|
@ -40,7 +40,7 @@ static ngx_command_t ngx_http_static_commands[] = {
|
|||
|
||||
ngx_http_module_t ngx_http_static_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_static_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -59,7 +59,7 @@ ngx_module_t ngx_http_static_module = {
|
|||
ngx_http_static_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_static_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -317,12 +317,12 @@ ngx_http_static_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_static_init(ngx_cycle_t *cycle)
|
||||
ngx_http_static_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
|
||||
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
|
|
|
@ -59,7 +59,7 @@ static ngx_int_t ngx_http_userid_add_variables(ngx_conf_t *cf);
|
|||
static ngx_int_t ngx_http_userid_variable(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
|
||||
static ngx_int_t ngx_http_userid_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_userid_init(ngx_conf_t *cf);
|
||||
static void *ngx_http_userid_create_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_userid_merge_conf(ngx_conf_t *cf, void *parent,
|
||||
void *child);
|
||||
|
@ -162,7 +162,7 @@ static ngx_command_t ngx_http_userid_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_userid_filter_module_ctx = {
|
||||
ngx_http_userid_add_variables, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_userid_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -181,7 +181,7 @@ ngx_module_t ngx_http_userid_filter_module = {
|
|||
ngx_http_userid_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_userid_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -622,16 +622,6 @@ ngx_http_userid_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_userid_init(ngx_cycle_t *cycle)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_userid_filter;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
ngx_http_userid_create_conf(ngx_conf_t *cf)
|
||||
{
|
||||
|
@ -693,6 +683,16 @@ ngx_http_userid_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_userid_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_header_filter = ngx_http_top_header_filter;
|
||||
ngx_http_top_header_filter = ngx_http_userid_filter;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
ngx_http_userid_domain(ngx_conf_t *cf, void *post, void *data)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ WriteMakefile(
|
|||
ABSTRACT_FROM => 'nginx.pm', # retrieve abstract from module
|
||||
AUTHOR => 'Igor Sysoev',
|
||||
|
||||
CCFLAGS => "$ENV{NGX_PERL_CFLAGS}",
|
||||
CCFLAGS => "$ENV{NGX_PM_CFLAGS}",
|
||||
OPTIMIZE => '-O',
|
||||
|
||||
INC => "-I ../../../../../src/core " .
|
||||
|
@ -22,8 +22,9 @@ WriteMakefile(
|
|||
"-I ../../../../../src/http/modules " .
|
||||
"-I ../../../../../src/http/modules/perl " .
|
||||
"-I ../../../../../$ENV{NGX_OBJS} " .
|
||||
"-I ../../../../../$ENV{NGX_PCRE} " .
|
||||
"-I ../../../../../$ENV{NGX_ZLIB} ",
|
||||
($ENV{NGX_PCRE} =~ /^(YES|NO)/ ? "" :
|
||||
($ENV{NGX_PCRE} =~ m#^/# ? "-I $ENV{NGX_PCRE} " :
|
||||
"-I ../../../../../$ENV{NGX_PCRE} ")),
|
||||
|
||||
depend => {
|
||||
'nginx.c' =>
|
||||
|
|
|
@ -17,7 +17,7 @@ our @EXPORT = qw(
|
|||
HTTP_SERVER_ERROR
|
||||
);
|
||||
|
||||
our $VERSION = '0.3.43';
|
||||
our $VERSION = '0.4.0';
|
||||
|
||||
require XSLoader;
|
||||
XSLoader::load('nginx', $VERSION);
|
||||
|
|
|
@ -328,6 +328,42 @@ header_in(r, key)
|
|||
ST(0) = TARG;
|
||||
|
||||
|
||||
void
|
||||
has_request_body(r, next)
|
||||
CODE:
|
||||
|
||||
dXSTARG;
|
||||
ngx_http_request_t *r;
|
||||
SV *next;
|
||||
ngx_http_perl_ctx_t *ctx;
|
||||
|
||||
ngx_http_perl_set_request(r);
|
||||
|
||||
if (r->headers_in.content_length_n <= 0) {
|
||||
XSRETURN_UNDEF;
|
||||
}
|
||||
|
||||
next = ST(1);
|
||||
|
||||
ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
|
||||
ctx->next = next;
|
||||
|
||||
r->request_body_in_single_buf = 1;
|
||||
r->request_body_in_persistent_file = 1;
|
||||
r->request_body_delete_incomplete_file = 1;
|
||||
|
||||
if (r->request_body_in_file_only) {
|
||||
r->request_body_file_log_level = 0;
|
||||
}
|
||||
|
||||
ngx_http_read_client_request_body(r, ngx_http_perl_handle_request);
|
||||
|
||||
sv_upgrade(TARG, SVt_IV);
|
||||
sv_setiv(TARG, 1);
|
||||
|
||||
ST(0) = TARG;
|
||||
|
||||
|
||||
void
|
||||
request_body(r)
|
||||
CODE:
|
||||
|
|
|
@ -45,7 +45,6 @@ static ngx_int_t ngx_http_perl_ssi(ngx_http_request_t *r,
|
|||
ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params);
|
||||
#endif
|
||||
|
||||
static void ngx_http_perl_handle_request(ngx_http_request_t *r);
|
||||
static ngx_int_t
|
||||
ngx_http_perl_get_interpreter(ngx_http_perl_main_conf_t *pmcf,
|
||||
PerlInterpreter **perl, ngx_log_t *log);
|
||||
|
@ -176,6 +175,9 @@ static ngx_http_ssi_command_t ngx_http_perl_ssi_command = {
|
|||
#endif
|
||||
|
||||
|
||||
static ngx_str_t ngx_null_name = ngx_null_string;
|
||||
|
||||
|
||||
static HV *nginx_stash;
|
||||
|
||||
static void
|
||||
|
@ -190,13 +192,16 @@ ngx_http_perl_xs_init(pTHX)
|
|||
static ngx_int_t
|
||||
ngx_http_perl_handler(ngx_http_request_t *r)
|
||||
{
|
||||
ngx_int_t rc;
|
||||
|
||||
/* TODO: Win32 */
|
||||
if (r->zero_in_uri) {
|
||||
return NGX_HTTP_NOT_FOUND;
|
||||
}
|
||||
|
||||
ngx_http_perl_handle_request(r);
|
||||
|
||||
return NGX_DONE;
|
||||
|
||||
#if 0
|
||||
r->request_body_in_single_buf = 1;
|
||||
r->request_body_in_persistent_file = 1;
|
||||
r->request_body_delete_incomplete_file = 1;
|
||||
|
@ -212,14 +217,16 @@ ngx_http_perl_handler(ngx_http_request_t *r)
|
|||
}
|
||||
|
||||
return NGX_DONE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
void
|
||||
ngx_http_perl_handle_request(ngx_http_request_t *r)
|
||||
{
|
||||
SV *sub;
|
||||
ngx_int_t rc;
|
||||
ngx_str_t uri, args;
|
||||
ngx_str_t uri, args, *handler;
|
||||
ngx_http_perl_ctx_t *ctx;
|
||||
ngx_http_perl_loc_conf_t *plcf;
|
||||
ngx_http_perl_main_conf_t *pmcf;
|
||||
|
@ -231,7 +238,7 @@ ngx_http_perl_handle_request(ngx_http_request_t *r)
|
|||
if (ctx == NULL) {
|
||||
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_perl_ctx_t));
|
||||
if (ctx == NULL) {
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
ngx_http_finalize_request(r, NGX_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -251,10 +258,18 @@ ngx_http_perl_handle_request(ngx_http_request_t *r)
|
|||
|
||||
dTHXa(ctx->perl);
|
||||
|
||||
plcf = ngx_http_get_module_loc_conf(r, ngx_http_perl_module);
|
||||
if (ctx->next == NULL) {
|
||||
plcf = ngx_http_get_module_loc_conf(r, ngx_http_perl_module);
|
||||
sub = plcf->sub;
|
||||
handler = &plcf->handler;
|
||||
|
||||
rc = ngx_http_perl_call_handler(aTHX_ r, plcf->sub, NULL,
|
||||
&plcf->handler, NULL);
|
||||
} else {
|
||||
sub = ctx->next;
|
||||
handler = &ngx_null_name;
|
||||
ctx->next = NULL;
|
||||
}
|
||||
|
||||
rc = ngx_http_perl_call_handler(aTHX_ r, sub, NULL, handler, NULL);
|
||||
|
||||
}
|
||||
|
||||
|
@ -278,6 +293,10 @@ ngx_http_perl_handle_request(ngx_http_request_t *r)
|
|||
ctx->filename.data = NULL;
|
||||
ctx->redirect_uri.len = 0;
|
||||
|
||||
if (ctx->done || ctx->next) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (uri.len) {
|
||||
ngx_http_internal_redirect(r, &uri, &args);
|
||||
return;
|
||||
|
@ -285,6 +304,7 @@ ngx_http_perl_handle_request(ngx_http_request_t *r)
|
|||
|
||||
if (rc == NGX_OK || rc == NGX_HTTP_OK) {
|
||||
ngx_http_send_special(r, NGX_HTTP_LAST);
|
||||
ctx->done = 1;
|
||||
}
|
||||
|
||||
ngx_http_finalize_request(r, rc);
|
||||
|
@ -666,14 +686,6 @@ ngx_http_perl_run_requires(pTHX_ ngx_array_t *requires, ngx_log_t *log)
|
|||
}
|
||||
|
||||
|
||||
#if (__INTEL_COMPILER)
|
||||
/*
|
||||
* disable 'declaration hides parameter "my_perl"' warning for ENTER and LEAVE
|
||||
*/
|
||||
#pragma warning(disable:1599)
|
||||
#endif
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, SV *sub,
|
||||
ngx_str_t **args, ngx_str_t *handler, ngx_str_t *rv)
|
||||
|
@ -773,11 +785,6 @@ ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, SV *sub,
|
|||
}
|
||||
|
||||
|
||||
#if (__INTEL_COMPILER)
|
||||
#pragma warning(default:1599)
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
ngx_http_perl_eval_anon_sub(pTHX_ ngx_str_t *handler, SV **sv)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,9 @@ typedef struct {
|
|||
ngx_str_t filename;
|
||||
ngx_str_t redirect_uri;
|
||||
ngx_str_t redirect_args;
|
||||
SV *next;
|
||||
|
||||
ngx_uint_t done; /* unsigned done:1; */
|
||||
|
||||
#if (NGX_HTTP_SSI)
|
||||
ngx_http_ssi_ctx_t *ssi;
|
||||
|
@ -47,4 +50,7 @@ extern ngx_module_t ngx_http_perl_module;
|
|||
extern void boot_DynaLoader(pTHX_ CV* cv);
|
||||
|
||||
|
||||
void ngx_http_perl_handle_request(ngx_http_request_t *r);
|
||||
|
||||
|
||||
#endif /* _NGX_HTTP_PERL_MODULE_H_INCLUDED_ */
|
||||
|
|
|
@ -75,8 +75,9 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
{
|
||||
char *rv;
|
||||
u_char ch;
|
||||
ngx_int_t rc;
|
||||
ngx_uint_t mi, m, s, l, p, a, i;
|
||||
ngx_int_t rc, j;
|
||||
ngx_uint_t mi, m, s, l, p, a, i, n;
|
||||
ngx_uint_t find_config_index, use_rewrite, use_access;
|
||||
ngx_uint_t last, bind_all, done;
|
||||
ngx_conf_t pcf;
|
||||
ngx_array_t headers_in, in_ports;
|
||||
|
@ -93,9 +94,11 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
ngx_http_conf_in_addr_t *in_addr;
|
||||
ngx_hash_keys_arrays_t ha;
|
||||
ngx_http_server_name_t *name;
|
||||
ngx_http_phase_handler_t *ph;
|
||||
ngx_http_virtual_names_t *vn;
|
||||
ngx_http_core_srv_conf_t **cscfp, *cscf;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
ngx_http_phase_handler_pt checker;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
#if (NGX_WIN32)
|
||||
ngx_iocp_conf_t *iocpcf;
|
||||
|
@ -293,8 +296,6 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
cmcf->phases[NGX_HTTP_POST_READ_PHASE].type = NGX_OK;
|
||||
|
||||
|
||||
if (ngx_array_init(&cmcf->phases[NGX_HTTP_SERVER_REWRITE_PHASE].handlers,
|
||||
cf->pool, 1, sizeof(ngx_http_handler_pt))
|
||||
|
@ -303,27 +304,6 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
cmcf->phases[NGX_HTTP_SERVER_REWRITE_PHASE].type = NGX_OK;
|
||||
|
||||
|
||||
/* the special find config phase for a single handler */
|
||||
|
||||
if (ngx_array_init(&cmcf->phases[NGX_HTTP_FIND_CONFIG_PHASE].handlers,
|
||||
cf->pool, 1, sizeof(ngx_http_handler_pt))
|
||||
!= NGX_OK)
|
||||
{
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
cmcf->phases[NGX_HTTP_FIND_CONFIG_PHASE].type = NGX_OK;
|
||||
|
||||
h = ngx_array_push(&cmcf->phases[NGX_HTTP_FIND_CONFIG_PHASE].handlers);
|
||||
if (h == NULL) {
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
*h = ngx_http_find_location_config;
|
||||
|
||||
|
||||
if (ngx_array_init(&cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers,
|
||||
cf->pool, 1, sizeof(ngx_http_handler_pt))
|
||||
|
@ -332,8 +312,6 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
cmcf->phases[NGX_HTTP_REWRITE_PHASE].type = NGX_OK;
|
||||
|
||||
|
||||
if (ngx_array_init(&cmcf->phases[NGX_HTTP_PREACCESS_PHASE].handlers,
|
||||
cf->pool, 1, sizeof(ngx_http_handler_pt))
|
||||
|
@ -342,8 +320,6 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
cmcf->phases[NGX_HTTP_PREACCESS_PHASE].type = NGX_OK;
|
||||
|
||||
|
||||
if (ngx_array_init(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers,
|
||||
cf->pool, 2, sizeof(ngx_http_handler_pt))
|
||||
|
@ -352,8 +328,6 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
cmcf->phases[NGX_HTTP_ACCESS_PHASE].type = NGX_DECLINED;
|
||||
|
||||
|
||||
if (ngx_array_init(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers,
|
||||
cf->pool, 4, sizeof(ngx_http_handler_pt))
|
||||
|
@ -362,8 +336,6 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
cmcf->phases[NGX_HTTP_CONTENT_PHASE].type = NGX_OK;
|
||||
|
||||
|
||||
if (ngx_array_init(&cmcf->phases[NGX_HTTP_LOG_PHASE].handlers,
|
||||
cf->pool, 1, sizeof(ngx_http_handler_pt))
|
||||
|
@ -372,8 +344,6 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
cmcf->phases[NGX_HTTP_LOG_PHASE].type = NGX_OK;
|
||||
|
||||
|
||||
if (ngx_array_init(&headers_in, cf->temp_pool, 32, sizeof(ngx_hash_key_t))
|
||||
!= NGX_OK)
|
||||
|
@ -432,6 +402,91 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||
*cf = pcf;
|
||||
|
||||
|
||||
cmcf->phase_engine.server_rewrite_index = (ngx_uint_t) -1;
|
||||
find_config_index = 0;
|
||||
use_rewrite = cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers.nelts ? 1 : 0;
|
||||
use_access = cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers.nelts ? 1 : 0;
|
||||
|
||||
n = use_rewrite + use_access + 1; /* find config phase */
|
||||
|
||||
for (i = 0; i < NGX_HTTP_LOG_PHASE; i++) {
|
||||
n += cmcf->phases[i].handlers.nelts;
|
||||
}
|
||||
|
||||
ph = ngx_pcalloc(cf->pool,
|
||||
n * sizeof(ngx_http_phase_handler_t) + sizeof(void *));
|
||||
if (ph == NULL) {
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
cmcf->phase_engine.handlers = ph;
|
||||
n = 0;
|
||||
|
||||
for (i = 0; i < NGX_HTTP_LOG_PHASE; i++) {
|
||||
h = cmcf->phases[i].handlers.elts;
|
||||
|
||||
switch (i) {
|
||||
|
||||
case NGX_HTTP_SERVER_REWRITE_PHASE:
|
||||
if (cmcf->phase_engine.server_rewrite_index == (ngx_uint_t) -1) {
|
||||
cmcf->phase_engine.server_rewrite_index = n;
|
||||
}
|
||||
checker = ngx_http_core_generic_phase;
|
||||
|
||||
break;
|
||||
|
||||
case NGX_HTTP_FIND_CONFIG_PHASE:
|
||||
find_config_index = n;
|
||||
|
||||
ph->checker = ngx_http_core_find_config_phase;
|
||||
n++;
|
||||
ph++;
|
||||
|
||||
continue;
|
||||
|
||||
case NGX_HTTP_POST_REWRITE_PHASE:
|
||||
if (use_rewrite) {
|
||||
ph->checker = ngx_http_core_post_rewrite_phase;
|
||||
ph->next = find_config_index;
|
||||
n++;
|
||||
ph++;
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
case NGX_HTTP_ACCESS_PHASE:
|
||||
checker = ngx_http_core_access_phase;
|
||||
n++;
|
||||
break;
|
||||
|
||||
case NGX_HTTP_POST_ACCESS_PHASE:
|
||||
if (use_access) {
|
||||
ph->checker = ngx_http_core_post_access_phase;
|
||||
ph->next = n;
|
||||
ph++;
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
case NGX_HTTP_CONTENT_PHASE:
|
||||
checker = ngx_http_core_content_phase;
|
||||
break;
|
||||
|
||||
default:
|
||||
checker = ngx_http_core_generic_phase;
|
||||
}
|
||||
|
||||
n += cmcf->phases[i].handlers.nelts;
|
||||
|
||||
for (j = cmcf->phases[i].handlers.nelts - 1; j >=0; j--) {
|
||||
ph->checker = checker;
|
||||
ph->handler = h[j];
|
||||
ph->next = n;
|
||||
ph++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* create the lists of ports, addresses and server names
|
||||
* to quickly find the server core module configuration at run-time
|
||||
|
@ -936,7 +991,6 @@ ngx_http_add_names(ngx_conf_t *cf, ngx_http_conf_in_addr_t *in_addr,
|
|||
if (name == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
server_names = cscf->server_names.elts;
|
||||
|
||||
*name = server_names[i];
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ typedef struct {
|
|||
static void *ngx_http_copy_filter_create_conf(ngx_conf_t *cf);
|
||||
static char *ngx_http_copy_filter_merge_conf(ngx_conf_t *cf,
|
||||
void *parent, void *child);
|
||||
static ngx_int_t ngx_http_copy_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_copy_filter_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_command_t ngx_http_copy_filter_commands[] = {
|
||||
|
@ -35,7 +35,7 @@ static ngx_command_t ngx_http_copy_filter_commands[] = {
|
|||
|
||||
static ngx_http_module_t ngx_http_copy_filter_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_copy_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -54,7 +54,7 @@ ngx_module_t ngx_http_copy_filter_module = {
|
|||
ngx_http_copy_filter_commands, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_copy_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -149,7 +149,7 @@ ngx_http_copy_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_copy_filter_init(ngx_cycle_t *cycle)
|
||||
ngx_http_copy_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_filter = ngx_http_top_body_filter;
|
||||
ngx_http_top_body_filter = ngx_http_copy_filter;
|
||||
|
|
|
@ -23,7 +23,6 @@ typedef struct {
|
|||
#define NGX_HTTP_LOCATION_REGEX 4
|
||||
|
||||
|
||||
static void ngx_http_core_run_phases(ngx_http_request_t *r);
|
||||
static ngx_int_t ngx_http_core_find_location(ngx_http_request_t *r,
|
||||
ngx_array_t *locations, size_t len);
|
||||
|
||||
|
@ -474,6 +473,8 @@ ngx_module_t ngx_http_core_module = {
|
|||
void
|
||||
ngx_http_handler(ngx_http_request_t *r)
|
||||
{
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
r->connection->log->action = NULL;
|
||||
|
||||
r->connection->unexpected_eof = 0;
|
||||
|
@ -500,8 +501,8 @@ ngx_http_handler(ngx_http_request_t *r)
|
|||
if (r->keepalive && r->headers_in.msie && r->method == NGX_HTTP_POST) {
|
||||
|
||||
/*
|
||||
* MSIE may wait for some time if the response for
|
||||
* the POST request is sent over the keepalive connection
|
||||
* MSIE may wait for some time if an response for
|
||||
* a POST request was sent over a keepalive connection
|
||||
*/
|
||||
|
||||
r->keepalive = 0;
|
||||
|
@ -515,172 +516,84 @@ ngx_http_handler(ngx_http_request_t *r)
|
|||
}
|
||||
}
|
||||
|
||||
r->write_event_handler = ngx_http_core_run_phases;
|
||||
|
||||
r->valid_unparsed_uri = 1;
|
||||
r->valid_location = 1;
|
||||
r->uri_changed = 1;
|
||||
|
||||
r->phase = (!r->internal) ? NGX_HTTP_POST_READ_PHASE:
|
||||
NGX_HTTP_SERVER_REWRITE_PHASE;
|
||||
r->phase_handler = 0;
|
||||
if (!r->internal) {
|
||||
r->phase_handler = 0;
|
||||
|
||||
} else {
|
||||
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
|
||||
r->phase_handler = cmcf->phase_engine.server_rewrite_index;
|
||||
}
|
||||
|
||||
r->write_event_handler = ngx_http_core_run_phases;
|
||||
ngx_http_core_run_phases(r);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
void
|
||||
ngx_http_core_run_phases(ngx_http_request_t *r)
|
||||
{
|
||||
ngx_int_t rc;
|
||||
ngx_str_t path;
|
||||
ngx_http_handler_pt *h;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
ngx_http_phase_handler_t *ph;
|
||||
ngx_http_core_main_conf_t *cmcf;
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"http phase handler");
|
||||
|
||||
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
|
||||
|
||||
for (/* void */; r->phase < NGX_HTTP_LOG_PHASE; r->phase++) {
|
||||
ph = cmcf->phase_engine.handlers;
|
||||
|
||||
if (r->phase == NGX_HTTP_REWRITE_PHASE + 1 && r->uri_changed) {
|
||||
while (ph[r->phase_handler].checker) {
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"uri changes: %d", r->uri_changes);
|
||||
rc = ph[r->phase_handler].checker(r, &ph[r->phase_handler]);
|
||||
|
||||
/*
|
||||
* gcc before 3.3 compiles the broken code for
|
||||
* if (r->uri_changes-- == 0)
|
||||
* if the r->uri_changes is defined as
|
||||
* unsigned uri_changes:4
|
||||
*/
|
||||
|
||||
r->uri_changes--;
|
||||
|
||||
if (r->uri_changes == 0) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"rewrite or internal redirection cycle "
|
||||
"while processing \"%V\"", &r->uri);
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
r->phase = NGX_HTTP_FIND_CONFIG_PHASE;
|
||||
}
|
||||
|
||||
if (r->phase == NGX_HTTP_ACCESS_PHASE && r != r->main) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (r->phase == NGX_HTTP_CONTENT_PHASE && r->content_handler) {
|
||||
r->write_event_handler = ngx_http_request_empty_handler;
|
||||
ngx_http_finalize_request(r, r->content_handler(r));
|
||||
return;
|
||||
}
|
||||
|
||||
h = cmcf->phases[r->phase].handlers.elts;
|
||||
for (r->phase_handler = cmcf->phases[r->phase].handlers.nelts - 1;
|
||||
r->phase_handler >= 0;
|
||||
r->phase_handler--)
|
||||
{
|
||||
rc = h[r->phase_handler](r);
|
||||
|
||||
if (rc == NGX_DONE) {
|
||||
|
||||
/*
|
||||
* we should never use r here because
|
||||
* it may point to already freed data
|
||||
*/
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (rc == NGX_DECLINED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (r->phase == NGX_HTTP_ACCESS_PHASE) {
|
||||
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
||||
|
||||
if (clcf->satisfy_any) {
|
||||
|
||||
if (rc == NGX_OK) {
|
||||
r->access_code = 0;
|
||||
|
||||
if (r->headers_out.www_authenticate) {
|
||||
r->headers_out.www_authenticate->hash = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (rc == NGX_HTTP_FORBIDDEN || rc == NGX_HTTP_UNAUTHORIZED)
|
||||
{
|
||||
r->access_code = rc;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rc >= NGX_HTTP_SPECIAL_RESPONSE
|
||||
|| rc == NGX_HTTP_NO_CONTENT
|
||||
|| rc == NGX_ERROR)
|
||||
{
|
||||
ngx_http_finalize_request(r, rc);
|
||||
return;
|
||||
}
|
||||
|
||||
if (r->phase == NGX_HTTP_CONTENT_PHASE) {
|
||||
ngx_http_finalize_request(r, rc);
|
||||
return;
|
||||
}
|
||||
|
||||
if (rc == NGX_AGAIN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rc == NGX_OK && cmcf->phases[r->phase].type == NGX_OK) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (r->phase == NGX_HTTP_ACCESS_PHASE && r->access_code) {
|
||||
|
||||
if (r->access_code == NGX_HTTP_FORBIDDEN) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"access forbidden by rule");
|
||||
}
|
||||
|
||||
ngx_http_finalize_request(r, r->access_code);
|
||||
if (rc == NGX_OK) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* no content handler was found */
|
||||
|
||||
if (r->uri.data[r->uri.len - 1] == '/' && !r->zero_in_uri) {
|
||||
|
||||
if (ngx_http_map_uri_to_path(r, &path, 0) != NULL) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"directory index of \"%V\" is forbidden", &path);
|
||||
}
|
||||
|
||||
ngx_http_finalize_request(r, NGX_HTTP_FORBIDDEN);
|
||||
return;
|
||||
}
|
||||
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no handler found");
|
||||
|
||||
ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_http_find_location_config(ngx_http_request_t *r)
|
||||
ngx_http_core_generic_phase(ngx_http_request_t *r, ngx_http_phase_handler_t *ph)
|
||||
{
|
||||
ngx_int_t rc;
|
||||
|
||||
/*
|
||||
* generic phase checker,
|
||||
* used by the post read, server rewrite, rewrite, and pre-access phases
|
||||
*/
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"generic phase: %ui", r->phase_handler);
|
||||
|
||||
rc = ph->handler(r);
|
||||
|
||||
if (rc == NGX_OK) {
|
||||
r->phase_handler = ph->next;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
if (rc == NGX_DECLINED) {
|
||||
r->phase_handler++;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
if (rc == NGX_AGAIN || rc == NGX_DONE) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
/* rc == NGX_ERROR || rc == NGX_HTTP_... */
|
||||
|
||||
ngx_http_finalize_request(r, rc);
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_http_core_find_config_phase(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph)
|
||||
{
|
||||
ngx_int_t rc;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
|
@ -694,13 +607,15 @@ ngx_http_find_location_config(ngx_http_request_t *r)
|
|||
rc = ngx_http_core_find_location(r, &cscf->locations, 0);
|
||||
|
||||
if (rc == NGX_HTTP_INTERNAL_SERVER_ERROR) {
|
||||
return rc;
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
||||
|
||||
if (!r->internal && clcf->internal) {
|
||||
return NGX_HTTP_NOT_FOUND;
|
||||
ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
|
@ -723,14 +638,16 @@ ngx_http_find_location_config(ngx_http_request_t *r)
|
|||
"client intented to send too large body: %O bytes",
|
||||
r->headers_in.content_length_n);
|
||||
|
||||
return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE;
|
||||
ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
if (rc == NGX_HTTP_LOCATION_AUTO_REDIRECT) {
|
||||
r->headers_out.location = ngx_list_push(&r->headers_out.headers);
|
||||
if (r->headers_out.location == NULL) {
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -740,9 +657,190 @@ ngx_http_find_location_config(ngx_http_request_t *r)
|
|||
|
||||
r->headers_out.location->value = clcf->name;
|
||||
|
||||
return NGX_HTTP_MOVED_PERMANENTLY;
|
||||
ngx_http_finalize_request(r, NGX_HTTP_MOVED_PERMANENTLY);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
r->phase_handler++;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_http_core_post_rewrite_phase(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph)
|
||||
{
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"post rewrite phase: %ui", r->phase_handler);
|
||||
|
||||
if (!r->uri_changed) {
|
||||
r->phase_handler++;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"uri changes: %d", r->uri_changes);
|
||||
|
||||
/*
|
||||
* gcc before 3.3 compiles the broken code for
|
||||
* if (r->uri_changes-- == 0)
|
||||
* if the r->uri_changes is defined as
|
||||
* unsigned uri_changes:4
|
||||
*/
|
||||
|
||||
r->uri_changes--;
|
||||
|
||||
if (r->uri_changes == 0) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"rewrite or internal redirection cycle "
|
||||
"while processing \"%V\"", &r->uri);
|
||||
|
||||
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
r->phase_handler = ph->next;
|
||||
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_http_core_access_phase(ngx_http_request_t *r, ngx_http_phase_handler_t *ph)
|
||||
{
|
||||
ngx_int_t rc;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
|
||||
if (r != r->main) {
|
||||
r->phase_handler = ph->next;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"access phase: %ui", r->phase_handler);
|
||||
|
||||
rc = ph->handler(r);
|
||||
|
||||
if (rc == NGX_DECLINED) {
|
||||
r->phase_handler++;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
if (rc == NGX_AGAIN || rc == NGX_DONE) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
||||
|
||||
if (clcf->satisfy_any == 0) {
|
||||
|
||||
if (rc == NGX_OK) {
|
||||
r->phase_handler++;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (rc == NGX_OK) {
|
||||
r->access_code = 0;
|
||||
|
||||
if (r->headers_out.www_authenticate) {
|
||||
r->headers_out.www_authenticate->hash = 0;
|
||||
}
|
||||
|
||||
r->phase_handler = ph->next;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
if (rc == NGX_HTTP_FORBIDDEN || rc == NGX_HTTP_UNAUTHORIZED) {
|
||||
r->access_code = rc;
|
||||
|
||||
r->phase_handler++;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
}
|
||||
|
||||
/* rc == NGX_ERROR || rc == NGX_HTTP_... */
|
||||
|
||||
ngx_http_finalize_request(r, rc);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_http_core_post_access_phase(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph)
|
||||
{
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"post access phase: %ui", r->phase_handler);
|
||||
|
||||
if (r->access_code) {
|
||||
|
||||
if (r->access_code == NGX_HTTP_FORBIDDEN) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"access forbidden by rule");
|
||||
}
|
||||
|
||||
ngx_http_finalize_request(r, r->access_code);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
r->phase_handler++;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_http_core_content_phase(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph)
|
||||
{
|
||||
ngx_int_t rc;
|
||||
ngx_str_t path;
|
||||
|
||||
if (r->content_handler) {
|
||||
r->write_event_handler = ngx_http_request_empty_handler;
|
||||
ngx_http_finalize_request(r, r->content_handler(r));
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"content phase: %ui", r->phase_handler);
|
||||
|
||||
rc = ph->handler(r);
|
||||
|
||||
if (rc == NGX_DONE) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
if (rc != NGX_DECLINED) {
|
||||
ngx_http_finalize_request(r, rc);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
/* rc == NGX_DECLINED */
|
||||
|
||||
ph++;
|
||||
|
||||
if (ph->checker) {
|
||||
r->phase_handler++;
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
/* no content handler was found */
|
||||
|
||||
if (r->uri.data[r->uri.len - 1] == '/' && !r->zero_in_uri) {
|
||||
|
||||
if (ngx_http_map_uri_to_path(r, &path, 0) != NULL) {
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"directory index of \"%V\" is forbidden", &path);
|
||||
}
|
||||
|
||||
ngx_http_finalize_request(r, NGX_HTTP_FORBIDDEN);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no handler found");
|
||||
|
||||
ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
@ -1916,7 +2014,7 @@ ngx_http_core_create_srv_conf(ngx_conf_t *cf)
|
|||
return NGX_CONF_ERROR;
|
||||
}
|
||||
|
||||
if (ngx_array_init(&cscf->server_names, cf->pool, 4,
|
||||
if (ngx_array_init(&cscf->server_names, cf->temp_pool, 4,
|
||||
sizeof(ngx_http_server_name_t))
|
||||
== NGX_ERROR)
|
||||
{
|
||||
|
|
|
@ -49,28 +49,48 @@ typedef enum {
|
|||
NGX_HTTP_POST_READ_PHASE = 0,
|
||||
|
||||
NGX_HTTP_SERVER_REWRITE_PHASE,
|
||||
|
||||
NGX_HTTP_FIND_CONFIG_PHASE,
|
||||
NGX_HTTP_REWRITE_PHASE,
|
||||
NGX_HTTP_POST_REWRITE_PHASE,
|
||||
|
||||
NGX_HTTP_PREACCESS_PHASE,
|
||||
|
||||
NGX_HTTP_ACCESS_PHASE,
|
||||
NGX_HTTP_POST_ACCESS_PHASE,
|
||||
|
||||
NGX_HTTP_CONTENT_PHASE,
|
||||
|
||||
NGX_HTTP_LOG_PHASE
|
||||
} ngx_http_phases;
|
||||
|
||||
typedef struct ngx_http_phase_handler_s ngx_http_phase_handler_t;
|
||||
|
||||
typedef ngx_int_t (*ngx_http_phase_handler_pt)(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph);
|
||||
|
||||
struct ngx_http_phase_handler_s {
|
||||
ngx_http_phase_handler_pt checker;
|
||||
ngx_http_handler_pt handler;
|
||||
ngx_uint_t next;
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_http_phase_handler_t *handlers;
|
||||
ngx_uint_t server_rewrite_index;
|
||||
} ngx_http_phase_engine_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_array_t handlers;
|
||||
ngx_int_t type; /* NGX_OK, NGX_DECLINED */
|
||||
} ngx_http_phase_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_array_t servers; /* ngx_http_core_srv_conf_t */
|
||||
|
||||
ngx_http_phase_t phases[NGX_HTTP_LOG_PHASE + 1];
|
||||
ngx_http_phase_engine_t phase_engine;
|
||||
|
||||
ngx_hash_t headers_in_hash;
|
||||
|
||||
|
@ -85,6 +105,8 @@ typedef struct {
|
|||
ngx_uint_t variables_hash_bucket_size;
|
||||
|
||||
ngx_hash_keys_arrays_t *variables_keys;
|
||||
|
||||
ngx_http_phase_t phases[NGX_HTTP_LOG_PHASE + 1];
|
||||
} ngx_http_core_main_conf_t;
|
||||
|
||||
|
||||
|
@ -262,7 +284,19 @@ struct ngx_http_core_loc_conf_s {
|
|||
};
|
||||
|
||||
|
||||
ngx_int_t ngx_http_find_location_config(ngx_http_request_t *r);
|
||||
void ngx_http_core_run_phases(ngx_http_request_t *r);
|
||||
ngx_int_t ngx_http_core_generic_phase(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph);
|
||||
ngx_int_t ngx_http_core_find_config_phase(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph);
|
||||
ngx_int_t ngx_http_core_post_rewrite_phase(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph);
|
||||
ngx_int_t ngx_http_core_access_phase(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph);
|
||||
ngx_int_t ngx_http_core_post_access_phase(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph);
|
||||
ngx_int_t ngx_http_core_content_phase(ngx_http_request_t *r,
|
||||
ngx_http_phase_handler_t *ph);
|
||||
|
||||
ngx_int_t ngx_http_set_content_type(ngx_http_request_t *r);
|
||||
ngx_int_t ngx_http_set_exten(ngx_http_request_t *r);
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#include <nginx.h>
|
||||
|
||||
|
||||
static ngx_int_t ngx_http_header_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_header_filter_init(ngx_conf_t *cf);
|
||||
static ngx_int_t ngx_http_header_filter(ngx_http_request_t *r);
|
||||
|
||||
|
||||
static ngx_http_module_t ngx_http_header_filter_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_header_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -35,7 +35,7 @@ ngx_module_t ngx_http_header_filter_module = {
|
|||
NULL, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_header_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -152,8 +152,8 @@ ngx_http_header_filter(ngx_http_request_t *r)
|
|||
{
|
||||
u_char *p;
|
||||
size_t len;
|
||||
ngx_uint_t status, i;
|
||||
ngx_buf_t *b;
|
||||
ngx_uint_t status, i;
|
||||
ngx_chain_t out;
|
||||
ngx_list_part_t *part;
|
||||
ngx_table_elt_t *header;
|
||||
|
@ -533,7 +533,7 @@ ngx_http_header_filter(ngx_http_request_t *r)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_header_filter_init(ngx_cycle_t *cycle)
|
||||
ngx_http_header_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_top_header_filter = ngx_http_header_filter;
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
|
||||
static ngx_int_t
|
||||
ngx_http_postpone_filter_output_postponed_request(ngx_http_request_t *r);
|
||||
static ngx_int_t ngx_http_postpone_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_postpone_filter_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_http_module_t ngx_http_postpone_filter_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_postpone_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -35,7 +35,7 @@ ngx_module_t ngx_http_postpone_filter_module = {
|
|||
NULL, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_postpone_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -219,7 +219,7 @@ ngx_http_postpone_filter_output_postponed_request(ngx_http_request_t *r)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_postpone_filter_init(ngx_cycle_t *cycle)
|
||||
ngx_http_postpone_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_next_filter = ngx_http_top_body_filter;
|
||||
ngx_http_top_body_filter = ngx_http_postpone_filter;
|
||||
|
|
|
@ -140,6 +140,9 @@ ngx_http_header_t ngx_http_headers_in[] = {
|
|||
|
||||
{ ngx_string("Destination"), offsetof(ngx_http_headers_in_t, destination),
|
||||
ngx_http_process_header_line },
|
||||
|
||||
{ ngx_string("Date"), offsetof(ngx_http_headers_in_t, date),
|
||||
ngx_http_process_header_line },
|
||||
#endif
|
||||
|
||||
{ ngx_string("Cookie"), 0, ngx_http_process_cookie },
|
||||
|
@ -933,9 +936,11 @@ ngx_http_read_request_header(ngx_http_request_t *r)
|
|||
{
|
||||
ssize_t n;
|
||||
ngx_event_t *rev;
|
||||
ngx_connection_t *c;
|
||||
ngx_http_core_srv_conf_t *cscf;
|
||||
|
||||
rev = r->connection->read;
|
||||
c = r->connection;
|
||||
rev = c->read;
|
||||
|
||||
n = r->header_in->last - r->header_in->pos;
|
||||
|
||||
|
@ -944,8 +949,8 @@ ngx_http_read_request_header(ngx_http_request_t *r)
|
|||
}
|
||||
|
||||
if (rev->ready) {
|
||||
n = r->connection->recv(r->connection, r->header_in->last,
|
||||
r->header_in->end - r->header_in->last);
|
||||
n = c->recv(c, r->header_in->last,
|
||||
r->header_in->end - r->header_in->last);
|
||||
} else {
|
||||
n = NGX_AGAIN;
|
||||
}
|
||||
|
@ -966,11 +971,14 @@ ngx_http_read_request_header(ngx_http_request_t *r)
|
|||
}
|
||||
|
||||
if (n == 0) {
|
||||
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
||||
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
||||
"client closed prematurely connection");
|
||||
}
|
||||
|
||||
if (n == 0 || n == NGX_ERROR) {
|
||||
c->error = rev->error;
|
||||
c->log->action = "sending response to client";
|
||||
|
||||
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
@ -1155,8 +1163,9 @@ ngx_http_process_unique_header_line(ngx_http_request_t *r, ngx_table_elt_t *h,
|
|||
}
|
||||
|
||||
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
||||
"client sent duplicate header line: \"%V: %V\"",
|
||||
&h->key, &h->value);
|
||||
"client sent duplicate header line: \"%V: %V\", "
|
||||
"previous value: \"%V: %V\"",
|
||||
&h->key, &h->value, &(*ph)->key, &(*ph)->value);
|
||||
|
||||
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
||||
|
||||
|
@ -1460,6 +1469,13 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
|||
"http finalize request: %d, \"%V?%V\"",
|
||||
rc, &r->uri, &r->args);
|
||||
|
||||
if (rc == NGX_DECLINED) {
|
||||
r->content_handler = NULL;
|
||||
r->write_event_handler = ngx_http_core_run_phases;
|
||||
ngx_http_core_run_phases(r);
|
||||
return;
|
||||
}
|
||||
|
||||
if (r != r->main
|
||||
&& rc != NGX_ERROR
|
||||
&& !r->connection->error
|
||||
|
|
|
@ -184,6 +184,7 @@ typedef struct {
|
|||
#if (NGX_HTTP_DAV)
|
||||
ngx_table_elt_t *depth;
|
||||
ngx_table_elt_t *destination;
|
||||
ngx_table_elt_t *date;
|
||||
#endif
|
||||
|
||||
ngx_str_t user;
|
||||
|
@ -352,7 +353,6 @@ struct ngx_http_request_s {
|
|||
ngx_str_t server_name;
|
||||
ngx_http_virtual_names_t *virtual_names;
|
||||
|
||||
ngx_uint_t phase;
|
||||
ngx_int_t phase_handler;
|
||||
ngx_http_handler_pt content_handler;
|
||||
ngx_uint_t access_code;
|
||||
|
|
|
@ -417,12 +417,12 @@ ngx_http_discard_body(ngx_http_request_t *r)
|
|||
ngx_del_timer(rev);
|
||||
}
|
||||
|
||||
r->discard_body = 1;
|
||||
|
||||
if (r->headers_in.content_length_n <= 0) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
r->discard_body = 1;
|
||||
|
||||
size = r->header_in->last - r->header_in->pos;
|
||||
|
||||
if (size) {
|
||||
|
|
|
@ -307,7 +307,7 @@ ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error)
|
|||
ngx_int_t rc;
|
||||
ngx_buf_t *b;
|
||||
ngx_str_t *uri, *location;
|
||||
ngx_uint_t i, err, msie_padding;
|
||||
ngx_uint_t i, n, err, msie_padding;
|
||||
ngx_chain_t *out, *cl;
|
||||
ngx_http_err_page_t *err_page;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
|
@ -375,8 +375,23 @@ ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error)
|
|||
{
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (r->zero_in_uri) {
|
||||
for (n = 0; n < uri->len; n++) {
|
||||
if (uri->data[n] == '\0') {
|
||||
goto zero;
|
||||
}
|
||||
}
|
||||
|
||||
r->zero_in_uri = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
r->zero_in_uri = 0;
|
||||
}
|
||||
|
||||
zero:
|
||||
|
||||
if (uri->data[0] == '/') {
|
||||
return ngx_http_internal_redirect(r, uri, NULL);
|
||||
}
|
||||
|
|
|
@ -1134,11 +1134,11 @@ ngx_http_upstream_process_header(ngx_event_t *rev)
|
|||
}
|
||||
}
|
||||
|
||||
umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
|
||||
|
||||
if (r->upstream->headers_in.x_accel_redirect) {
|
||||
ngx_http_upstream_finalize_request(r, u, NGX_DECLINED);
|
||||
|
||||
umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
|
||||
|
||||
part = &r->upstream->headers_in.headers.part;
|
||||
h = part->elts;
|
||||
|
||||
|
@ -1188,29 +1188,6 @@ ngx_http_upstream_process_header(ngx_event_t *rev)
|
|||
return;
|
||||
}
|
||||
|
||||
ngx_http_upstream_send_response(r, u);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
||||
{
|
||||
int tcp_nodelay;
|
||||
ssize_t size;
|
||||
ngx_int_t rc;
|
||||
ngx_uint_t i;
|
||||
ngx_list_part_t *part;
|
||||
ngx_table_elt_t *h;
|
||||
ngx_event_pipe_t *p;
|
||||
ngx_connection_t *c;
|
||||
ngx_pool_cleanup_t *cl;
|
||||
ngx_pool_cleanup_file_t *clf;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
ngx_http_upstream_header_t *hh;
|
||||
ngx_http_upstream_main_conf_t *umcf;
|
||||
|
||||
umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
|
||||
|
||||
part = &r->upstream->headers_in.headers.part;
|
||||
h = part->elts;
|
||||
|
||||
|
@ -1270,6 +1247,22 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||
u->length = NGX_MAX_SIZE_T_VALUE;
|
||||
}
|
||||
|
||||
ngx_http_upstream_send_response(r, u);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
||||
{
|
||||
int tcp_nodelay;
|
||||
ssize_t size;
|
||||
ngx_int_t rc;
|
||||
ngx_event_pipe_t *p;
|
||||
ngx_connection_t *c;
|
||||
ngx_pool_cleanup_t *cl;
|
||||
ngx_pool_cleanup_file_t *clf;
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
|
||||
rc = ngx_http_send_header(r);
|
||||
|
||||
if (rc == NGX_ERROR || rc > NGX_OK || r->post_action) {
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#include <ngx_http.h>
|
||||
|
||||
|
||||
static ngx_int_t ngx_http_write_filter_init(ngx_cycle_t *cycle);
|
||||
static ngx_int_t ngx_http_write_filter_init(ngx_conf_t *cf);
|
||||
|
||||
|
||||
static ngx_http_module_t ngx_http_write_filter_module_ctx = {
|
||||
NULL, /* preconfiguration */
|
||||
NULL, /* postconfiguration */
|
||||
ngx_http_write_filter_init, /* postconfiguration */
|
||||
|
||||
NULL, /* create main configuration */
|
||||
NULL, /* init main configuration */
|
||||
|
@ -34,7 +34,7 @@ ngx_module_t ngx_http_write_filter_module = {
|
|||
NULL, /* module directives */
|
||||
NGX_HTTP_MODULE, /* module type */
|
||||
NULL, /* init master */
|
||||
ngx_http_write_filter_init, /* init module */
|
||||
NULL, /* init module */
|
||||
NULL, /* init process */
|
||||
NULL, /* init thread */
|
||||
NULL, /* exit thread */
|
||||
|
@ -271,7 +271,7 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_write_filter_init(ngx_cycle_t *cycle)
|
||||
ngx_http_write_filter_init(ngx_conf_t *cf)
|
||||
{
|
||||
ngx_http_top_body_filter = ngx_http_write_filter;
|
||||
|
||||
|
|
|
@ -220,6 +220,24 @@ ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset,
|
|||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s)
|
||||
{
|
||||
struct timeval tv[2];
|
||||
|
||||
tv[0].tv_sec = s;
|
||||
tv[0].tv_usec = 0;
|
||||
tv[1].tv_sec = s;
|
||||
tv[1].tv_usec = 0;
|
||||
|
||||
if (utimes((char *) name, tv) != -1) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir)
|
||||
{
|
||||
|
|
|
@ -58,11 +58,15 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce,
|
|||
|
||||
|
||||
#define ngx_rename_file(o, n) rename((const char *) o, (const char *) n)
|
||||
#define ngx_rename_file_n "rename"
|
||||
#define ngx_rename_file_n "rename()"
|
||||
|
||||
|
||||
#define ngx_change_file_access(n, a) chmod((const char *) n, a)
|
||||
#define ngx_change_file_access_n "chmod"
|
||||
#define ngx_change_file_access_n "chmod()"
|
||||
|
||||
|
||||
ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s);
|
||||
#define ngx_set_file_time_n "utimes()"
|
||||
|
||||
|
||||
#define ngx_file_info(file, sb) stat((const char *) file, sb)
|
||||
|
|
24
src/os/win32/nginx_icon16.xpm
Normal file
24
src/os/win32/nginx_icon16.xpm
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* XPM */
|
||||
static char * nginx_xpm[] = {
|
||||
"16 16 2 2",
|
||||
/* colors */
|
||||
" c none",
|
||||
"GG c #009900",
|
||||
/* pixels */
|
||||
" ",
|
||||
" GGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGG GGGGGG ",
|
||||
" GGGGGG GGGGGG ",
|
||||
" GGGGGG ",
|
||||
" GGGGGG GGGGGGGGGGGGGGGG ",
|
||||
" GGGGGG GGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGG GGGGGGGGGGGGGG ",
|
||||
" GGGGGG GGGGGG ",
|
||||
" GGGGGG GGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGG ",
|
||||
" "
|
||||
};
|
39
src/os/win32/nginx_icon32.xpm
Normal file
39
src/os/win32/nginx_icon32.xpm
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* XPM */
|
||||
static char * nginx_xpm[] = {
|
||||
"32 32 2 2",
|
||||
/* colors */
|
||||
" c none",
|
||||
"GG c #009900",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" GGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGG ",
|
||||
" GGGGGGGGGG ",
|
||||
" GGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGG ",
|
||||
" GGGGGGGGGG GGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGGGGGGGGGG ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "
|
24
src/os/win32/nginx_tray.xpm
Normal file
24
src/os/win32/nginx_tray.xpm
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* XPM */
|
||||
static char * nginx_xpm[] = {
|
||||
"16 16 2 2",
|
||||
/* colors */
|
||||
" c none",
|
||||
"GG c #008000",
|
||||
/* pixels */
|
||||
" ",
|
||||
" GGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGG GGGGGG ",
|
||||
" GGGGGG GGGGGG ",
|
||||
" GGGGGG ",
|
||||
" GGGGGG GGGGGGGGGGGGGGGG ",
|
||||
" GGGGGG GGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGG GGGGGGGGGGGGGG ",
|
||||
" GGGGGG GGGGGG ",
|
||||
" GGGGGG GGGGGG ",
|
||||
" GGGGGGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGG ",
|
||||
" GGGGGGGGGGGGGGGG ",
|
||||
" "
|
||||
};
|
|
@ -260,6 +260,27 @@ ngx_file_info(char *file, ngx_file_info_t *sb)
|
|||
#endif
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s)
|
||||
{
|
||||
uint64_t intervals;
|
||||
FILETIME ft;
|
||||
|
||||
/* 116444736000000000 is commented in src/os/win32/ngx_time.c */
|
||||
|
||||
intervals = s * 10000000 + 116444736000000000;
|
||||
|
||||
ft.dwLowDateTime = (DWORD) intervals;
|
||||
ft.dwHighDateTime = (DWORD) (intervals >> 32);
|
||||
|
||||
if (SetFileTime(fd, NULL, NULL, &ft) != 0) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_file_info(u_char *file, ngx_file_info_t *sb)
|
||||
{
|
||||
|
@ -301,11 +322,11 @@ ngx_read_dir(ngx_dir_t *dir)
|
|||
return NGX_OK;
|
||||
}
|
||||
|
||||
if (FindNextFile(dir->dir, &dir->fd) == 0) {
|
||||
return NGX_ERROR;
|
||||
if (FindNextFile(dir->dir, &dir->fd) != 0) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
return NGX_OK;
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -80,12 +80,17 @@ ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to,
|
|||
ngx_pool_t *pool);
|
||||
|
||||
|
||||
|
||||
ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s);
|
||||
#define ngx_set_file_time_n "SetFileTime()"
|
||||
|
||||
|
||||
ngx_int_t ngx_file_info(u_char *filename, ngx_file_info_t *fi);
|
||||
#define ngx_file_info_n "GetFileAttributesEx()"
|
||||
|
||||
|
||||
#define ngx_fd_info(fd, fi) GetFileInformationByHandle(fd, fi)
|
||||
#define ngx_fd_info_n "GetFileInformationByHandle"
|
||||
#define ngx_fd_info_n "GetFileInformationByHandle()"
|
||||
|
||||
|
||||
#define ngx_is_dir(fi) ((fi)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
|
|
Loading…
Reference in a new issue