mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
8faebfd44f | |||
655bf32451 | |||
cef05fbb4b | |||
85b5caf105 | |||
01a7c536a3 | |||
65237ea02f | |||
6a805a1e28 | |||
51fff05213 | |||
772dc15121 | |||
4a24efa64f | |||
c885306e32 | |||
dcc95a3b33 | |||
4367838ae4 | |||
4b236d13b0 | |||
b7ffa0d0e5 | |||
93a68930aa | |||
abc99a3610 | |||
e5d8803af6 | |||
c21b63ea3f | |||
e17fa45a12 | |||
c1d79abf0e | |||
0a1195e7a9 | |||
0409ce05b8 | |||
14167b6890 | |||
ecc5816593 | |||
1aae4c3350 | |||
d5fb61765f | |||
fdfd34ccfd | |||
db1a5fce34 |
233
FreeBSD/www/openresty/Makefile
Normal file
233
FreeBSD/www/openresty/Makefile
Normal file
@ -0,0 +1,233 @@
|
||||
# New ports collection makefile for: openresty
|
||||
# Date created: 2012-08-07
|
||||
# Whom: Gvozdikov Veniamin <g.veniamin@googlemail.com>
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= openresty
|
||||
PORTVERSION= 1.2.1.11
|
||||
CATEGORIES= www
|
||||
MASTER_SITES= http://agentzh.org/misc/nginx/
|
||||
DISTNAME= ngx_${PORTNAME}-${PORTVERSION}
|
||||
|
||||
MAINTAINER= g.veniamin@googlemail.com
|
||||
COMMENT= OpenResty a powerful web app server by extending nginx
|
||||
|
||||
LICENSE= BSD
|
||||
|
||||
LIB_DEPENDS= pcre:${PORTSDIR}/devel/pcre
|
||||
|
||||
HAS_CONFIGURE= yes
|
||||
USE_GMAKE= yes
|
||||
USE_PERL5= yes
|
||||
|
||||
CONFIGURE_ARGS= --prefix=${PREFIX}\
|
||||
--with-cc-opt="-I ${LOCALBASE}/include" \
|
||||
--with-ld-opt="-L ${LOCALBASE}/lib" \
|
||||
--user=${WWWOWN} --group=${WWWGRP}
|
||||
|
||||
OPTIONS_DEFINE= LUACJSON LUAREDISPARS LUARDS LUARESTYDNS LUARESTYMEM \
|
||||
LUARESTYREDIS LUARESTYMYSQL LUARESTYUPLOAD LUARESTYSTRING \
|
||||
ECHO XSS COOLKIT MISC ENCSESSION HEADERSMORE SRCACHE \
|
||||
ARRAYVAR MEMC REDIS REDIS2 AUTHREQ RDSJSON RDSCVS \
|
||||
ICONV NDK DRIZZLE POSTGRES
|
||||
OPTIONS_SINGLE= GLUA
|
||||
OPTIONS_SINGLE_GLUA= LUA LUAJIT DLUA
|
||||
|
||||
LUACJSON_DESC= Lua cjson library
|
||||
LUAREDISPARS_DESC= Lua redis parser library
|
||||
LUARDS_DESC= Lua rds library
|
||||
LUARESTYDNS_DESC= Lua resty dns library
|
||||
LUARESTYMEM_DESC= Lua resty memcached library
|
||||
LUARESTYREDIS_DESC= Lua resty redis library
|
||||
LUARESTYMYSQL_DESC= Lua resty mysql library
|
||||
LUARESTYUPLOAD_DESC= Lua resty upload library
|
||||
LUARESTYSTRING_DESC= Lua resty string library
|
||||
|
||||
ECHO_DESC= Brings echo/sleep/time and more shell-style
|
||||
XSS_DESC= Native cross-site scripting support in nginx
|
||||
COOLKIT_DESC= Collection of small and useful nginx add-ons
|
||||
MISC_DESC= Various set_xxx directives added
|
||||
ENCSESSION_DESC= Encrypt and decrypt nginx variable values
|
||||
HEADERSMORE_DESC= Set and clear input and output headers
|
||||
SRCACHE_DESC= Transparent subrequest-based caching layout
|
||||
ARRAYVAR_DESC= Add support for array variables to config
|
||||
MEMC_DESC= An extended memcached module
|
||||
REDIS_DESC= HTTP redis module
|
||||
REDIS2_DESC= Module for the Redis 2.0 protocol
|
||||
AUTHREQ_DESC= Auth request module
|
||||
RDSJSON_DESC= An output filter that formats Resty
|
||||
RDSCVS_DESC= Output filter module to convert CVS
|
||||
NDK_DESC= Nginx Development Kit
|
||||
ICONV_DESC= Iconv support
|
||||
DRIZZLE_DESC= Module for talking to MySQL and Drizzle
|
||||
POSTGRES_DESC= Module for talking to Postgeres
|
||||
|
||||
DLUA_DESC= Disable Lua
|
||||
LUA_DESC= Use LUA 5.1
|
||||
LUAJIT_DESC= Use LuaJIT 2.0
|
||||
|
||||
OPTIONS_DEFAULT= MISC XSS ECHO COOLKIT ENCSESSION HEADERMORE LUA \
|
||||
SRCACHE ARRAYVAR MEMC REDIS REDIS2 AUTHREQ RDSJSON \
|
||||
RDSCVS NDK ICONV PORTGRES
|
||||
|
||||
.include <bsd.port.options.mk>
|
||||
|
||||
.if empty(${PORT_OPTIONS:MAUTHREQ})
|
||||
CONFIGURE_ARGS+= --without-http_auth_request_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MRDSJSON})
|
||||
CONFIGURE_ARGS+= --without-http_rds_json_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MRDSCVS})
|
||||
CONFIGURE_ARGS+= --without-http_rds_csv_module
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MICONV}
|
||||
CONFIGURE_ARGS+= --with-http_iconv_module
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MNDK}
|
||||
.else
|
||||
CONFIGURE_ARGS+= --without-ngx_devel_kit_module
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MDRIZZLE}
|
||||
CONFIGURE_ARGS+= --with-http_drizzle_module \
|
||||
--with-libdrizzle=${LOCALBASE}
|
||||
LIB_DEPENDS+= drizzle:${PORTSDIR}/databases/libdrizzle
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MPOSTGRES}
|
||||
CONFIGURE_ARGS+= --with-http_postgres_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MREDIS})
|
||||
CONFIGURE_ARGS+= --without-http_redis_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MREDIS2})
|
||||
CONFIGURE_ARGS+= --without-http_redis2_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MMEMC})
|
||||
CONFIGURE_ARGS+= --without-http_memc_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MARRAYVAR})
|
||||
CONFIGURE_ARGS+= --without-http_array_var_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MSRCACHE})
|
||||
CONFIGURE_ARGS+= --without-http_srcache_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MENCSESSION})
|
||||
CONFIGURE_ARGS+= --without-http_encrypted_session_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MHEADERSMORE})
|
||||
CONFIGURE_ARGS+= --without-http_headers_more_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MMISC})
|
||||
CONFIGURE_ARGS+= --without-http_set_misc_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MXSS})
|
||||
CONFIGURE_ARGS+= --without-http_xss_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MCOOLKIT})
|
||||
CONFIGURE_ARGS+= --without-http_coolkit_module
|
||||
.endif
|
||||
|
||||
.if empty(${PORT_OPTIONS:MECHO})
|
||||
CONFIGURE_ARGS+= --without-http_echo_module
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUAJIT}
|
||||
CONFIGURE_ARGS+= --with-luajit
|
||||
PLIST_SUB+= LUAJIT=""
|
||||
.else
|
||||
PLIST_SUB+= LUAJIT="@comment "
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUA}
|
||||
PLIST_SUB+= LUA=""
|
||||
.else
|
||||
CONFIGURE_ARGS+= --without-lua51
|
||||
PLIST_SUB+= LUA="@comment "
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MDLUA}
|
||||
CONFIGURE_ARGS+= --without-http_lua_module
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUACJSON}
|
||||
PLIST_SUB+= LUACJSON=""
|
||||
.else
|
||||
CONFIGURE_ARGS+= --without-lua_cjson
|
||||
PLIST_SUB+= LUACJSON="@comment "
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUAREDISPARS}
|
||||
PLIST_SUB+= LUAREDISPARS=""
|
||||
.else
|
||||
CONFIGURE_ARGS+= --without-lua_redis_parser
|
||||
PLIST_SUB+= LUAREDISPARS="@comment "
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUARDS}
|
||||
PLIST_SUB+= LUARDS=""
|
||||
.else
|
||||
CONFIGURE_ARGS+= --without-lua_rds_parser
|
||||
PLIST_SUB+= LUARDS="@comment "
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUARESTYDNS}
|
||||
PLIST_SUB+= LUARESTYDNS=""
|
||||
.else
|
||||
PLIST_SUB+= LUARESTYDNS="@comment "
|
||||
CONFIGURE_ARGS+= --without-lua_resty_dns
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUARESTYMEM}
|
||||
PLIST_SUB+= LUARESTYMEM=""
|
||||
.else
|
||||
PLIST_SUB+= LUARESTYMEM="@comment "
|
||||
CONFIGURE_ARGS+= --without-lua_resty_memcached
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUARESTYREDIS}
|
||||
PLIST_SUB+= LUARESTYREDIS=""
|
||||
.else
|
||||
CONFIGURE_ARGS+= --without-lua_resty_redis
|
||||
PLIST_SUB+= LUARESTYREDIS="@comment "
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUARESTYMYSQL}
|
||||
PLIST_SUB+= LUARESTYMYSQL=""
|
||||
.else
|
||||
CONFIGURE_ARGS+= --without-lua_resty_mysql
|
||||
PLIST_SUB+= LUARESTYMYSQL="@comment "
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUARESTYUPLOAD}
|
||||
PLIST_SUB+= LUARESTYUPLOAD=""
|
||||
.else
|
||||
CONFIGURE_ARGS+= --without-lua_resty_upload
|
||||
PLIST_SUB+= LUARESTYUPLOAD="@comment "
|
||||
.endif
|
||||
|
||||
.if ${PORT_OPTIONS:MLUARESTYSTRING}
|
||||
PLIST_SUB+= LUARESTYSTRING=""
|
||||
.else
|
||||
CONFIGURE_ARGS+= --without-lua_resty_string
|
||||
PLIST_SUB+= LUARESTYSTRING="@comment "
|
||||
.endif
|
||||
|
||||
.include <bsd.port.mk>
|
2
FreeBSD/www/openresty/distinfo
Normal file
2
FreeBSD/www/openresty/distinfo
Normal file
@ -0,0 +1,2 @@
|
||||
SHA256 (ngx_openresty-1.2.1.11.tar.gz) = 212c3ba07d94b17fcbd4d60054bd8457fa18de3264381e8449074c78aa05f9f5
|
||||
SIZE (ngx_openresty-1.2.1.11.tar.gz) = 2950664
|
@ -0,0 +1,36 @@
|
||||
--- bundle/LuaJIT-2.0.0-beta10/Makefile.orig 2012-05-09 20:00:00.000000000 +0400
|
||||
+++ bundle/LuaJIT-2.0.0-beta10/Makefile 2012-08-07 23:26:28.853477336 +0400
|
||||
@@ -38,8 +38,6 @@
|
||||
INSTALL_JITLIB= $(INSTALL_SHARE)/luajit-$(VERSION)/jit
|
||||
INSTALL_LMOD= $(INSTALL_SHARE)/lua/$(ABIVER)
|
||||
INSTALL_CMOD= $(INSTALL_LIB)/lua/$(ABIVER)
|
||||
-INSTALL_MAN= $(INSTALL_SHARE)/man/man1
|
||||
-INSTALL_PKGCONFIG= $(INSTALL_LIB)/pkgconfig
|
||||
|
||||
INSTALL_TNAME= luajit-$(VERSION)
|
||||
INSTALL_TSYMNAME= luajit
|
||||
@@ -59,7 +57,7 @@
|
||||
INSTALL_TSYM= $(INSTALL_BIN)/$(INSTALL_TSYMNAME)
|
||||
INSTALL_PC= $(INSTALL_PKGCONFIG)/$(INSTALL_PCNAME)
|
||||
|
||||
-INSTALL_DIRS= $(INSTALL_BIN) $(INSTALL_LIB) $(INSTALL_INC) $(INSTALL_MAN) \
|
||||
+INSTALL_DIRS= $(INSTALL_BIN) $(INSTALL_LIB) $(INSTALL_INC) \
|
||||
$(INSTALL_PKGCONFIG) $(INSTALL_JITLIB) $(INSTALL_LMOD) $(INSTALL_CMOD)
|
||||
|
||||
RM= rm -f
|
||||
@@ -73,7 +71,6 @@
|
||||
FILE_T= luajit
|
||||
FILE_A= libluajit.a
|
||||
FILE_SO= libluajit.so
|
||||
-FILE_MAN= luajit.1
|
||||
FILE_PC= luajit.pc
|
||||
FILES_INC= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h
|
||||
FILES_JITLIB= bc.lua v.lua dump.lua dis_x86.lua dis_x64.lua dis_arm.lua \
|
||||
@@ -108,7 +105,6 @@
|
||||
$(LDCONFIG) $(INSTALL_LIB) && \
|
||||
$(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
|
||||
$(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || :
|
||||
- cd etc && $(INSTALL_F) $(FILE_MAN) $(INSTALL_MAN)
|
||||
cd etc && $(SED_PC) $(FILE_PC) > $(FILE_PC).tmp && \
|
||||
$(INSTALL_F) $(FILE_PC).tmp $(INSTALL_PC) && \
|
||||
$(RM) $(FILE_PC).tmp
|
@ -0,0 +1,47 @@
|
||||
--- bundle/lua-5.1.5/Makefile.orig 2012-08-07 14:56:49.606517458 +0400
|
||||
+++ bundle/lua-5.1.5/Makefile 2012-08-07 14:57:31.325545994 +0400
|
||||
@@ -13,7 +13,6 @@
|
||||
INSTALL_BIN= $(INSTALL_TOP)/bin
|
||||
INSTALL_INC= $(INSTALL_TOP)/include
|
||||
INSTALL_LIB= $(INSTALL_TOP)/lib
|
||||
-INSTALL_MAN= $(INSTALL_TOP)/man/man1
|
||||
#
|
||||
# You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with
|
||||
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc).
|
||||
@@ -44,7 +43,6 @@
|
||||
TO_BIN= lua luac
|
||||
TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
|
||||
TO_LIB= liblua.a
|
||||
-TO_MAN= lua.1 luac.1
|
||||
|
||||
# Lua version and release.
|
||||
V= 5.1
|
||||
@@ -59,11 +57,10 @@
|
||||
src/lua test/hello.lua
|
||||
|
||||
install: dummy
|
||||
- cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
|
||||
+ cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_LMOD) $(INSTALL_CMOD)
|
||||
cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
|
||||
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
|
||||
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
|
||||
- cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
|
||||
|
||||
ranlib:
|
||||
cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)
|
||||
@@ -95,7 +92,6 @@
|
||||
@echo "INSTALL_BIN = $(INSTALL_BIN)"
|
||||
@echo "INSTALL_INC = $(INSTALL_INC)"
|
||||
@echo "INSTALL_LIB = $(INSTALL_LIB)"
|
||||
- @echo "INSTALL_MAN = $(INSTALL_MAN)"
|
||||
@echo "INSTALL_LMOD = $(INSTALL_LMOD)"
|
||||
@echo "INSTALL_CMOD = $(INSTALL_CMOD)"
|
||||
@echo "INSTALL_EXEC = $(INSTALL_EXEC)"
|
||||
@@ -111,7 +107,6 @@
|
||||
@echo "TO_BIN = $(TO_BIN)"
|
||||
@echo "TO_INC = $(TO_INC)"
|
||||
@echo "TO_LIB = $(TO_LIB)"
|
||||
- @echo "TO_MAN = $(TO_MAN)"
|
||||
|
||||
# echo config parameters as Lua code
|
||||
# uncomment the last sed expression if you want nil instead of empty strings
|
12
FreeBSD/www/openresty/files/patch-configure
Normal file
12
FreeBSD/www/openresty/files/patch-configure
Normal file
@ -0,0 +1,12 @@
|
||||
--- configure.orig 2012-08-08 11:10:58.575960219 +0400
|
||||
+++ configure 2012-08-08 11:11:38.950486311 +0400
|
||||
@@ -157,6 +157,9 @@
|
||||
} elsif ($opt eq '--without-lua_redis_parser') {
|
||||
$resty_opts{no_lua_redis_parser} = 1;
|
||||
|
||||
+ } elsif ($opt eq '--without-lua_resty_dns') {
|
||||
+ $resty_opts{no_lua_resty_dns} = 1;
|
||||
+
|
||||
} elsif ($opt eq '--without-lua_resty_memcached') {
|
||||
$resty_opts{no_lua_resty_memcached} = 1;
|
||||
|
6
FreeBSD/www/openresty/pkg-descr
Normal file
6
FreeBSD/www/openresty/pkg-descr
Normal file
@ -0,0 +1,6 @@
|
||||
ngx_openresty is a full-fledged web application server by bundling
|
||||
the standard nginx core, lots of 3rd-party nginx modules, as well
|
||||
as most of their external dependencies.
|
||||
|
||||
|
||||
WWW: http://openresty.org
|
95
FreeBSD/www/openresty/pkg-plist
Normal file
95
FreeBSD/www/openresty/pkg-plist
Normal file
@ -0,0 +1,95 @@
|
||||
%%LUA%%lua/bin/luac
|
||||
%%LUA%%lua/bin/lua
|
||||
%%LUA%%lua/lib/liblua.a
|
||||
%%LUA%%lua/include/luaconf.h
|
||||
%%LUA%%lua/include/lauxlib.h
|
||||
%%LUA%%lua/include/lua.h
|
||||
%%LUA%%lua/include/lua.hpp
|
||||
%%LUA%%lua/include/lualib.h
|
||||
%%LUAJIT%%luajit/include/luajit-2.0/luaconf.h
|
||||
%%LUAJIT%%luajit/include/luajit-2.0/lua.hpp
|
||||
%%LUAJIT%%luajit/include/luajit-2.0/lualib.h
|
||||
%%LUAJIT%%luajit/include/luajit-2.0/luajit.h
|
||||
%%LUAJIT%%luajit/include/luajit-2.0/lauxlib.h
|
||||
%%LUAJIT%%luajit/include/luajit-2.0/lua.h
|
||||
%%LUAJIT%%luajit/lib/libluajit-5.1.a
|
||||
%%LUAJIT%%luajit/lib/libluajit-5.1.so.2.0.0
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/dump.lua
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/dis_mipsel.lua
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/bc.lua
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/dis_mips.lua
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/dis_x64.lua
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/v.lua
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/dis_ppc.lua
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/dis_arm.lua
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/vmdef.lua
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/dis_x86.lua
|
||||
%%LUAJIT%%luajit/share/luajit-2.0.0-beta10/jit/bcsave.lua
|
||||
%%LUAJIT%%luajit/bin/luajit-2.0.0-beta10
|
||||
nginx/html/index.html
|
||||
nginx/html/50x.html
|
||||
nginx/conf/koi-win
|
||||
nginx/conf/koi-utf
|
||||
nginx/conf/fastcgi_params
|
||||
nginx/conf/nginx.conf.default
|
||||
nginx/conf/fastcgi.conf
|
||||
nginx/conf/win-utf
|
||||
nginx/conf/fastcgi.conf.default
|
||||
nginx/conf/scgi_params
|
||||
nginx/conf/uwsgi_params
|
||||
nginx/conf/mime.types
|
||||
nginx/conf/scgi_params.default
|
||||
nginx/conf/nginx.conf
|
||||
nginx/conf/uwsgi_params.default
|
||||
nginx/conf/mime.types.default
|
||||
nginx/conf/fastcgi_params.default
|
||||
nginx/sbin/nginx
|
||||
%%LUARESTYDNS%%lualib/resty/dns/resolver.lua
|
||||
%%LUARESTYUPLOAD%%lualib/resty/upload.lua
|
||||
%%LUARESTYSTRING%%lualib/resty/sha1.lua
|
||||
%%LUARESTYSTRING%%lualib/resty/random.lua
|
||||
%%LUARESTYSTRING%%lualib/resty/md5.lua
|
||||
%%LUARESTYSTRING%%lualib/resty/aes.lua
|
||||
%%LUARESTYSTRING%%lualib/resty/sha384.lua
|
||||
%%LUARESTYMYSQL%%lualib/resty/mysql.lua
|
||||
%%LUARESTYMEM%%lualib/resty/memcached.lua
|
||||
%%LUARESTYREDIS%%lualib/resty/redis.lua
|
||||
%%LUARESTYSTRING%%lualib/resty/sha512.lua
|
||||
%%LUARESTYSTRING%%lualib/resty/sha256.lua
|
||||
%%LUARESTYSTRING%%lualib/resty/string.lua
|
||||
%%LUARESTYSTRING%%lualib/resty/sha224.lua
|
||||
%%LUARESTYSTRING%%lualib/resty/sha.lua
|
||||
%%LUARDS%%lualib/rds/parser.so
|
||||
%%LUACJSON%%lualib/cjson.so
|
||||
%%LUAREDISPARS%%lualib/redis/parser.so
|
||||
@dirrmtry nginx/sbin
|
||||
@dirrmtry nginx/logs
|
||||
@dirrmtry nginx/html
|
||||
@dirrmtry nginx/conf
|
||||
@dirrmtry nginx
|
||||
%%LUARESTYDNS%%@dirrm lualib/resty/dns
|
||||
@dirrmtry lualib/resty
|
||||
%%LUAREDISPARS%%@dirrmtry lualib/redis
|
||||
%%LUARDS%%@dirrmtry lualib/rds
|
||||
@dirrmtry lualib
|
||||
%%LUA%%@dirrm lua/share/lua/5.1
|
||||
%%LUA%%@dirrm lua/share/lua
|
||||
%%LUA%%@dirrm lua/share
|
||||
%%LUA%%@dirrm lua/lib/lua/5.1
|
||||
%%LUA%%@dirrm lua/lib/lua
|
||||
%%LUA%%@dirrm lua/lib
|
||||
%%LUA%%@dirrm lua/include
|
||||
%%LUA%%@dirrm lua/bin
|
||||
%%LUA%%@dirrm lua
|
||||
%%LUAJIT%%@dirrm luajit/share/luajit-2.0.0-beta10/jit
|
||||
%%LUAJIT%%@dirrm luajit/share/luajit-2.0.0-beta10
|
||||
%%LUAJIT%%@dirrm luajit/include/luajit-2.0
|
||||
%%LUAJIT%%@dirrm luajit/include
|
||||
%%LUAJIT%%@dirrm luajit/share/lua/5.1
|
||||
%%LUAJIT%%@dirrm luajit/share/lua
|
||||
%%LUAJIT%%@dirrm luajit/share
|
||||
%%LUAJIT%%@dirrm luajit/lib/lua/5.1
|
||||
%%LUAJIT%%@dirrm luajit/lib/lua
|
||||
%%LUAJIT%%@dirrm luajit/lib
|
||||
%%LUAJIT%%@dirrm luajit/bin
|
||||
%%LUAJIT%%@dirrm luajit
|
10
README
10
README
@ -27,6 +27,16 @@ For bundle maintainers:
|
||||
|
||||
at the top of the bundle source tree.
|
||||
|
||||
MAILING LIST
|
||||
You're very welcome to join the English OpenResty mailing list hosted on
|
||||
Google Groups:
|
||||
|
||||
https://groups.google.com/group/openresty-en
|
||||
|
||||
The Chinese mailing list is here:
|
||||
|
||||
https://groups.google.com/group/openresty
|
||||
|
||||
REPORT BUGS
|
||||
|
||||
You're very welcome to report issues on GitHub:
|
||||
|
@ -1,7 +1,19 @@
|
||||
diff -ur nginx-1.2.1/src/http/ngx_http_request_body.c nginx-1.2.1-patched/src/http/ngx_http_request_body.c
|
||||
--- nginx-1.2.1/src/http/ngx_http_request_body.c 2011-09-30 22:36:19.000000000 +0800
|
||||
+++ nginx-1.2.1-patched/src/http/ngx_http_request_body.c 2011-10-21 21:54:08.460350482 +0800
|
||||
@@ -38,7 +38,7 @@
|
||||
diff '--exclude=*~' -ur nginx-1.2.1/src/http/ngx_http_core_module.c nginx-1.2.1-patched/src/http/ngx_http_core_module.c
|
||||
--- nginx-1.2.1/src/http/ngx_http_core_module.c 2012-06-04 04:58:12.000000000 -0700
|
||||
+++ nginx-1.2.1-patched/src/http/ngx_http_core_module.c 2012-07-21 12:09:17.468576485 -0700
|
||||
@@ -2420,6 +2420,8 @@
|
||||
|
||||
sr->request_body = r->request_body;
|
||||
|
||||
+ sr->content_length_n = -1;
|
||||
+
|
||||
sr->method = NGX_HTTP_GET;
|
||||
sr->http_version = r->http_version;
|
||||
|
||||
diff '--exclude=*~' -ur nginx-1.2.1/src/http/ngx_http_request_body.c nginx-1.2.1-patched/src/http/ngx_http_request_body.c
|
||||
--- nginx-1.2.1/src/http/ngx_http_request_body.c 2012-04-12 12:35:41.000000000 -0700
|
||||
+++ nginx-1.2.1-patched/src/http/ngx_http_request_body.c 2012-07-21 12:08:30.655376967 -0700
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
r->main->count++;
|
||||
|
||||
@ -10,7 +22,7 @@ diff -ur nginx-1.2.1/src/http/ngx_http_request_body.c nginx-1.2.1-patched/src/ht
|
||||
post_handler(r);
|
||||
return NGX_OK;
|
||||
}
|
||||
@@ -440,7 +440,7 @@
|
||||
@@ -441,7 +441,7 @@
|
||||
ssize_t size;
|
||||
ngx_event_t *rev;
|
||||
|
||||
@ -19,7 +31,7 @@ diff -ur nginx-1.2.1/src/http/ngx_http_request_body.c nginx-1.2.1-patched/src/ht
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
@@ -456,20 +456,22 @@
|
||||
@@ -457,20 +457,22 @@
|
||||
ngx_del_timer(rev);
|
||||
}
|
||||
|
||||
@ -47,7 +59,7 @@ diff -ur nginx-1.2.1/src/http/ngx_http_request_body.c nginx-1.2.1-patched/src/ht
|
||||
return NGX_OK;
|
||||
}
|
||||
}
|
||||
@@ -568,7 +570,7 @@
|
||||
@@ -569,7 +571,7 @@
|
||||
"http read discarded body");
|
||||
|
||||
for ( ;; ) {
|
||||
@ -56,7 +68,7 @@ diff -ur nginx-1.2.1/src/http/ngx_http_request_body.c nginx-1.2.1-patched/src/ht
|
||||
r->read_event_handler = ngx_http_block_reading;
|
||||
return NGX_OK;
|
||||
}
|
||||
@@ -577,9 +579,9 @@
|
||||
@@ -578,9 +580,9 @@
|
||||
return NGX_AGAIN;
|
||||
}
|
||||
|
||||
@ -68,7 +80,7 @@ diff -ur nginx-1.2.1/src/http/ngx_http_request_body.c nginx-1.2.1-patched/src/ht
|
||||
|
||||
n = r->connection->recv(r->connection, buffer, size);
|
||||
|
||||
@@ -596,7 +598,7 @@
|
||||
@@ -597,7 +599,7 @@
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
@ -77,10 +89,11 @@ diff -ur nginx-1.2.1/src/http/ngx_http_request_body.c nginx-1.2.1-patched/src/ht
|
||||
}
|
||||
}
|
||||
|
||||
diff -ur nginx-1.2.1/src/http/ngx_http_request.c nginx-1.2.1-patched/src/http/ngx_http_request.c
|
||||
--- nginx-1.2.1/src/http/ngx_http_request.c 2011-09-30 22:36:19.000000000 +0800
|
||||
+++ nginx-1.2.1-patched/src/http/ngx_http_request.c 2011-10-21 19:06:38.404350692 +0800
|
||||
@@ -286,6 +286,8 @@
|
||||
Only in nginx-1.2.1-patched/src/http: ngx_http_request_body.c.orig
|
||||
diff '--exclude=*~' -ur nginx-1.2.1/src/http/ngx_http_request.c nginx-1.2.1-patched/src/http/ngx_http_request.c
|
||||
--- nginx-1.2.1/src/http/ngx_http_request.c 2012-06-05 06:52:37.000000000 -0700
|
||||
+++ nginx-1.2.1-patched/src/http/ngx_http_request.c 2012-07-21 12:08:30.656376973 -0700
|
||||
@@ -287,6 +287,8 @@
|
||||
|
||||
r->pipeline = hc->pipeline;
|
||||
|
||||
@ -89,7 +102,7 @@ diff -ur nginx-1.2.1/src/http/ngx_http_request.c nginx-1.2.1-patched/src/http/ng
|
||||
if (hc->nbusy) {
|
||||
r->header_in = hc->busy[0];
|
||||
}
|
||||
@@ -297,6 +299,8 @@
|
||||
@@ -298,6 +300,8 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@ -98,10 +111,11 @@ diff -ur nginx-1.2.1/src/http/ngx_http_request.c nginx-1.2.1-patched/src/http/ng
|
||||
hc->request = r;
|
||||
}
|
||||
|
||||
diff -ur nginx-1.2.1/src/http/ngx_http_request.h nginx-1.2.1-patched/src/http/ngx_http_request.h
|
||||
--- nginx-1.2.1/src/http/ngx_http_request.h 2011-08-29 18:39:23.000000000 +0800
|
||||
+++ nginx-1.2.1-patched/src/http/ngx_http_request.h 2011-10-21 17:26:13.203807584 +0800
|
||||
@@ -366,6 +366,9 @@
|
||||
Only in nginx-1.2.1-patched/src/http: ngx_http_request.c.orig
|
||||
diff '--exclude=*~' -ur nginx-1.2.1/src/http/ngx_http_request.h nginx-1.2.1-patched/src/http/ngx_http_request.h
|
||||
--- nginx-1.2.1/src/http/ngx_http_request.h 2012-02-28 06:54:23.000000000 -0800
|
||||
+++ nginx-1.2.1-patched/src/http/ngx_http_request.h 2012-07-21 12:08:30.657376978 -0700
|
||||
@@ -368,6 +368,9 @@
|
||||
ngx_pool_t *pool;
|
||||
ngx_buf_t *header_in;
|
||||
|
||||
@ -111,3 +125,4 @@ diff -ur nginx-1.2.1/src/http/ngx_http_request.h nginx-1.2.1-patched/src/http/ng
|
||||
ngx_http_headers_in_t headers_in;
|
||||
ngx_http_headers_out_t headers_out;
|
||||
|
||||
Only in nginx-1.2.1-patched/src/http: ngx_http_request.h.orig
|
||||
|
853
patches/nginx-1.2.1-dtrace.patch
Normal file
853
patches/nginx-1.2.1-dtrace.patch
Normal file
@ -0,0 +1,853 @@
|
||||
diff --git a/README b/README
|
||||
index 2f68e14..4f2c4a7 100644
|
||||
--- a/README
|
||||
+++ b/README
|
||||
@@ -1,3 +1,40 @@
|
||||
+This is an Nginx fork that adds dtrace USDT probes.
|
||||
|
||||
-Documentation is available at http://nginx.org
|
||||
+This is still under development and not usable yet.
|
||||
+
|
||||
+Installation:
|
||||
+
|
||||
+ ./configure --with-dtrace-probes \
|
||||
+ --with-dtrace=/usr/sbin/dtrace \
|
||||
+ ...
|
||||
+ make
|
||||
+ make install
|
||||
+
|
||||
+Usage on Linux (with systemtap):
|
||||
+
|
||||
+ # make the stap-nginx script visiable in your PATH
|
||||
+ export PATH=/usr/local/nginx/sbin:$PATH
|
||||
+
|
||||
+ # list all the static probes available in your nginx
|
||||
+ stap-nginx -L 'process("nginx").mark("*")'
|
||||
+
|
||||
+ # run the test.stp file
|
||||
+ stap-nginx test.stp
|
||||
+
|
||||
+Sample test.stp file:
|
||||
+
|
||||
+ probe begin
|
||||
+ {
|
||||
+ print("Tracing. Hit CTRL-C to stop.\n")
|
||||
+ }
|
||||
+
|
||||
+ probe process("nginx").mark("http-subrequest-start")
|
||||
+ {
|
||||
+ printf("uri: %s?%s\n", ngx_http_req_uri($arg1),
|
||||
+ ngx_http_req_args($arg1))
|
||||
+ }
|
||||
+
|
||||
+For now, only tested on Solaris 11 Express and Fedora Linux 17.
|
||||
+
|
||||
+The original Nginx documentation is available at http://nginx.org
|
||||
|
||||
diff --git a/auto/install b/auto/install
|
||||
index c2c0ade..8e43d11 100644
|
||||
--- a/auto/install
|
||||
+++ b/auto/install
|
||||
@@ -16,6 +16,20 @@ END
|
||||
fi
|
||||
|
||||
|
||||
+case ".$NGX_STAP_NGX_PATH" in
|
||||
+ ./*)
|
||||
+ ;;
|
||||
+
|
||||
+ .)
|
||||
+ NGX_STAP_NGX_PATH=$NGX_PREFIX/sbin/stap-nginx
|
||||
+ ;;
|
||||
+
|
||||
+ *)
|
||||
+ NGX_STAP_NGX_PATH=$NGX_PREFIX/$NGX_STAP_NGX_PATH
|
||||
+ ;;
|
||||
+esac
|
||||
+
|
||||
+
|
||||
case ".$NGX_SBIN_PATH" in
|
||||
./*)
|
||||
;;
|
||||
@@ -53,6 +67,16 @@ case ".$NGX_PID_PATH" in
|
||||
esac
|
||||
|
||||
|
||||
+case ".$NGX_TAPSET_PREFIX" in
|
||||
+ ./* | .)
|
||||
+ ;;
|
||||
+
|
||||
+ *)
|
||||
+ NGX_TAPSET_PREFIX=$NGX_PREFIX/$NGX_TAPSET_PREFIX
|
||||
+ ;;
|
||||
+esac
|
||||
+
|
||||
+
|
||||
case ".$NGX_ERROR_LOG_PATH" in
|
||||
./* | .)
|
||||
;;
|
||||
@@ -151,6 +175,36 @@ install: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext} \
|
||||
|| cp -R $NGX_HTML '\$(DESTDIR)$NGX_PREFIX'
|
||||
END
|
||||
|
||||
+if [ $NGX_DTRACE = YES ]; then
|
||||
+
|
||||
+ ngx_tapset_srcs="$NGX_TAPSET_SRCS"
|
||||
+
|
||||
+ cat << END >> $NGX_MAKEFILE
|
||||
+ test -d '\$(DESTDIR)$NGX_TAPSET_PREFIX' || \
|
||||
+ mkdir -p '\$(DESTDIR)$NGX_TAPSET_PREFIX'
|
||||
+END
|
||||
+
|
||||
+ for ngx_tapset_src in $ngx_tapset_srcs
|
||||
+ do
|
||||
+ ngx_tapset_file=`basename $ngx_tapset_src`
|
||||
+
|
||||
+ cat << END >> $NGX_MAKEFILE
|
||||
+
|
||||
+ sed -e "s|NGX_SBIN_PATH|$NGX_SBIN_PATH|g" $ngx_long_cont \
|
||||
+ $ngx_tapset_src > '\$(DESTDIR)$NGX_TAPSET_PREFIX/$ngx_tapset_file'
|
||||
+END
|
||||
+
|
||||
+ done
|
||||
+
|
||||
+ cat << END >> $NGX_MAKEFILE
|
||||
+
|
||||
+ test -d '\$(DESTDIR)`dirname "$NGX_STAP_NGX_PATH"`' || \
|
||||
+ mkdir -p '\$(DESTDIR)`dirname "$NGX_STAP_NGX_PATH"`'
|
||||
+ cp $NGX_OBJS/stap-nginx '\$(DESTDIR)$NGX_STAP_NGX_PATH'
|
||||
+ chmod 0755 '\$(DESTDIR)$NGX_STAP_NGX_PATH'
|
||||
+END
|
||||
+
|
||||
+fi
|
||||
|
||||
if test -n "$NGX_ERROR_LOG_PATH"; then
|
||||
cat << END >> $NGX_MAKEFILE
|
||||
@@ -162,6 +216,18 @@ END
|
||||
fi
|
||||
|
||||
|
||||
+if [ $NGX_DTRACE = YES ]; then
|
||||
+ cat << END >> $NGX_MAKEFILE
|
||||
+
|
||||
+$NGX_OBJS${ngx_dirsep}stap-nginx: src/dtrace/stap-nginx
|
||||
+ sed -e "s|NGX_TAPSET_PREFIX|$NGX_TAPSET_PREFIX|g" $ngx_long_cont \
|
||||
+ -e "s|NGX_SBIN_DIR|`dirname $NGX_SBIN_PATH`|g" $ngx_long_cont \
|
||||
+ -e "s|NGX_SBIN_PATH|$NGX_SBIN_PATH|g" $ngx_long_cont \
|
||||
+ src/dtrace/stap-nginx > $NGX_OBJS${ngx_dirsep}stap-nginx
|
||||
+END
|
||||
+fi
|
||||
+
|
||||
+
|
||||
# create Makefile
|
||||
|
||||
cat << END >> Makefile
|
||||
diff --git a/auto/make b/auto/make
|
||||
index e7f5490..ed2c098 100644
|
||||
--- a/auto/make
|
||||
+++ b/auto/make
|
||||
@@ -26,6 +26,9 @@ LINK = $LINK
|
||||
|
||||
END
|
||||
|
||||
+if [ $NGX_DTRACE = YES ]; then
|
||||
+ echo DTRACE = $DTRACE >> $NGX_MAKEFILE
|
||||
+fi
|
||||
|
||||
if test -n "$NGX_PERL_CFLAGS"; then
|
||||
echo NGX_PERL_CFLAGS = $NGX_PERL_CFLAGS >> $NGX_MAKEFILE
|
||||
@@ -177,6 +180,36 @@ ngx_objs=`echo $ngx_all_objs $ngx_modules_obj \
|
||||
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
|
||||
-e "s/\//$ngx_regex_dirsep/g"`
|
||||
|
||||
+if [ $NGX_DTRACE = YES ]; then
|
||||
+
|
||||
+ ngx_dtrace_obj=$NGX_OBJS${ngx_dirsep}ngx_dtrace_provider.$ngx_objext
|
||||
+
|
||||
+ ngx_dtrace_h=$NGX_OBJS${ngx_dirsep}ngx_dtrace_provider.h
|
||||
+
|
||||
+ ngx_dtrace_d=$NGX_OBJS${ngx_dirsep}dtrace_providers.d
|
||||
+
|
||||
+ ngx_dtrace_providers=`echo $NGX_DTRACE_PROVIDERS \
|
||||
+ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
|
||||
+ -e "s/\//$ngx_regex_dirsep/g"`
|
||||
+
|
||||
+ cat << END >> $NGX_MAKEFILE
|
||||
+
|
||||
+all: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext}
|
||||
+
|
||||
+$ngx_dtrace_d: $ngx_dtrace_providers
|
||||
+ cat $ngx_dtrace_providers > $ngx_dtrace_d
|
||||
+
|
||||
+$ngx_dtrace_h: $ngx_dtrace_d
|
||||
+ \$(DTRACE) -xnolibs -h -o $ngx_dtrace_h -s $ngx_dtrace_d
|
||||
+
|
||||
+$ngx_dtrace_obj: $ngx_dtrace_d $ngx_deps$ngx_spacer
|
||||
+ \$(DTRACE) -xnolibs -G -o $ngx_dtrace_obj -s $ngx_dtrace_d $ngx_objs
|
||||
+END
|
||||
+
|
||||
+ ngx_deps="$ngx_deps$ngx_long_cont$ngx_dtrace_obj$ngx_long_cont$NGX_OBJS${ngx_dirsep}stap-nginx"
|
||||
+ ngx_objs="$ngx_objs$ngx_long_cont$ngx_dtrace_obj"
|
||||
+fi
|
||||
+
|
||||
if test -n "$NGX_LD_OPT$CORE_LIBS"; then
|
||||
ngx_libs=`echo $NGX_LD_OPT $CORE_LIBS \
|
||||
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
|
||||
diff --git a/auto/options b/auto/options
|
||||
index 393be40..05609c6 100644
|
||||
--- a/auto/options
|
||||
+++ b/auto/options
|
||||
@@ -12,6 +12,8 @@ NGX_CONF_PATH=
|
||||
NGX_ERROR_LOG_PATH=
|
||||
NGX_PID_PATH=
|
||||
NGX_LOCK_PATH=
|
||||
+NGX_TAPSET_PREFIX=
|
||||
+NGX_STAP_NGX_PATH=
|
||||
NGX_USER=
|
||||
NGX_GROUP=
|
||||
|
||||
@@ -20,6 +22,8 @@ CPP=
|
||||
NGX_OBJS=objs
|
||||
|
||||
NGX_DEBUG=NO
|
||||
+NGX_DTRACE=NO
|
||||
+DTRACE=dtrace
|
||||
NGX_CC_OPT=
|
||||
NGX_LD_OPT=
|
||||
CPU=NO
|
||||
@@ -169,6 +173,8 @@ do
|
||||
--error-log-path=*) NGX_ERROR_LOG_PATH="$value";;
|
||||
--pid-path=*) NGX_PID_PATH="$value" ;;
|
||||
--lock-path=*) NGX_LOCK_PATH="$value" ;;
|
||||
+ --tapset-prefix=*) NGX_TAPSET_PREFIX="$value" ;;
|
||||
+ --stap-nginx-path=*) NGX_STAP_NGX_PATH="$value" ;;
|
||||
--user=*) NGX_USER="$value" ;;
|
||||
--group=*) NGX_GROUP="$value" ;;
|
||||
|
||||
@@ -272,7 +278,8 @@ use the \"--without-http_limit_conn_module\" option instead"
|
||||
--with-ld-opt=*) NGX_LD_OPT="$value" ;;
|
||||
--with-cpu-opt=*) CPU="$value" ;;
|
||||
--with-debug) NGX_DEBUG=YES ;;
|
||||
-
|
||||
+ --with-dtrace=*) DTRACE="$value" ;;
|
||||
+ --with-dtrace-probes) NGX_DTRACE=YES ;;
|
||||
--without-pcre) USE_PCRE=DISABLED ;;
|
||||
--with-pcre) USE_PCRE=YES ;;
|
||||
--with-pcre=*) PCRE="$value" ;;
|
||||
@@ -326,6 +333,8 @@ cat << END
|
||||
--error-log-path=PATH set error log pathname
|
||||
--pid-path=PATH set nginx.pid pathname
|
||||
--lock-path=PATH set nginx.lock pathname
|
||||
+ --tapset-prefix=PATH set systemtap tapset directory prefix
|
||||
+ --stap-nginx-path=PATH set stap-nginx pathname
|
||||
|
||||
--user=USER set non-privileged user for
|
||||
worker processes
|
||||
@@ -448,6 +457,8 @@ cat << END
|
||||
--with-openssl-opt=OPTIONS set additional build options for OpenSSL
|
||||
|
||||
--with-debug enable debug logging
|
||||
+ --with-dtrace-probes enable dtrace USDT probes
|
||||
+ --with-dtrace=PATH set dtrace utility pathname
|
||||
|
||||
END
|
||||
|
||||
@@ -477,6 +488,7 @@ NGX_CONF_PATH=${NGX_CONF_PATH:-conf/nginx.conf}
|
||||
NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
|
||||
NGX_PID_PATH=${NGX_PID_PATH:-logs/nginx.pid}
|
||||
NGX_LOCK_PATH=${NGX_LOCK_PATH:-logs/nginx.lock}
|
||||
+NGX_TAPSET_PREFIX=${NGX_TAPSET_PREFIX:-tapset}
|
||||
|
||||
if [ ".$NGX_ERROR_LOG_PATH" = ".stderr" ]; then
|
||||
NGX_ERROR_LOG_PATH=
|
||||
diff --git a/auto/sources b/auto/sources
|
||||
index 374ad66..72bb1b0 100644
|
||||
--- a/auto/sources
|
||||
+++ b/auto/sources
|
||||
@@ -39,6 +39,11 @@ CORE_DEPS="src/core/nginx.h \
|
||||
src/core/ngx_crypt.h"
|
||||
|
||||
|
||||
+if [ $NGX_DTRACE = YES ]; then
|
||||
+ CORE_DEPS="$CORE_DEPS objs/ngx_dtrace_provider.h"
|
||||
+fi
|
||||
+
|
||||
+
|
||||
CORE_SRCS="src/core/nginx.c \
|
||||
src/core/ngx_log.c \
|
||||
src/core/ngx_palloc.c \
|
||||
@@ -291,7 +296,8 @@ HTTP_DEPS="src/http/ngx_http.h \
|
||||
src/http/ngx_http_script.h \
|
||||
src/http/ngx_http_upstream.h \
|
||||
src/http/ngx_http_upstream_round_robin.h \
|
||||
- src/http/ngx_http_busy_lock.h"
|
||||
+ src/http/ngx_http_busy_lock.h \
|
||||
+ src/http/ngx_http_probe.h"
|
||||
|
||||
HTTP_SRCS="src/http/ngx_http.c \
|
||||
src/http/ngx_http_core_module.c \
|
||||
@@ -524,3 +530,8 @@ NGX_GOOGLE_PERFTOOLS_MODULE=ngx_google_perftools_module
|
||||
NGX_GOOGLE_PERFTOOLS_SRCS=src/misc/ngx_google_perftools_module.c
|
||||
|
||||
NGX_CPP_TEST_SRCS=src/misc/ngx_cpp_test_module.cpp
|
||||
+
|
||||
+NGX_DTRACE_PROVIDERS=src/dtrace/nginx_provider.d
|
||||
+
|
||||
+NGX_TAPSET_SRCS=src/dtrace/nginx.stp
|
||||
+
|
||||
diff --git a/auto/summary b/auto/summary
|
||||
index dcebec9..06c4aa9 100644
|
||||
--- a/auto/summary
|
||||
+++ b/auto/summary
|
||||
@@ -92,6 +92,14 @@ else
|
||||
echo " nginx logs errors to stderr"
|
||||
fi
|
||||
|
||||
+if [ $NGX_DTRACE = YES ]; then
|
||||
+ cat << END
|
||||
+ nginx dtrace static probes enabled
|
||||
+ nginx systemtap tapset prefix: "$NGX_TAPSET_PREFIX"
|
||||
+ nginx systemtap wrapper script: "$NGX_STAP_NGX_PATH"
|
||||
+END
|
||||
+fi
|
||||
+
|
||||
cat << END
|
||||
nginx http access log file: "$NGX_HTTP_LOG_PATH"
|
||||
nginx http client request body temporary files: "$NGX_HTTP_CLIENT_TEMP_PATH"
|
||||
diff --git a/configure b/configure
|
||||
index 45ea154..332c011 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -20,6 +20,9 @@ if [ $NGX_DEBUG = YES ]; then
|
||||
have=NGX_DEBUG . auto/have
|
||||
fi
|
||||
|
||||
+if [ $NGX_DTRACE = YES ]; then
|
||||
+ have=NGX_DTRACE . auto/have
|
||||
+fi
|
||||
|
||||
if test -z "$NGX_PLATFORM"; then
|
||||
echo "checking for OS"
|
||||
diff --git a/src/dtrace/nginx.stp b/src/dtrace/nginx.stp
|
||||
new file mode 100644
|
||||
index 0000000..fccea2b
|
||||
--- /dev/null
|
||||
+++ b/src/dtrace/nginx.stp
|
||||
@@ -0,0 +1,152 @@
|
||||
+/* tapset for nginx */
|
||||
+
|
||||
+/* retrieve the request uri string from the ngx_http_request_t pointer */
|
||||
+function ngx_http_req_uri(r)
|
||||
+{
|
||||
+ len = @cast(r, "ngx_http_request_s", "NGX_SBIN_PATH")->uri->len
|
||||
+
|
||||
+ if (len == 0) {
|
||||
+ return ""
|
||||
+ }
|
||||
+
|
||||
+ return user_string_n(@cast(r, "ngx_http_request_s", "NGX_SBIN_PATH")->uri->data, len)
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* retrieve the request query string from the ngx_http_request_t pointer */
|
||||
+function ngx_http_req_args(r)
|
||||
+{
|
||||
+ len = @cast(r, "ngx_http_request_s", "NGX_SBIN_PATH")->args->len
|
||||
+
|
||||
+ if (len == 0) {
|
||||
+ return ""
|
||||
+ }
|
||||
+
|
||||
+ return user_string_n(@cast(r, "ngx_http_request_s", "NGX_SBIN_PATH")->args->data, len)
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* retrieve the first command name (or directive name) from
|
||||
+ * the ngx_module_t pointer */
|
||||
+function ngx_http_module_cmd(m)
|
||||
+{
|
||||
+ cmds = @cast(m, "ngx_module_t", "NGX_SBIN_PATH")->commands
|
||||
+ if (cmds == 0) {
|
||||
+ return ""
|
||||
+ }
|
||||
+
|
||||
+ len = @cast(cmds, "ngx_command_t", "NGX_SBIN_PATH")->name->len
|
||||
+
|
||||
+ if (len == 0) {
|
||||
+ return ""
|
||||
+ }
|
||||
+
|
||||
+ return user_string_n(@cast(cmds, "ngx_command_t", "NGX_SBIN_PATH")->name->data, len)
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_chain_buf(cl)
|
||||
+{
|
||||
+ return @cast(cl, "ngx_chain_t", "NGX_SBIN_PATH")->buf
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_buf_in_memory(b)
|
||||
+{
|
||||
+ return @cast(b, "ngx_buf_t", "NGX_SBIN_PATH")->temporary
|
||||
+ || @cast(b, "ngx_buf_t", "NGX_SBIN_PATH")->memory
|
||||
+ || @cast(b, "ngx_buf_t", "NGX_SBIN_PATH")->mmap
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_buf_pos(b)
|
||||
+{
|
||||
+ return @cast(b, "ngx_buf_t", "NGX_SBIN_PATH")->pos
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_buf_file_pos(b)
|
||||
+{
|
||||
+ return @cast(b, "ngx_buf_t", "NGX_SBIN_PATH")->file_pos
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_buf_last(b)
|
||||
+{
|
||||
+ return @cast(b, "ngx_buf_t", "NGX_SBIN_PATH")->last
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_buf_file_last(b)
|
||||
+{
|
||||
+ return @cast(b, "ngx_buf_t", "NGX_SBIN_PATH")->file_last
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_buf_end(b)
|
||||
+{
|
||||
+ return @cast(b, "ngx_buf_t", "NGX_SBIN_PATH")->end
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_buf_size(b)
|
||||
+{
|
||||
+ if (ngx_buf_in_memory(b)) {
|
||||
+ return ngx_buf_last(b) - ngx_buf_pos(b)
|
||||
+ }
|
||||
+
|
||||
+ return ngx_buf_file_last(b) - ngx_buf_file_pos(b)
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_buf_data(b)
|
||||
+{
|
||||
+ return user_string_n(ngx_buf_pos(b), ngx_buf_last(b) - ngx_buf_pos(b))
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_pool_cleanup_file_name(c)
|
||||
+{
|
||||
+ return user_string(@cast(c, "ngx_pool_cleanup_file_t", "NGX_SBIN_PATH")->name)
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_http_req_content_length(r)
|
||||
+{
|
||||
+ return @cast(r, "ngx_http_request_t", "NGX_SBIN_PATH")->headers_in->content_length_n
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_http_req_body_temp_file_name(r)
|
||||
+{
|
||||
+ rb = @cast(r, "ngx_http_request_t", "NGX_SBIN_PATH")->request_body
|
||||
+ if (!rb) {
|
||||
+ return ""
|
||||
+ }
|
||||
+
|
||||
+ tf = @cast(rb, "ngx_http_request_body_t", "NGX_SBIN_PATH")->temp_file
|
||||
+ if (!tf) {
|
||||
+ return ""
|
||||
+ }
|
||||
+
|
||||
+ len = @cast(tf, "ngx_temp_file_t", "NGX_SBIN_PATH")->file->name->len
|
||||
+
|
||||
+ return user_string_n(@cast(tf, "ngx_temp_file_t", "NGX_SBIN_PATH")->file->name->data, len)
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_table_elt_key(e)
|
||||
+{
|
||||
+ len = @cast(e, "ngx_table_elt_t", "NGX_SBIN_PATH")->key->len
|
||||
+
|
||||
+ return user_string_n(@cast(e, "ngx_table_elt_t", "NGX_SBIN_PATH")->key->data, len)
|
||||
+}
|
||||
+
|
||||
+
|
||||
+function ngx_table_elt_value(e)
|
||||
+{
|
||||
+ len = @cast(e, "ngx_table_elt_t", "NGX_SBIN_PATH")->value->len
|
||||
+
|
||||
+ return user_string_n(@cast(e, "ngx_table_elt_t", "NGX_SBIN_PATH")->value->data, len)
|
||||
+}
|
||||
+
|
||||
diff --git a/src/dtrace/nginx_provider.d b/src/dtrace/nginx_provider.d
|
||||
new file mode 100644
|
||||
index 0000000..6fcc994
|
||||
--- /dev/null
|
||||
+++ b/src/dtrace/nginx_provider.d
|
||||
@@ -0,0 +1,32 @@
|
||||
+typedef struct { int dummy; } ngx_http_request_t;
|
||||
+typedef struct { int dummy; } ngx_str_t;
|
||||
+typedef int64_t ngx_int_t;
|
||||
+typedef struct { int dummy; } ngx_module_t;
|
||||
+typedef struct { int dummy; } ngx_http_module_t;
|
||||
+typedef struct { int dummy; } ngx_table_elt_t;
|
||||
+
|
||||
+
|
||||
+provider nginx {
|
||||
+ /* probes for subrequests */
|
||||
+ probe http__subrequest__cycle(ngx_http_request_t *pr, ngx_str_t *uri, ngx_str_t *args);
|
||||
+ probe http__subrequest__start(ngx_http_request_t *r);
|
||||
+ probe http__subrequest__finalize_writing(ngx_http_request_t *r);
|
||||
+ probe http__subrequest__finalize_nonactive(ngx_http_request_t *r);
|
||||
+ probe http__subrequest__wake__parent(ngx_http_request_t *r);
|
||||
+ probe http__subrequest__done(ngx_http_request_t *r);
|
||||
+ probe http__subrequest__post__start(ngx_http_request_t *r, ngx_int_t rc);
|
||||
+ probe http__subrequest__post__done(ngx_http_request_t *r, ngx_int_t rc);
|
||||
+ probe http__module__post__config(ngx_module_t *m);
|
||||
+ probe http__read__body__abort(ngx_request_t *r, char *reason);
|
||||
+ probe http__read__body__done(ngx_request_t *r);
|
||||
+ probe http__read__req__line__done(ngx_request_t *r);
|
||||
+ probe http__read__req__header__done(ngx_request_t *r, ngx_table_elt_t *h);
|
||||
+};
|
||||
+
|
||||
+
|
||||
+#pragma D attributes Evolving/Evolving/Common provider nginx provider
|
||||
+#pragma D attributes Private/Private/Unknown provider nginx module
|
||||
+#pragma D attributes Private/Private/Unknown provider nginx function
|
||||
+#pragma D attributes Private/Private/Common provider nginx name
|
||||
+#pragma D attributes Evolving/Evolving/Common provider nginx args
|
||||
+
|
||||
diff --git a/src/dtrace/stap-nginx b/src/dtrace/stap-nginx
|
||||
new file mode 100755
|
||||
index 0000000..5127fbe
|
||||
--- /dev/null
|
||||
+++ b/src/dtrace/stap-nginx
|
||||
@@ -0,0 +1,6 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+PATH="NGX_SBIN_DIR:$PATH"
|
||||
+export PATH
|
||||
+exec stap -d "NGX_SBIN_PATH" --ldd -I "NGX_TAPSET_PREFIX" "$@"
|
||||
+
|
||||
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
|
||||
index 3e077fb..b7edb7b 100644
|
||||
--- a/src/http/ngx_http.c
|
||||
+++ b/src/http/ngx_http.c
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
+#include <ngx_http_probe.h>
|
||||
|
||||
|
||||
static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
||||
@@ -307,6 +308,9 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
module = ngx_modules[m]->ctx;
|
||||
|
||||
if (module->postconfiguration) {
|
||||
+
|
||||
+ ngx_http_probe_module_post_config(ngx_modules[m]);
|
||||
+
|
||||
if (module->postconfiguration(cf) != NGX_OK) {
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
|
||||
index c5db18f..f23ba51 100644
|
||||
--- a/src/http/ngx_http_core_module.c
|
||||
+++ b/src/http/ngx_http_core_module.c
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
+#include <ngx_http_probe.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -2377,6 +2378,8 @@ ngx_http_subrequest(ngx_http_request_t *r,
|
||||
r->main->subrequests--;
|
||||
|
||||
if (r->main->subrequests == 0) {
|
||||
+ ngx_http_probe_subrequest_cycle(r, &uri, &args);
|
||||
+
|
||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||
"subrequests cycle while processing \"%V\"", uri);
|
||||
r->main->subrequests = 1;
|
||||
@@ -2491,6 +2494,8 @@ ngx_http_subrequest(ngx_http_request_t *r,
|
||||
|
||||
*psr = sr;
|
||||
|
||||
+ ngx_http_probe_subrequest_start(sr);
|
||||
+
|
||||
return ngx_http_post_request(sr, NULL);
|
||||
}
|
||||
|
||||
diff --git a/src/http/ngx_http_probe.h b/src/http/ngx_http_probe.h
|
||||
new file mode 100644
|
||||
index 0000000..d7d2d45
|
||||
--- /dev/null
|
||||
+++ b/src/http/ngx_http_probe.h
|
||||
@@ -0,0 +1,75 @@
|
||||
+#ifndef _NGX_HTTP_PROBE_H_INCLUDED_
|
||||
+#define _NGX_HTTP_PROBE_H_INCLUDED_
|
||||
+
|
||||
+
|
||||
+#include <ngx_config.h>
|
||||
+#include <ngx_core.h>
|
||||
+#include <ngx_http.h>
|
||||
+
|
||||
+
|
||||
+#if (NGX_DTRACE)
|
||||
+
|
||||
+#include <ngx_dtrace_provider.h>
|
||||
+
|
||||
+#define ngx_http_probe_subrequest_cycle(pr, uri, args) \
|
||||
+ NGINX_HTTP_SUBREQUEST_CYCLE(pr, uri, args)
|
||||
+
|
||||
+#define ngx_http_probe_subrequest_start(r) \
|
||||
+ NGINX_HTTP_SUBREQUEST_START(r)
|
||||
+
|
||||
+#define ngx_http_probe_subrequest_finalize_writing(r) \
|
||||
+ NGINX_HTTP_SUBREQUEST_FINALIZE_WRITING(r)
|
||||
+
|
||||
+#define ngx_http_probe_subrequest_finalize_nonactive(r) \
|
||||
+ NGINX_HTTP_SUBREQUEST_FINALIZE_NONACTIVE(r)
|
||||
+
|
||||
+#define ngx_http_probe_subrequest_finalize_nonactive(r) \
|
||||
+ NGINX_HTTP_SUBREQUEST_FINALIZE_NONACTIVE(r)
|
||||
+
|
||||
+#define ngx_http_probe_subrequest_wake_parent(r) \
|
||||
+ NGINX_HTTP_SUBREQUEST_WAKE_PARENT(r)
|
||||
+
|
||||
+#define ngx_http_probe_subrequest_done(r) \
|
||||
+ NGINX_HTTP_SUBREQUEST_DONE(r)
|
||||
+
|
||||
+#define ngx_http_probe_subrequest_post_start(r, rc) \
|
||||
+ NGINX_HTTP_SUBREQUEST_POST_START(r, rc)
|
||||
+
|
||||
+#define ngx_http_probe_subrequest_post_done(r, rc) \
|
||||
+ NGINX_HTTP_SUBREQUEST_POST_DONE(r, rc)
|
||||
+
|
||||
+#define ngx_http_probe_module_post_config(m) \
|
||||
+ NGINX_HTTP_MODULE_POST_CONFIG(m)
|
||||
+
|
||||
+#define ngx_http_probe_read_body_abort(r, reason) \
|
||||
+ NGINX_HTTP_READ_BODY_ABORT(r, reason)
|
||||
+
|
||||
+#define ngx_http_probe_read_body_done(r) \
|
||||
+ NGINX_HTTP_READ_BODY_DONE(r)
|
||||
+
|
||||
+#define ngx_http_probe_read_req_line_done(r) \
|
||||
+ NGINX_HTTP_READ_REQ_LINE_DONE(r)
|
||||
+
|
||||
+#define ngx_http_probe_read_req_header_done(r, h) \
|
||||
+ NGINX_HTTP_READ_REQ_HEADER_DONE(r, h)
|
||||
+
|
||||
+#else /* !(NGX_DTRACE) */
|
||||
+
|
||||
+#define ngx_http_probe_subrequest_cycle(pr, uri, args)
|
||||
+#define ngx_http_probe_subrequest_start(r)
|
||||
+#define ngx_http_probe_subrequest_finalize_writing(r)
|
||||
+#define ngx_http_probe_subrequest_finalize_nonactive(r)
|
||||
+#define ngx_http_probe_subrequest_wake_parent(r)
|
||||
+#define ngx_http_probe_subrequest_done(r)
|
||||
+#define ngx_http_probe_subrequest_post_start(r, rc)
|
||||
+#define ngx_http_probe_subrequest_post_done(r, rc)
|
||||
+#define ngx_http_probe_module_post_config(m)
|
||||
+#define ngx_http_probe_read_body_abort(r, reason)
|
||||
+#define ngx_http_probe_read_body_done(r)
|
||||
+#define ngx_http_probe_read_req_line_done(r)
|
||||
+#define ngx_http_probe_read_req_header_done(r, h)
|
||||
+
|
||||
+#endif /* NGX_DTRACE */
|
||||
+
|
||||
+
|
||||
+#endif /* _NGX_HTTP_PROBE_H_INCLUDED_ */
|
||||
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
|
||||
index 436e17d..6dc5cb2 100644
|
||||
--- a/src/http/ngx_http_request.c
|
||||
+++ b/src/http/ngx_http_request.c
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
+#include <ngx_http_probe.h>
|
||||
|
||||
|
||||
static void ngx_http_init_request(ngx_event_t *ev);
|
||||
@@ -864,6 +865,8 @@ ngx_http_process_request_line(ngx_event_t *rev)
|
||||
}
|
||||
#endif
|
||||
|
||||
+ ngx_http_probe_read_req_line_done(r);
|
||||
+
|
||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
||||
"http request line: \"%V\"", &r->request_line);
|
||||
|
||||
@@ -1109,6 +1112,8 @@ ngx_http_process_request_headers(ngx_event_t *rev)
|
||||
return;
|
||||
}
|
||||
|
||||
+ ngx_http_probe_read_req_header_done(r, h);
|
||||
+
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||
"http header: \"%V: %V\"",
|
||||
&h->key, &h->value);
|
||||
@@ -1963,7 +1968,11 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
||||
}
|
||||
|
||||
if (r != r->main && r->post_subrequest) {
|
||||
+ ngx_http_probe_subrequest_post_start(r, rc);
|
||||
+
|
||||
rc = r->post_subrequest->handler(r, r->post_subrequest->data, rc);
|
||||
+
|
||||
+ ngx_http_probe_subrequest_post_done(r, rc);
|
||||
}
|
||||
|
||||
if (rc == NGX_ERROR
|
||||
@@ -2013,6 +2022,8 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
||||
|
||||
if (r->buffered || r->postponed) {
|
||||
|
||||
+ ngx_http_probe_subrequest_finalize_writing(r);
|
||||
+
|
||||
if (ngx_http_set_write_handler(r) != NGX_OK) {
|
||||
ngx_http_terminate_request(r, 0);
|
||||
}
|
||||
@@ -2049,10 +2060,14 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
||||
pr->postponed = pr->postponed->next;
|
||||
}
|
||||
|
||||
+ ngx_http_probe_subrequest_done(r);
|
||||
+
|
||||
c->data = pr;
|
||||
|
||||
} else {
|
||||
|
||||
+ ngx_http_probe_subrequest_finalize_nonactive(r);
|
||||
+
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
||||
"http finalize non-active request: \"%V?%V\"",
|
||||
&r->uri, &r->args);
|
||||
@@ -2064,6 +2079,8 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
||||
}
|
||||
}
|
||||
|
||||
+ ngx_http_probe_subrequest_wake_parent(r);
|
||||
+
|
||||
if (ngx_http_post_request(pr, NULL) != NGX_OK) {
|
||||
r->main->count++;
|
||||
ngx_http_terminate_request(r, 0);
|
||||
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
|
||||
index f0e671a..37ec5d2 100644
|
||||
--- a/src/http/ngx_http_request_body.c
|
||||
+++ b/src/http/ngx_http_request_body.c
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
#include <ngx_http.h>
|
||||
+#include <ngx_http_probe.h>
|
||||
|
||||
|
||||
static void ngx_http_read_client_request_body_handler(ngx_http_request_t *r);
|
||||
@@ -40,11 +41,15 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
|
||||
r->main->count++;
|
||||
|
||||
if (r->request_body || r->discard_body || r->content_length_n == 0) {
|
||||
+ ngx_http_probe_read_body_abort(r,
|
||||
+ r->request_body ? "body exists"
|
||||
+ : "body discarded");
|
||||
post_handler(r);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
if (ngx_http_test_expect(r) != NGX_OK) {
|
||||
+ ngx_http_probe_read_body_abort(r, "test expect failed");
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
@@ -56,6 +61,7 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
|
||||
r->request_body = rb;
|
||||
|
||||
if (r->headers_in.content_length_n < 0) {
|
||||
+ ngx_http_probe_read_body_abort(r, "no content length");
|
||||
post_handler(r);
|
||||
return NGX_OK;
|
||||
}
|
||||
@@ -89,10 +95,13 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
|
||||
tf->persistent, tf->clean, tf->access)
|
||||
!= NGX_OK)
|
||||
{
|
||||
+ ngx_http_probe_read_body_abort(r, "create temp file failed");
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
+ ngx_http_probe_read_body_done(r);
|
||||
+
|
||||
post_handler(r);
|
||||
|
||||
return NGX_OK;
|
||||
@@ -148,10 +157,13 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
|
||||
|
||||
if (r->request_body_in_file_only) {
|
||||
if (ngx_http_write_request_body(r, rb->bufs) != NGX_OK) {
|
||||
+ ngx_http_probe_read_body_abort(r, "write temp file failed");
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
+ ngx_http_probe_read_body_done(r);
|
||||
+
|
||||
post_handler(r);
|
||||
|
||||
return NGX_OK;
|
||||
@@ -245,6 +257,7 @@ ngx_http_read_client_request_body_handler(ngx_http_request_t *r)
|
||||
ngx_int_t rc;
|
||||
|
||||
if (r->connection->read->timedout) {
|
||||
+ ngx_http_probe_read_body_abort(r, "timed out");
|
||||
r->connection->timedout = 1;
|
||||
ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT);
|
||||
return;
|
||||
@@ -279,6 +292,7 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
|
||||
if (rb->buf->last == rb->buf->end) {
|
||||
|
||||
if (ngx_http_write_request_body(r, rb->to_write) != NGX_OK) {
|
||||
+ ngx_http_probe_read_body_abort(r, "write temp file failed");
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
@@ -302,6 +316,9 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
|
||||
}
|
||||
|
||||
if (n == 0) {
|
||||
+
|
||||
+ ngx_http_probe_read_body_abort(r, "connection closed");
|
||||
+
|
||||
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
||||
"client prematurely closed connection");
|
||||
}
|
||||
@@ -352,6 +369,7 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
|
||||
/* save the last part */
|
||||
|
||||
if (ngx_http_write_request_body(r, rb->to_write) != NGX_OK) {
|
||||
+ ngx_http_probe_read_body_abort(r, "write temp file failed");
|
||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
@@ -381,6 +399,8 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
|
||||
|
||||
r->read_event_handler = ngx_http_block_reading;
|
||||
|
||||
+ ngx_http_probe_read_body_done(r);
|
||||
+
|
||||
rb->post_handler(r);
|
||||
|
||||
return NGX_OK;
|
@ -1,113 +0,0 @@
|
||||
--- src/http/modules/ngx_http_fastcgi_module.c
|
||||
+++ src/http/modules/ngx_http_fastcgi_module.c
|
||||
@@ -1501,10 +1501,10 @@ ngx_http_fastcgi_process_header(ngx_http
|
||||
h->lowcase_key = h->key.data + h->key.len + 1
|
||||
+ h->value.len + 1;
|
||||
|
||||
- ngx_cpystrn(h->key.data, r->header_name_start,
|
||||
- h->key.len + 1);
|
||||
- ngx_cpystrn(h->value.data, r->header_start,
|
||||
- h->value.len + 1);
|
||||
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
|
||||
+ h->key.data[h->key.len] = '\0';
|
||||
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
|
||||
+ h->value.data[h->value.len] = '\0';
|
||||
}
|
||||
|
||||
h->hash = r->header_hash;
|
||||
--- src/http/modules/ngx_http_proxy_module.c
|
||||
+++ src/http/modules/ngx_http_proxy_module.c
|
||||
@@ -1381,8 +1381,10 @@ ngx_http_proxy_process_header(ngx_http_r
|
||||
h->value.data = h->key.data + h->key.len + 1;
|
||||
h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
|
||||
|
||||
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
|
||||
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
|
||||
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
|
||||
+ h->key.data[h->key.len] = '\0';
|
||||
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
|
||||
+ h->value.data[h->value.len] = '\0';
|
||||
|
||||
if (h->key.len == r->lowcase_index) {
|
||||
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
|
||||
--- src/http/modules/ngx_http_scgi_module.c
|
||||
+++ src/http/modules/ngx_http_scgi_module.c
|
||||
@@ -941,8 +941,10 @@ ngx_http_scgi_process_header(ngx_http_re
|
||||
h->value.data = h->key.data + h->key.len + 1;
|
||||
h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
|
||||
|
||||
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
|
||||
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
|
||||
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
|
||||
+ h->key.data[h->key.len] = '\0';
|
||||
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
|
||||
+ h->value.data[h->value.len] = '\0';
|
||||
|
||||
if (h->key.len == r->lowcase_index) {
|
||||
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
|
||||
--- src/http/modules/ngx_http_uwsgi_module.c
|
||||
+++ src/http/modules/ngx_http_uwsgi_module.c
|
||||
@@ -985,8 +985,10 @@ ngx_http_uwsgi_process_header(ngx_http_r
|
||||
h->value.data = h->key.data + h->key.len + 1;
|
||||
h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
|
||||
|
||||
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
|
||||
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
|
||||
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
|
||||
+ h->key.data[h->key.len] = '\0';
|
||||
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
|
||||
+ h->value.data[h->value.len] = '\0';
|
||||
|
||||
if (h->key.len == r->lowcase_index) {
|
||||
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
|
||||
--- src/http/ngx_http_parse.c
|
||||
+++ src/http/ngx_http_parse.c
|
||||
@@ -874,6 +874,10 @@ ngx_http_parse_header_line(ngx_http_requ
|
||||
break;
|
||||
}
|
||||
|
||||
+ if (ch == '\0') {
|
||||
+ return NGX_HTTP_PARSE_INVALID_HEADER;
|
||||
+ }
|
||||
+
|
||||
r->invalid_header = 1;
|
||||
|
||||
break;
|
||||
@@ -936,6 +940,10 @@ ngx_http_parse_header_line(ngx_http_requ
|
||||
break;
|
||||
}
|
||||
|
||||
+ if (ch == '\0') {
|
||||
+ return NGX_HTTP_PARSE_INVALID_HEADER;
|
||||
+ }
|
||||
+
|
||||
r->invalid_header = 1;
|
||||
|
||||
break;
|
||||
@@ -954,6 +962,8 @@ ngx_http_parse_header_line(ngx_http_requ
|
||||
r->header_start = p;
|
||||
r->header_end = p;
|
||||
goto done;
|
||||
+ case '\0':
|
||||
+ return NGX_HTTP_PARSE_INVALID_HEADER;
|
||||
default:
|
||||
r->header_start = p;
|
||||
state = sw_value;
|
||||
@@ -975,6 +985,8 @@ ngx_http_parse_header_line(ngx_http_requ
|
||||
case LF:
|
||||
r->header_end = p;
|
||||
goto done;
|
||||
+ case '\0':
|
||||
+ return NGX_HTTP_PARSE_INVALID_HEADER;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -988,6 +1000,8 @@ ngx_http_parse_header_line(ngx_http_requ
|
||||
break;
|
||||
case LF:
|
||||
goto done;
|
||||
+ case '\0':
|
||||
+ return NGX_HTTP_PARSE_INVALID_HEADER;
|
||||
default:
|
||||
state = sw_value;
|
||||
break;
|
@ -1,27 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User Maxim Dounin <mdounin@mdounin.ru>
|
||||
# Date 1309799136 -14400
|
||||
# Node ID 99e276bba8596bc4df9e638482ee413f4c6bf700
|
||||
# Parent e7b2f945d55ae44a2295facf9e3336dc4633e5b5
|
||||
Core: fix body with request_body_in_single_buf.
|
||||
|
||||
If there were preread data and request body was big enough first part
|
||||
of request body was duplicated.
|
||||
|
||||
See report here:
|
||||
http://nginx.org/pipermail/nginx/2011-July/027756.html
|
||||
|
||||
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
|
||||
--- a/src/http/ngx_http_request_body.c
|
||||
+++ b/src/http/ngx_http_request_body.c
|
||||
@@ -372,7 +372,9 @@ ngx_http_do_read_client_request_body(ngx
|
||||
}
|
||||
}
|
||||
|
||||
- if (r->request_body_in_file_only && rb->bufs->next) {
|
||||
+ if (rb->bufs->next
|
||||
+ && (r->request_body_in_file_only || r->request_body_in_single_buf))
|
||||
+ {
|
||||
rb->bufs = rb->bufs->next;
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
# HG changeset patch
|
||||
# User Maxim Dounin <mdounin@mdounin.ru>
|
||||
# Date 1309776931 -14400
|
||||
# Node ID e7b2f945d55ae44a2295facf9e3336dc4633e5b5
|
||||
# Parent 610e909bb9e29766188aa86fae3abe0bd3432940
|
||||
Core: fix body if it's preread and there are extra data.
|
||||
|
||||
--- nginx-1.2.1/src/http/ngx_http_request_body.c 2011-07-05 12:11:21.619264633 +0800
|
||||
+++ nginx-1.2.1-patched/src/http/ngx_http_request_body.c 2011-07-05 12:14:30.694321554 +0800
|
||||
@@ -141,6 +141,7 @@
|
||||
|
||||
/* the whole request body was pre-read */
|
||||
|
||||
+ b->last = b->pos + r->headers_in.content_length_n;
|
||||
r->header_in->pos += (size_t) r->headers_in.content_length_n;
|
||||
r->request_length += r->headers_in.content_length_n;
|
||||
|
@ -1,73 +0,0 @@
|
||||
--- nginx-1.2.1/src/http/ngx_http_variables.c 2011-05-30 20:36:17.000000000 +0800
|
||||
+++ nginx-1.2.1-patched/src/http/ngx_http_variables.c 2011-11-08 22:21:55.229247198 +0800
|
||||
@@ -648,7 +648,17 @@
|
||||
|
||||
a = (ngx_array_t *) ((char *) r + data);
|
||||
|
||||
- n = a->nelts;
|
||||
+ h = a->elts;
|
||||
+ n = 0;
|
||||
+
|
||||
+ for (i = 0; i < a->nelts; i++) {
|
||||
+
|
||||
+ if (h[i]->hash == 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ n++;
|
||||
+ }
|
||||
|
||||
if (n == 0) {
|
||||
v->not_found = 1;
|
||||
@@ -659,9 +669,7 @@
|
||||
v->no_cacheable = 0;
|
||||
v->not_found = 0;
|
||||
|
||||
- h = a->elts;
|
||||
-
|
||||
- if (n == 1) {
|
||||
+ if (n == 1 && a->nelts == 1) {
|
||||
v->len = (*h)->value.len;
|
||||
v->data = (*h)->value.data;
|
||||
|
||||
@@ -670,7 +678,12 @@
|
||||
|
||||
len = - (ssize_t) (sizeof("; ") - 1);
|
||||
|
||||
- for (i = 0; i < n; i++) {
|
||||
+ for (i = 0; i < a->nelts; i++) {
|
||||
+
|
||||
+ if (h[i]->hash == 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
len += h[i]->value.len + sizeof("; ") - 1;
|
||||
}
|
||||
|
||||
@@ -683,9 +696,14 @@
|
||||
v->data = p;
|
||||
|
||||
for (i = 0; /* void */ ; i++) {
|
||||
+
|
||||
+ if (h[i]->hash == 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
p = ngx_copy(p, h[i]->value.data, h[i]->value.len);
|
||||
|
||||
- if (i == n - 1) {
|
||||
+ if (--n == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -738,6 +756,10 @@
|
||||
i = 0;
|
||||
}
|
||||
|
||||
+ if (header[i].hash == 0) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
for (n = 0; n + prefix < var->len && n < header[i].key.len; n++) {
|
||||
ch = header[i].key.data[n];
|
||||
|
588
t/sanity.t
588
t/sanity.t
File diff suppressed because it is too large
Load Diff
26
util/configure
vendored
26
util/configure
vendored
@ -776,7 +776,7 @@ _EOC_
|
||||
"\$(MAKE) install$extra_opts";
|
||||
}
|
||||
|
||||
for my $key (qw(memcached redis mysql string upload)) {
|
||||
for my $key (qw(dns memcached redis mysql string upload)) {
|
||||
unless ($opts->{"no_lua_resty_$key"}) {
|
||||
my $name = "lua-resty-$key";
|
||||
my $dir = auto_complete $name;
|
||||
@ -826,6 +826,8 @@ sub usage ($) {
|
||||
|
||||
--with-debug enable the debugging logging and also enable -O0 -g for gcc.
|
||||
this not only affects nginx, but also other components.
|
||||
--with-dtrace-probes enable dtrace USDT probes
|
||||
--with-dtrace=PATH set dtrace utility pathname
|
||||
|
||||
--with-no-pool-patch enable the no-pool patch for debugging memory issues.
|
||||
|
||||
@ -889,6 +891,7 @@ _EOC_
|
||||
--without-lua_cjson disable the lua-cjson library
|
||||
--without-lua_redis_parser disable the lua-redis-parser library
|
||||
--without-lua_rds_parser disable the lua-rds-parser library
|
||||
--without-lua_resty_dns disable the lua-resty-dns library
|
||||
--without-lua_resty_memcached disable the lua-resty-memcached library
|
||||
--without-lua_resty_redis disable the lua-resty-redis library
|
||||
--without-lua_resty_mysql disable the lua-resty-mysql library
|
||||
@ -906,16 +909,18 @@ _EOC_
|
||||
|
||||
Options directly inherited from nginx
|
||||
|
||||
--sbin-path=PATH set path to the nginx binary file
|
||||
--conf-path=PATH set path to the nginx.conf file
|
||||
--error-log-path=PATH set path to the error log
|
||||
--pid-path=PATH set path to nginx.pid file
|
||||
--lock-path=PATH set path to nginx.lock file
|
||||
--sbin-path=PATH set nginx binary pathname
|
||||
--conf-path=PATH set nginx.conf pathname
|
||||
--error-log-path=PATH set error log pathname
|
||||
--pid-path=PATH set nginx.pid pathname
|
||||
--lock-path=PATH set nginx.lock pathname
|
||||
--tapset-prefix=PATH set systemtap tapset directory prefix
|
||||
--stap-nginx-path=PATH set stap-nginx pathname
|
||||
|
||||
--user=USER set non-privilege user
|
||||
for the worker processes
|
||||
--group=GROUP set non-privilege group
|
||||
for the worker processes
|
||||
--user=USER set non-privileged user for
|
||||
worker processes
|
||||
--group=GROUP set non-privileged group for
|
||||
worker processes
|
||||
|
||||
--builddir=DIR set the build directory
|
||||
|
||||
@ -1007,6 +1012,7 @@ Options directly inherited from nginx
|
||||
--with-pcre force PCRE library usage
|
||||
--with-pcre=DIR set path to PCRE library sources
|
||||
--with-pcre-opt=OPTIONS set additional options for PCRE building
|
||||
--with-pcre-jit build PCRE with JIT compilation support
|
||||
|
||||
--with-md5=DIR set path to md5 library sources
|
||||
--with-md5-opt=OPTIONS set additional options for md5 building
|
||||
|
@ -90,6 +90,9 @@ patch -p1 < $root/patches/nginx-$main_ver-poll_del_event_at_exit.patch
|
||||
echo applying location_if_inherits_proxy.patch ...
|
||||
patch -p1 < $root/patches/nginx-$main_ver-location_if_inherits_proxy.patch
|
||||
|
||||
echo applying dtrace.patch ...
|
||||
patch -p1 < $root/patches/nginx-$main_ver-dtrace.patch
|
||||
|
||||
rm -f *.patch || exit 1
|
||||
|
||||
cd .. || exit 1
|
||||
@ -103,7 +106,7 @@ rm -rf no-pool-nginx-$ver
|
||||
|
||||
#################################
|
||||
|
||||
ver=0.40
|
||||
ver=0.41
|
||||
$root/util/get-tarball "http://github.com/agentzh/echo-nginx-module/tarball/v$ver" -O echo-nginx-module-$ver.tar.gz || exit 1
|
||||
tar -xzf echo-nginx-module-$ver.tar.gz || exit 1
|
||||
mv agentzh-echo-nginx-module-* echo-nginx-module-$ver || exit 1
|
||||
@ -145,21 +148,21 @@ mv agentzh-rds-csv-nginx-module-* rds-csv-nginx-module-$ver || exit 1
|
||||
|
||||
#################################
|
||||
|
||||
ver=0.17
|
||||
ver=0.18
|
||||
$root/util/get-tarball "http://github.com/agentzh/headers-more-nginx-module/tarball/v$ver" -O headers-more-nginx-module-$ver.tar.gz || exit 1
|
||||
tar -xzf headers-more-nginx-module-$ver.tar.gz || exit 1
|
||||
mv agentzh-headers-more-nginx-module-* headers-more-nginx-module-$ver || exit 1
|
||||
|
||||
#################################
|
||||
|
||||
ver=0.1.2rc7
|
||||
ver=0.1.2
|
||||
$root/util/get-tarball "http://github.com/chaoslawful/drizzle-nginx-module/tarball/v$ver" -O drizzle-nginx-module-$ver.tar.gz || exit 1
|
||||
tar -xzf drizzle-nginx-module-$ver.tar.gz || exit 1
|
||||
mv chaoslawful-drizzle-nginx-module-* drizzle-nginx-module-$ver || exit 1
|
||||
|
||||
#################################
|
||||
|
||||
ver=0.5.7
|
||||
ver=0.5.13
|
||||
$root/util/get-tarball "http://github.com/chaoslawful/lua-nginx-module/tarball/v$ver" -O lua-nginx-module-$ver.tar.gz || exit 1
|
||||
tar -xzf lua-nginx-module-$ver.tar.gz || exit 1
|
||||
mv chaoslawful-lua-nginx-module-* ngx_lua-$ver || exit 1
|
||||
@ -305,6 +308,13 @@ mv agentzh-lua-rds-parser-* lua-rds-parser-$ver || exit 1
|
||||
|
||||
#################################
|
||||
|
||||
ver=0.05
|
||||
$root/util/get-tarball "http://github.com/agentzh/lua-resty-dns/tarball/v$ver" -O "lua-resty-dns-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-dns-$ver.tar.gz || exit 1
|
||||
mv agentzh-lua-resty-dns-* lua-resty-dns-$ver || exit 1
|
||||
|
||||
#################################
|
||||
|
||||
ver=0.07
|
||||
$root/util/get-tarball "http://github.com/agentzh/lua-resty-memcached/tarball/v$ver" -O "lua-resty-memcached-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-memcached-$ver.tar.gz || exit 1
|
||||
@ -319,7 +329,7 @@ mv agentzh-lua-resty-redis-* lua-resty-redis-$ver || exit 1
|
||||
|
||||
#################################
|
||||
|
||||
ver=0.09
|
||||
ver=0.10
|
||||
$root/util/get-tarball "http://github.com/agentzh/lua-resty-mysql/tarball/v$ver" -O "lua-resty-mysql-$ver.tar.gz" || exit 1
|
||||
tar -xzf lua-resty-mysql-$ver.tar.gz || exit 1
|
||||
mv agentzh-lua-resty-mysql-* lua-resty-mysql-$ver || exit 1
|
||||
|
Reference in New Issue
Block a user