diff options
-rw-r--r-- | www/Makefile | 1 | ||||
-rw-r--r-- | www/tengine/Makefile | 881 | ||||
-rw-r--r-- | www/tengine/distinfo | 96 | ||||
-rw-r--r-- | www/tengine/files/extra-patch-agentzh-set-misc-nginx-module-config | 13 | ||||
-rw-r--r-- | www/tengine/files/extra-patch-calio-iconv-nginx-module-config | 19 | ||||
-rw-r--r-- | www/tengine/files/extra-patch-chaoslawful-drizzle-nginx-module-config | 19 | ||||
-rw-r--r-- | www/tengine/files/extra-patch-nginx-modsecurity-config | 10 | ||||
-rw-r--r-- | www/tengine/files/extra-patch-ngx_http_notice_module.c | 11 | ||||
-rw-r--r-- | www/tengine/files/extra-patch-ngx_http_sflow_config.c | 10 | ||||
-rw-r--r-- | www/tengine/files/extra-patch-ngx_http_sflow_config.h | 11 | ||||
-rw-r--r-- | www/tengine/files/extra-patch-ngx_http_upload_module.c | 1658 | ||||
-rw-r--r-- | www/tengine/files/extra-patch-ngx_http_upstream.h | 13 | ||||
-rw-r--r-- | www/tengine/files/extra-patch-ngx_postgres-config | 19 | ||||
-rw-r--r-- | www/tengine/files/nginx.in | 116 | ||||
-rw-r--r-- | www/tengine/files/patch-conf-nginx.conf | 100 | ||||
-rw-r--r-- | www/tengine/files/patch-man-nginx | 108 | ||||
-rw-r--r-- | www/tengine/pkg-descr | 7 | ||||
-rw-r--r-- | www/tengine/pkg-plist | 205 |
18 files changed, 3297 insertions, 0 deletions
diff --git a/www/Makefile b/www/Makefile index 8fdc0d78960f..814533f1afd0 100644 --- a/www/Makefile +++ b/www/Makefile @@ -1956,6 +1956,7 @@ SUBDIR += tdom SUBDIR += template_ SUBDIR += templatelite + SUBDIR += tengine SUBDIR += testlink SUBDIR += textpattern SUBDIR += thttpd diff --git a/www/tengine/Makefile b/www/tengine/Makefile new file mode 100644 index 000000000000..41856a2ed61e --- /dev/null +++ b/www/tengine/Makefile @@ -0,0 +1,881 @@ +# Created by: Jim Ohlstein <jim@ohlste.in> +# $FreeBSD$ + +PORTNAME= tengine +PORTVERSION= 2.0.3 +CATEGORIES= www +MASTER_SITES= GH + +MAINTAINER= robak@FreeBSD.org +COMMENT= Robust and small WWW server forked from nginx by Taobao + +LICENSE= BSD2CLAUSE + +WANT_GNOME= yes +USE_GNOME= libxml2 libxslt +USE_GITHUB= yes +GH_ACCOUNT= alibaba +GH_TAGNAME= ${PORTNAME}-${PORTVERSION} +GH_COMMIT= 5272608 + +LIB_DEPENDS+= libluajit-5.1.so:${PORTSDIR}/lang/luajit \ + libeio.so:${PORTSDIR}/devel/libeio \ + libev.so:${PORTSDIR}/devel/libev \ + libgd.so:${PORTSDIR}/graphics/gd \ + libGeoIP.so:${PORTSDIR}/net/GeoIP + +NO_OPTIONS_SORT= yes +OPTIONS_DEFINE= \ + DEBUG \ + DEBUGLOG \ + FILE_AIO \ + IPV6 \ + HTTP \ + HTTP_CACHE \ + HTTP_DAV \ + HTTP_GZIP_STATIC \ + HTTP_PERL \ + HTTP_REALIP \ + HTTP_REWRITE \ + HTTP_SSL \ + HTTP_STATUS \ + MAIL \ + MAIL_IMAP \ + MAIL_POP3 \ + MAIL_SMTP \ + MAIL_SSL \ + CPP_TEST \ + TFS \ + WWW \ + CACHE_PURGE \ + ECHO \ + HEADERS_MORE \ + HTTP_ACCEPT_LANGUAGE \ + HTTP_ACCESSKEY \ + HTTP_AUTH_DIGEST \ + HTTP_AUTH_LDAP \ + HTTP_AUTH_PAM \ + HTTP_AUTH_REQ \ + HTTP_DAV_EXT \ + HTTP_EVAL \ + HTTP_FANCYINDEX \ + HTTP_MOGILEFS \ + HTTP_NOTICE \ + HTTP_PUSH \ + HTTP_PUSH_STREAM \ + HTTP_REDIS \ + HTTP_RESPONSE \ + HTTP_UPLOAD \ + HTTP_UPLOAD_PROGRESS \ + HTTP_UPSTREAM_FAIR \ + HTTP_VIDEO_THUMBEXTRACTOR \ + HTTP_ZIP \ + ARRAYVAR \ + DRIZZLE \ + ENCRYPTSESSION \ + FORMINPUT \ + GRIDFS \ + ICONV \ + LET \ + MEMC \ + MODSECURITY \ + POSTGRES \ + RDS_CSV \ + RDS_JSON \ + REDIS2 \ + RTMP \ + SET_MISC \ + SFLOW \ + SLOWFS_CACHE \ + SRCACHE \ + SUPERVISORD \ + TCP_PROXY \ + XRID_HEADER \ + XSS + +OPTIONS_DEFAULT= IPV6 HTTP HTTP_CACHE HTTP_REWRITE HTTP_STATUS WWW + +DEBUGLOG_DESC= Enable debug log (--with-debug) +FILE_AIO_DESC= Enable file aio +HTTP_DESC= Enable HTTP module +HTTP_CACHE_DESC= Enable http_cache module +HTTP_DAV_DESC= Enable http_webdav module +HTTP_GZIP_STATIC_DESC= Enable http_gzip_static module +HTTP_PERL_DESC= Enable http_perl module +HTTP_REALIP_DESC= Enable http_realip module +HTTP_REWRITE_DESC= Enable http_rewrite module +HTTP_SSL_DESC= Enable http_ssl module +HTTP_STATUS_DESC= Enable http_stub_status module +MAIL_DESC= Enable IMAP4/POP3/SMTP proxy module +MAIL_IMAP_DESC= Enable IMAP4 proxy module +MAIL_POP3_DESC= Enable POP3 proxy module +MAIL_SMTP_DESC= Enable SMTP proxy module +MAIL_SSL_DESC= Enable mail_ssl module +CPP_TEST_DESC= Enable CPP Test module +TFS_DESC= Enable TaoBao File System +WWW_DESC= Enable html sample files +CACHE_PURGE_DESC= 3rd party cache_purge module +ECHO_DESC= 3rd party echo module +HEADERS_MORE_DESC= 3rd party headers_more module +HTTP_ACCEPT_LANGUAGE_DESC= 3rd party accept_language module +HTTP_ACCESSKEY_DESC= 3rd party http_accesskey module +HTTP_AUTH_DIGEST_DESC= 3rd party http_authdigest module +HTTP_AUTH_LDAP_DESC= 3rd party http_auth_ldap module +HTTP_AUTH_PAM_DESC= 3rd party http_auth_pam module +HTTP_AUTH_REQ_DESC= 3rd party http_auth_request module +HTTP_DAV_EXT_DESC= 3rd party webdav_ext module +HTTP_EVAL_DESC= 3rd party eval module +HTTP_FANCYINDEX_DESC= 3rd party http_fancyindex module +HTTP_MOGILEFS_DESC= 3rd party mogilefs module +HTTP_NOTICE_DESC= 3rd party notice module +HTTP_PUSH_DESC= 3rd party push module +HTTP_PUSH_STREAM_DESC= 3rd party push stream module +HTTP_REDIS_DESC= 3rd party http_redis module +HTTP_RESPONSE_DESC= 3rd party http_response module +HTTP_UPLOAD_DESC= 3rd party upload module +HTTP_UPLOAD_PROGRESS_DESC= 3rd party uploadprogress module +HTTP_UPSTREAM_FAIR_DESC= 3rd party upstream fair module +HTTP_VIDEO_THUMBEXTRACTOR_DESC= 3rd party video_thumbextractor module +HTTP_ZIP_DESC= 3rd party http_zip module +ARRAYVAR_DESC= 3rd party array_var module +DRIZZLE_DESC= 3rd party drizzlie module +ENCRYPTSESSION_DESC= 3rd party encrypted_session module +FORMINPUT_DESC= 3rd party form_input module +GRIDFS_DESC= 3rd party gridfs module +ICONV_DESC= 3rd party iconv module +LET_DESC= 3rd party let module +MEMC_DESC= 3rd party memc (memcached) module +MODSECURITY_DESC= 3rd party mod_security module +POSTGRES_DESC= 3rd party postgresql module +RDS_CSV_DESC= 3rd party rds_csv module +RDS_JSON_DESC= 3rd party rds_json module +REDIS2_DESC= 3rd party redis2 module +RTMP_DESC= 3rd party rtmp module +SET_MISC_DESC= 3rd party set_misc module +SFLOW_DESC= 3rd party sflow module +SLOWFS_CACHE_DESC= 3rd party slowfs_cache module +SRCACHE_DESC= 3rd party srcache module +SUPERVISORD_DESC= 3rd party supervisord module +TCP_PROXY_DESC= 3rd party tcp_proxy module +XRID_HEADER_DESC= 3rd party x-rid header module +XSS_DESC= 3rd party xss module + +.include <bsd.port.options.mk> + +# FreeBSD 8 and earlier are unsupported +.if ${OPSYS} == FreeBSD && ${OSVERSION} < 900500 +IGNORE= is unsupported on FreeBSD 8 and earlier +.endif + +NGINX_VARDIR?= /var +NGINX_LOGDIR?= ${NGINX_VARDIR}/log +NGINX_RUNDIR?= ${NGINX_VARDIR}/run +NGINX_TMPDIR?= ${NGINX_VARDIR}/tmp/nginx +HTTP_PORT?= 80 + +NGINX_ACCESSLOG?= ${NGINX_LOGDIR}/nginx-access.log +NGINX_ERRORLOG?= ${NGINX_LOGDIR}/nginx-error.log + +CONFLICTS?= nginx-devel-[0-9].* nginx-[0-9].* + +USE_RC_SUBR= nginx +SUB_LIST+= WWWOWN=${WWWOWN} \ + WWWGRP=${WWWGRP} \ + NGINX_RUNDIR=${NGINX_RUNDIR} \ + NGINX_TMPDIR=${NGINX_TMPDIR} + +HAS_CONFIGURE= yes +CONFIGURE_ARGS+=--prefix=${ETCDIR} \ + --with-cc-opt="-I ${LOCALBASE}/include" \ + --with-ld-opt="-L ${LOCALBASE}/lib" \ + --conf-path=${ETCDIR}/nginx.conf \ + --sbin-path=${PREFIX}/sbin/nginx \ + --pid-path=${NGINX_RUNDIR}/nginx.pid \ + --error-log-path=${NGINX_ERRORLOG} \ + --user=${WWWOWN} --group=${WWWGRP} + +.if empty(PORT_OPTIONS:MHTTP) && empty(PORT_OPTIONS:MMAIL) +IGNORE= requires at least HTTP or MAIL to \ + be defined. Please do 'make config' again +.endif + +.if ${PORT_OPTIONS:MDEBUG} +CFLAGS+= -g +STRIP= # Avoid stripping if building tengine with debug information +.endif + +.if ${PORT_OPTIONS:MDEBUGLOG} +CONFIGURE_ARGS+=--with-debug +.endif + +.if ${PORT_OPTIONS:MFILE_AIO} +CONFIGURE_ARGS+=--with-file-aio +.endif + +.if ${PORT_OPTIONS:MIPV6} +CONFIGURE_ARGS+=--with-ipv6 +CATEGORIES+= ipv6 +.endif + +.if ${PORT_OPTIONS:MHTTP} +CONFIGURE_ARGS+=--dso-path=${ETCDIR}/modules \ + --with-http_access_module=shared \ + --with-http_addition_module=shared \ + --with-http_autoindex_module=shared \ + --with-http_browser_module=shared \ + --with-http_charset_filter_module=shared \ + --with-http_concat_module=shared \ + --with-http_empty_gif_module=shared \ + --with-http_fastcgi_module=shared \ + --with-http_flv_module=shared \ + --with-http_footer_filter_module=shared \ + --with-http_geoip_module=shared \ + --with-http_image_filter_module=shared \ + --with-http_limit_conn_module=shared \ + --with-http_limit_req_module=shared \ + --with-http_lua_module=shared \ + --with-http_map_module=shared \ + --with-http_memcached_module=shared \ + --with-http_mp4_module=shared \ + --with-http_random_index_module=shared \ + --with-http_referer_module=shared \ + --with-http_scgi_module=shared \ + --with-http_secure_link_module=shared \ + --with-http_slice_module=shared \ + --with-http_split_clients_module=shared \ + --with-http_sub_module=shared \ + --with-http_sysguard_module=shared \ + --with-http_trim_filter_module=shared \ + --with-http_upstream_ip_hash_module=shared \ + --with-http_upstream_least_conn_module=shared \ + --with-http_upstream_session_sticky_module=shared \ + --with-http_user_agent_module=shared \ + --with-http_userid_filter_module=shared \ + --with-http_uwsgi_module=shared \ + --with-http_xslt_module=shared \ + --http-client-body-temp-path=${NGINX_TMPDIR}/client_body_temp \ + --http-fastcgi-temp-path=${NGINX_TMPDIR}/fastcgi_temp \ + --http-proxy-temp-path=${NGINX_TMPDIR}/proxy_temp \ + --http-scgi-temp-path=${NGINX_TMPDIR}/scgi_temp \ + --http-uwsgi-temp-path=${NGINX_TMPDIR}/uwsgi_temp \ + --http-log-path=${NGINX_ACCESSLOG} + +.if ${PORT_OPTIONS:MHTTP_ACCEPT_LANGUAGE} +GIT_ACCEPT_LANGUAGE_VERSION= 2f69842 +MASTER_SITES+= https://github.com/giom/nginx_accept_language_module/tarball/master/:accept_language +DISTFILES+= giom-nginx_accept_language_module-${GIT_ACCEPT_LANGUAGE_VERSION}.tar.gz:accept_language +CONFIGURE_ARGS+=--add-module=${WRKDIR}/giom-nginx_accept_language_module-${GIT_ACCEPT_LANGUAGE_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_ACCESSKEY} +NGINX_ACCESSKEY_VERSION= 2.0.3 +MASTER_SITES+= ${MASTER_SITE_LOCAL:S/$/:accesskey/} +MASTER_SITE_SUBDIR+= osa/:accesskey +DISTFILES+= nginx-accesskey-${NGINX_ACCESSKEY_VERSION}.tar.gz:accesskey +CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx-accesskey-${NGINX_ACCESSKEY_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_AUTH_DIGEST} +GIT_AUTH_DIGEST_VERSION= bd1c86a +MASTER_SITES+= https://github.com/samizdatco/nginx-http-auth-digest/tarball/master/:auth_digest +DISTFILES+= samizdatco-nginx-http-auth-digest-${GIT_AUTH_DIGEST_VERSION}.tar.gz:auth_digest +CONFIGURE_ARGS+=--add-module=${WRKDIR}/samizdatco-nginx-http-auth-digest-${GIT_AUTH_DIGEST_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_GZIP_STATIC} +CONFIGURE_ARGS+=--with-http_gzip_static_module +.endif + +.if ${PORT_OPTIONS:MHTTP_AUTH_LDAP} +# WWW: https://github.com/kvspb/nginx-auth-ldap +GIT_HTTP_AUTH_LDAP_VERSION= c4dc7c9153 +MASTER_SITES+= LOCAL/rm:http_auth_ldap +DISTFILES+= http_auth_ldap-${GIT_HTTP_AUTH_LDAP_VERSION}.tar.gz:http_auth_ldap +CONFIGURE_ARGS+=--add-module=${WRKDIR}/http_auth_ldap-${GIT_HTTP_AUTH_LDAP_VERSION} +USE_OPENLDAP= yes +.endif + +.if ${PORT_OPTIONS:MHTTP_AUTH_PAM} +NGINX_AUTH_PAM_VERSION= 1.2 +MASTER_SITES+= http://web.iti.upv.es/~sto/nginx/:auth_pam +DISTFILES+= ngx_http_auth_pam_module-${NGINX_AUTH_PAM_VERSION}.tar.gz:auth_pam +CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_http_auth_pam_module-${NGINX_AUTH_PAM_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_AUTH_REQ} +NGINX_AUTH_REQ_VERSION= 0.2 +MASTER_SITES+= http://mdounin.ru/files/:auth_request +DISTFILES+= ngx_http_auth_request_module-${NGINX_AUTH_REQ_VERSION}.tar.gz:auth_request +CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_http_auth_request_module-${NGINX_AUTH_REQ_VERSION} +.endif + +.if empty(PORT_OPTIONS:MHTTP_CACHE) +CONFIGURE_ARGS+=--without-http-cache +.endif + +.if ${PORT_OPTIONS:MCACHE_PURGE} +NGINX_CACHE_PURGE_VERSION= 2.1 +MASTER_SITES+= http://labs.frickle.com/files/:cache_purge +DISTFILES+= ngx_cache_purge-${NGINX_CACHE_PURGE_VERSION}.tar.gz:cache_purge +CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_cache_purge-${NGINX_CACHE_PURGE_VERSION} +.endif + +.if ${PORT_OPTIONS:MECHO} +NGINX_ECHO_VERSION= 0.50 +GIT_ECHO_VERSION= 0-gf827a4f +MASTER_SITES+= https://github.com/agentzh/echo-nginx-module/tarball/v${NGINX_ECHO_VERSION}/:echo +DISTFILES+= agentzh-echo-nginx-module-v${NGINX_ECHO_VERSION}-${GIT_ECHO_VERSION}.tar.gz:echo +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-echo-nginx-module-${GIT_ECHO_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MHEADERS_MORE} +NGINX_HEADERS_MORE_VERSION= 0.24 +GIT_HEADERS_MORE_VERSION= 0-g7a6fd11 +MASTER_SITES+= https://github.com/agentzh/headers-more-nginx-module/tarball/v${NGINX_HEADERS_MORE_VERSION}/:headers_more +DISTFILES+= agentzh-headers-more-nginx-module-v${NGINX_HEADERS_MORE_VERSION}-${GIT_HEADERS_MORE_VERSION}.tar.gz:headers_more +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-headers-more-nginx-module-${GIT_HEADERS_MORE_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MHTTP_DAV} +CONFIGURE_ARGS+=--with-http_dav_module +.endif + +.if ${PORT_OPTIONS:MHTTP_DAV_EXT} +LIB_DEPENDS+= libexpat.so:${PORTSDIR}/textproc/expat2 +NGINX_DAV_EXT_VERSION= 0.0.2 +GIT_DAV_EXT_VERSION= 0-g0e07a3e +MASTER_SITES+= https://github.com/arut/nginx-dav-ext-module/tarball/v${NGINX_DAV_EXT_VERSION}/:dav_ext +DISTFILES+= arut-nginx-dav-ext-module-v${NGINX_DAV_EXT_VERSION}-${GIT_DAV_EXT_VERSION}.tar.gz:dav_ext +CONFIGURE_ARGS+=--add-module=${WRKDIR}/arut-nginx-dav-ext-module-${GIT_DAV_EXT_VERSION:S/^0-g//} \ + --with-http_dav_module +.endif + +.if ${PORT_OPTIONS:MHTTP_EVAL} +NGINX_EVAL_VERSION= 1.0.3 +GIT_EVAL_VERSION= 0-g125fa2e +MASTER_SITES+= https://github.com/vkholodkov/nginx-eval-module/tarball/${NGINX_EVAL_VERSION}/:eval +DISTFILES+= vkholodkov-nginx-eval-module-${NGINX_EVAL_VERSION}-${GIT_EVAL_VERSION}.tar.gz:eval +CONFIGURE_ARGS+=--add-module=${WRKDIR}/vkholodkov-nginx-eval-module-${GIT_EVAL_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MHTTP_FANCYINDEX} +NGINX_FANCYINDEX_VERSION= 0.3.1 +MASTER_SITES+= ${MASTER_SITE_LOCAL:S/$/:fancyindex/} +MASTER_SITE_SUBDIR+= osa/:fancyindex +DISTFILES+= ngx-fancyindex-${NGINX_FANCYINDEX_VERSION}.tar.gz:fancyindex +CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx-fancyindex-${NGINX_FANCYINDEX_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_GZIP_STATIC} +CONFIGURE_ARGS+=--with-http_gzip_static_module +.endif + +.if ${PORT_OPTIONS:MHTTP_MOGILEFS} +NGINX_MOGILEFS_VERSION= 1.0.4 +MASTER_SITES+= http://www.grid.net.ru/nginx/download/:mogilefs +DISTFILES+= nginx_mogilefs_module-${NGINX_MOGILEFS_VERSION}.tar.gz:mogilefs +CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_mogilefs_module-${NGINX_MOGILEFS_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_NOTICE} +GIT_NOTICE_VERSION= 0-g3c95966 +MASTER_SITES+= https://github.com/kr/nginx-notice/tarball/master/:notice +DISTFILES+= kr-nginx-notice-${GIT_NOTICE_VERSION}.tar.gz:notice +CONFIGURE_ARGS+=--add-module=${WRKDIR}/kr-nginx-notice-${GIT_NOTICE_VERSION:S/^0-g//} +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_notice_module.c +.endif + +.if ${PORT_OPTIONS:MHTTP_PERL} +CATEGORIES+= perl5 +CONFIGURE_ARGS+=--with-http_perl_module +USES+= perl5 +.endif + +.if ${PORT_OPTIONS:MHTTP_PUSH} +NGINX_PUSH_VERSION= 0.692 +MASTER_SITES+= http://pushmodule.slact.net/downloads/:push +DISTFILES+= nginx_http_push_module-${NGINX_PUSH_VERSION}.tar.gz:push +CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_http_push_module-${NGINX_PUSH_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_PUSH_STREAM} +NGINX_PUSH_STREAM_VERSION= 0.3.5 +GIT_PUSH_STREAM_VERSION= 0-gb6a8c46 +MASTER_SITES+= https://github.com/wandenberg/nginx-push-stream-module/tarball/${NGINX_PUSH_STREAM_VERSION}/:pushstream +DISTFILES+= wandenberg-nginx-push-stream-module-${NGINX_PUSH_STREAM_VERSION}-${GIT_PUSH_STREAM_VERSION}.tar.gz:pushstream +CONFIGURE_ARGS+=--add-module=${WRKDIR}/wandenberg-nginx-push-stream-module-${GIT_PUSH_STREAM_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MHTTP_REALIP} +CONFIGURE_ARGS+=--with-http_realip_module +.endif + +.if ${PORT_OPTIONS:MHTTP_REDIS} +NGINX_REDIS_VERSION= 0.3.7 +MASTER_SITES+= ${MASTER_SITE_LOCAL:S/$/:redis/} +MASTER_SITE_SUBDIR+= osa/:redis +DISTFILES+= ngx_http_redis-${NGINX_REDIS_VERSION}.tar.gz:redis +CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_http_redis-${NGINX_REDIS_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_RESPONSE} +NGINX_RESPONSE_VERSION= 0.3 +MASTER_SITES+= http://catap.ru/downloads/nginx/:response +DISTFILES+= ngx_http_response-${NGINX_RESPONSE_VERSION}.tar.gz:response +CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_http_response-${NGINX_RESPONSE_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_STATUS} +CONFIGURE_ARGS+=--with-http_stub_status_module +.endif + +.if ${PORT_OPTIONS:MHTTP_UPLOAD} +NGINX_UPLOAD_VERSION= 2.2.0 +MASTER_SITES+= http://www.grid.net.ru/nginx/download/:upload +DISTFILES+= nginx_upload_module-${NGINX_UPLOAD_VERSION}.tar.gz:upload +CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_upload_module-${NGINX_UPLOAD_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_UPLOAD_PROGRESS} +NGINX_UPLOADPROGRESS_VERSION= 0.9.0 +GIT_UPLOADPROGRESS_VERSION= 0-ga788dea +MASTER_SITES+= https://github.com/masterzen/nginx-upload-progress-module/tarball/v${NGINX_UPLOADPROGRESS_VERSION}/:uploadprogress +DISTFILES+= masterzen-nginx-upload-progress-module-v${NGINX_UPLOADPROGRESS_VERSION}-${GIT_UPLOADPROGRESS_VERSION}.tar.gz:uploadprogress +CONFIGURE_ARGS+=--add-module=${WRKDIR}/masterzen-nginx-upload-progress-module-${GIT_UPLOADPROGRESS_VERSION:S/^0-g//} +.endif + +.if !empty(PORT_OPTIONS:MHTTP_UPSTREAM_FAIR) || !empty(PORT_OPTIONS:MSUPERVISORD) +NGINX_UPSTREAM_FAIR_VERSION= 20090923 +MASTER_SITES+= ${MASTER_SITE_LOCAL:S/$/:upstreamfair/} +MASTER_SITE_SUBDIR+= osa/:upstreamfair +DISTFILES+= nginx_upstream_fair-${NGINX_UPSTREAM_FAIR_VERSION}.tar.gz:upstreamfair +CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx_upstream_fair-${NGINX_UPSTREAM_FAIR_VERSION} +.endif + +.if ${PORT_OPTIONS:MHTTP_VIDEO_THUMBEXTRACTOR} +LIB_DEPENDS+= libjpeg.so:${PORTSDIR}/graphics/jpeg \ + libavformat.so:${PORTSDIR}/multimedia/ffmpeg \ + libavcodec.so:${PORTSDIR}/multimedia/ffmpeg \ + libavutil.so:${PORTSDIR}/multimedia/ffmpeg \ + libswscale.so:${PORTSDIR}/multimedia/ffmpeg \ + libMagickWand.so:${PORTSDIR}/graphics/ImageMagick +NGINX_VIDEO_THUMBEXTRACTOR_VERSION= 0.2.0 +GIT_VIDEO_THUMBEXTRACTOR_VERSION= 0-g9406457 +MASTER_SITES+= https://github.com/wandenberg/nginx-video-thumbextractor-module/tarball/${NGINX_VIDEO_THUMBEXTRACTOR_VERSION}/:videothumbextractor +DISTFILES+= wandenberg-nginx-video-thumbextractor-module-${NGINX_VIDEO_THUMBEXTRACTOR_VERSION}-${GIT_VIDEO_THUMBEXTRACTOR_VERSION}.tar.gz:videothumbextractor +CONFIGURE_ARGS+=--add-module=${WRKDIR}/wandenberg-nginx-video-thumbextractor-module-${GIT_VIDEO_THUMBEXTRACTOR_VERSION:S/^0-g//} \ + --with-cc-opt="-I ${LOCALBASE}/include -I ${LOCALBASE}/include/ImageMagick" +.endif + +.if ${PORT_OPTIONS:MHTTP_ZIP} +NGINX_ZIP_VERSION= 1.1.6 +MASTER_SITES+= http://mod-zip.googlecode.com/files/:zip +DISTFILES+= mod_zip-${NGINX_ZIP_VERSION}.tar.gz:zip +CONFIGURE_ARGS+=--add-module=${WRKDIR}/mod_zip-${NGINX_ZIP_VERSION} +.endif + +.if ${PORT_OPTIONS:MDRIZZLE} +LIB_DEPENDS+= libdrizzle.so:${PORTSDIR}/databases/libdrizzle +NGINX_DRIZZLE_VERSION= 0.1.6 +GIT_DRIZZLE_VERSION= 0-ge6937ba +MASTER_SITES+= https://github.com/chaoslawful/drizzle-nginx-module/tarball/v${NGINX_DRIZZLE_VERSION}/:drizzle +DISTFILES+= chaoslawful-drizzle-nginx-module-v${NGINX_DRIZZLE_VERSION}-${GIT_DRIZZLE_VERSION}.tar.gz:drizzle +CONFIGURE_ARGS+=--add-module=${WRKDIR}/chaoslawful-drizzle-nginx-module-${GIT_DRIZZLE_VERSION:S/^0-g//} +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-chaoslawful-drizzle-nginx-module-config +.endif + +.if ${PORT_OPTIONS:MARRAYVAR} || ${PORT_OPTIONS:MENCRYPTSESSION} || ${PORT_OPTIONS:MFORMINPUT} || ${PORT_OPTIONS:MICONV} || ${PORT_OPTIONS:MSET_MISC} +WITH_HTTP_REWRITE= yes +NGINX_DEVEL_KIT_VERSION= 0.2.19 +GIT_DEVEL_KIT_VERSION= 0-g8dd0df5 +MASTER_SITES+= https://github.com/simpl/ngx_devel_kit/tarball/v${NGINX_DEVEL_KIT_VERSION}/:devel_kit +DISTFILES+= simpl-ngx_devel_kit-v${NGINX_DEVEL_KIT_VERSION}-${GIT_DEVEL_KIT_VERSION}.tar.gz:devel_kit +CONFIGURE_ARGS+=--add-module=${WRKDIR}/simpl-ngx_devel_kit-${GIT_DEVEL_KIT_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MENCRYPTSESSION} +NGINX_ENCRYPTSESSION_VERSION= 0.03 +GIT_ENCRYPTSESSION_VERSION= 0-g49d741b +MASTER_SITES+= https://github.com/agentzh/encrypted-session-nginx-module/tarball/v${NGINX_ENCRYPTSESSION_VERSION}/:encryptsession +DISTFILES+= agentzh-encrypted-session-nginx-module-v${NGINX_ENCRYPTSESSION_VERSION}-${GIT_ENCRYPTSESSION_VERSION}.tar.gz:encryptsession +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-encrypted-session-nginx-module-${GIT_ENCRYPTSESSION_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MGRIDFS} +NGINX_GRIDFS_VERSION= 0.8 +GIT_GRIDFS_VERSION= 0-gb5f8113 +MONGO_C_DRIVER_VERSION= 0.3.1 +GIT_MONGO_C_DRIVER_VERSION= 0-g9b4b232 +MASTER_SITES+= https://github.com/mdirolf/nginx-gridfs/tarball/v${NGINX_GRIDFS_VERSION}/:gridfs +MASTER_SITES+= https://github.com/mongodb/mongo-c-driver/tarball/v${MONGO_C_DRIVER_VERSION}/:mongo_c +DISTFILES+= mdirolf-nginx-gridfs-v${NGINX_GRIDFS_VERSION}-${GIT_GRIDFS_VERSION}.tar.gz:gridfs +DISTFILES+= mongodb-mongo-c-driver-v${MONGO_C_DRIVER_VERSION}-${GIT_MONGO_C_DRIVER_VERSION}.tar.gz:mongo_c +CONFIGURE_ARGS+=--add-module=${WRKDIR}/mdirolf-nginx-gridfs-${GIT_GRIDFS_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MLET} +NGINX_LET_VERSION= 0.0.4 +GIT_LET_VERSION= 0-ga5e1dc5 +MASTER_SITES+= https://github.com/arut/nginx-let-module/tarball/v${NGINX_LET_VERSION}/:let +DISTFILES+= arut-nginx-let-module-v${NGINX_LET_VERSION}-${GIT_LET_VERSION}.tar.gz:let +CONFIGURE_ARGS+=--add-module=${WRKDIR}/arut-nginx-let-module-${GIT_LET_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MMEMC} +NGINX_MEMC_VERSION= 0.14 +GIT_MEMC_VERSION= 0-gde4cf86 +MASTER_SITES+= https://github.com/agentzh/memc-nginx-module/tarball/v${NGINX_MEMC_VERSION}/:memc +DISTFILES+= agentzh-memc-nginx-module-v${NGINX_MEMC_VERSION}-${GIT_MEMC_VERSION}.tar.gz:memc +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-memc-nginx-module-${GIT_MEMC_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MMODSECURITY} +NGINX_MODSECURITY_VERSION= 2.7.5 +LIB_DEPENDS+= libpcre.so:${PORTSDIR}/devel/pcre \ + libcurl.so:${PORTSDIR}/ftp/curl \ + libapr-1.so:${PORTSDIR}/devel/apr1 +USE_APACHE= 22+ +MASTER_SITES+= http://www.modsecurity.org/tarball/${NGINX_MODSECURITY_VERSION}/:modsecurity +DISTFILES+= modsecurity-apache_${NGINX_MODSECURITY_VERSION}.tar.gz:modsecurity +CONFIGURE_ARGS+=--add-module=${WRKDIR}/modsecurity-apache_${NGINX_MODSECURITY_VERSION}/nginx/modsecurity +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-nginx-modsecurity-config +.endif + +.if ${PORT_OPTIONS:MHTTP_REWRITE} +WITH_HTTP_REWRITE= yes +.endif + +.if ${PORT_OPTIONS:MPOSTGRES} +USE_PGSQL= yes +WITH_HTTP_REWRITE= yes +NGINX_POSTGRES_VERSION= 0.9 +MASTER_SITES+= http://labs.frickle.com/files/:postgres +DISTFILES+= ngx_postgres-${NGINX_POSTGRES_VERSION}.tar.gz:postgres +CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_postgres-${NGINX_POSTGRES_VERSION} +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_postgres-config +.endif + +.if ${PORT_OPTIONS:MRDS_CSV} +NGINX_RDS_CSV_VERSION= 0.05 +GIT_RDS_CSV_VERSION= 0-g607e26b +MASTER_SITES+= https://github.com/agentzh/rds-csv-nginx-module/tarball/v${NGINX_RDS_CSV_VERSION}/:rdscsv +DISTFILES+= agentzh-rds-csv-nginx-module-v${NGINX_RDS_CSV_VERSION}-${GIT_RDS_CSV_VERSION}.tar.gz:rdscsv +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-rds-csv-nginx-module-${GIT_RDS_CSV_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MRDS_JSON} +NGINX_RDS_JSON_VERSION= 0.13 +GIT_RDS_JSON_VERSION= 0-g8292070 +MASTER_SITES+= https://github.com/agentzh/rds-json-nginx-module/tarball/v${NGINX_RDS_JSON_VERSION}/:rdsjson +DISTFILES+= agentzh-rds-json-nginx-module-v${NGINX_RDS_JSON_VERSION}-${GIT_RDS_JSON_VERSION}.tar.gz:rdsjson +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-rds-json-nginx-module-${GIT_RDS_JSON_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MREDIS2} +NGINX_REDIS2_VERSION= 0.10 +GIT_REDIS2_VERSION= 0-g78a7622 +MASTER_SITES+= https://github.com/agentzh/redis2-nginx-module/tarball/v${NGINX_REDIS2_VERSION}/:redis2 +DISTFILES+= agentzh-redis2-nginx-module-v${NGINX_REDIS2_VERSION}-${GIT_REDIS2_VERSION}.tar.gz:redis2 +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-redis2-nginx-module-${GIT_REDIS2_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MRTMP} +NGINX_RTMP_VERSION= 1.0.8 +MASTER_SITES+= https://github.com/arut/nginx-rtmp-module/archive/v${NGINX_RTMP_VERSION}/:rtmp +DISTFILES+= rtmp-nginx-module-v${NGINX_RTMP_VERSION}.tar.gz:rtmp +CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx-rtmp-module-${NGINX_RTMP_VERSION} +.endif + +.if ${PORT_OPTIONS:MSET_MISC} +NGINX_SET_MISC_VERSION= 0.23 +GIT_SET_MISC_VERSION= 0-g6ce586e +MASTER_SITES+= https://github.com/agentzh/set-misc-nginx-module/tarball/v${NGINX_SET_MISC_VERSION}/:setmisc +DISTFILES+= agentzh-set-misc-nginx-module-v${NGINX_SET_MISC_VERSION}-${GIT_SET_MISC_VERSION}.tar.gz:setmisc +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-set-misc-nginx-module-${GIT_SET_MISC_VERSION:S/^0-g//} +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-agentzh-set-misc-nginx-module-config +.endif + +.if ${PORT_OPTIONS:MSFLOW} +NGINX_SFLOW_VERSION= 0.9.7 +MASTER_SITES+= http://nginx-sflow-module.googlecode.com/files/:sflow +DISTFILES+= nginx-sflow-module-${NGINX_SFLOW_VERSION}.tar.gz:sflow +CONFIGURE_ARGS+=--add-module=${WRKDIR}/nginx-sflow-module-${NGINX_SFLOW_VERSION} +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-ngx_http_sflow_config.c \ + ${PATCHDIR}/extra-patch-ngx_http_sflow_config.h +.endif + +.if ${PORT_OPTIONS:MSLOWFS_CACHE} +NGINX_SLOWFS_CACHE_VERSION= 1.10 +MASTER_SITES+= http://labs.frickle.com/files/:slowfs_cache +DISTFILES+= ngx_slowfs_cache-${NGINX_SLOWFS_CACHE_VERSION}.tar.gz:slowfs_cache +CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_slowfs_cache-${NGINX_SLOWFS_CACHE_VERSION} +.endif + +.if ${PORT_OPTIONS:MSRCACHE} +NGINX_SRCACHE_VERSION= 0.24 +GIT_SRCACHE_VERSION= 0-g33f0f29 +MASTER_SITES+= https://github.com/agentzh/srcache-nginx-module/tarball/v${NGINX_SRCACHE_VERSION}/:srcache +DISTFILES+= agentzh-srcache-nginx-module-v${NGINX_SRCACHE_VERSION}-${GIT_SRCACHE_VERSION}.tar.gz:srcache +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-srcache-nginx-module-${GIT_SRCACHE_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MSUPERVISORD} +NGINX_SUPERVISORD_VERSION= 1.4 +MASTER_SITES+= http://labs.frickle.com/files/:supervisord +DISTFILES+= ngx_supervisord-${NGINX_SUPERVISORD_VERSION}.tar.gz:supervisord +CONFIGURE_ARGS+=--add-module=${WRKDIR}/ngx_supervisord-${NGINX_SUPERVISORD_VERSION} +.endif + +.if ${PORT_OPTIONS:MTCP_PROXY} +NGINX_TCP_PROXY_VERSION= 0.26 +GIT_TCP_PROXY_VERSION= 0-gb83e5a6 +MASTER_SITES+= https://github.com/yaoweibin/nginx_tcp_proxy_module/tarball/v${NGINX_TCP_PROXY_VERSION}/:tcp_proxy +DISTFILES+= yaoweibin-nginx_tcp_proxy_module-v${NGINX_TCP_PROXY_VERSION}-${GIT_TCP_PROXY_VERSION}.tar.gz:tcp_proxy +CONFIGURE_ARGS+=--add-module=${WRKDIR}/yaoweibin-nginx_tcp_proxy_module-${GIT_TCP_PROXY_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MXRID_HEADER} +GIT_XRID_VERSION= 0daa3cc +MASTER_SITES+= https://github.com/gabor/nginx-x-rid-header/tarball/master/:xrid +DISTFILES+= gabor-nginx-x-rid-header-${GIT_XRID_VERSION}.tar.gz:xrid +CONFIGURE_ARGS+=--add-module=${WRKDIR}/gabor-nginx-x-rid-header-${GIT_XRID_VERSION} +.endif + +.if ${PORT_OPTIONS:MXSS} +NGINX_XSS_VERSION= 0.04 +GIT_XSS_VERSION= 0-g7e37038 +MASTER_SITES+= https://github.com/agentzh/xss-nginx-module/tarball/v${NGINX_XSS_VERSION}/:xss +DISTFILES+= agentzh-xss-nginx-module-v${NGINX_XSS_VERSION}-${GIT_XSS_VERSION}.tar.gz:xss +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-xss-nginx-module-${GIT_XSS_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MCPP_TEST} +CONFIGURE_ARGS+=--with-cpp_test_module +.endif + +.if ${PORT_OPTIONS:MTFS} +LIB_DEPENDS+= libyajl.so:${PORTSDIR}/devel/yajl +CONFIGURE_ARGS+=--with-http_tfs_module +.endif + +.if ${PORT_OPTIONS:MWWW} +PLIST_SUB+= WWWDATA="" +.else +PLIST_SUB+= WWWDATA="@comment " +.endif + +.else +CONFIGURE_ARGS+=--without-http +PLIST_SUB+= WWWDATA="@comment " +.endif # WITH_HTTP + +.if ${PORT_OPTIONS:MMAIL} +CONFIGURE_ARGS+=--with-mail +.if empty(PORT_OPTIONS:MMAIL_IMAP) +CONFIGURE_ARGS+=--without-mail_imap_module +.endif +.if empty(PORT_OPTIONS:MMAIL_POP3) +CONFIGURE_ARGS+=--without-mail_pop3_module +.endif +.if empty(PORT_OPTIONS:MMAIL_SMTP) +CONFIGURE_ARGS+=--without-mail_smtp_module +.endif +.if ${PORT_OPTIONS:MMAIL_SSL} +NGINX_OPENSSL= yes +CONFIGURE_ARGS+=--with-mail_ssl_module +.endif +.endif # WITH_MAIL + +.if ${PORT_OPTIONS:MARRAYVAR} +NGINX_ARRAYVAR_VERSION= 0.03 +GIT_ARRAYVAR_VERSION= 0-g4676747 +MASTER_SITES+= https://github.com/agentzh/array-var-nginx-module/tarball/v${NGINX_ARRAYVAR_VERSION}/:arrayvar +DISTFILES+= agentzh-array-var-nginx-module-v${NGINX_ARRAYVAR_VERSION}-${GIT_ARRAYVAR_VERSION}.tar.gz:arrayvar +CONFIGURE_ARGS+=--add-module=${WRKDIR}/agentzh-array-var-nginx-module-${GIT_ARRAYVAR_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MFORMINPUT} +NGINX_FORMINPUT_VERSION= 0.07 +GIT_FORMINPUT_VERSION= 0-g78de845 +MASTER_SITES+= https://github.com/calio/form-input-nginx-module/tarball/v${NGINX_FORMINPUT_VERSION}/:forminput +DISTFILES+= calio-form-input-nginx-module-v${NGINX_FORMINPUT_VERSION}-${GIT_FORMINPUT_VERSION}.tar.gz:forminput +CONFIGURE_ARGS+=--add-module=${WRKDIR}/calio-form-input-nginx-module-${GIT_FORMINPUT_VERSION:S/^0-g//} +.endif + +.if ${PORT_OPTIONS:MICONV} +USES+= iconv +NGINX_ICONV_VERSION= 0.10 +GIT_ICONV_VERSION= 0-gb37efb5 +MASTER_SITES+= https://github.com/calio/iconv-nginx-module/tarball/v${NGINX_ICONV_VERSION}/:iconv +DISTFILES+= calio-iconv-nginx-module-v${NGINX_ICONV_VERSION}-${GIT_ICONV_VERSION}.tar.gz:iconv +CONFIGURE_ARGS+=--add-module=${WRKDIR}/calio-iconv-nginx-module-${GIT_ICONV_VERSION:S/^0-g//} +EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-calio-iconv-nginx-module-config +.endif + +PLIST_SUB+= NGINX_TMPDIR=${NGINX_TMPDIR} WWWOWN=${WWWOWN} WWWGRP=${WWWGRP} + +USERS?= ${WWWOWN} +GROUPS?=${WWWGRP} + +.if defined(WITH_HTTP_REWRITE) +LIB_DEPENDS+= libpcre.so:${PORTSDIR}/devel/pcre +CONFIGURE_ARGS+=--with-pcre +.else +PKGNAMESUFFIX:= ${PKGNAMESUFFIX}-nopcre +CONFIGURE_ARGS+=--without-http_rewrite_module \ + --without-pcre +.endif + +.if defined(NGINX_OPENSSL) +USE_OPENSSL= yes +WITH_OPENSSL_BASE= yes +.endif + +.if defined(WITH_HTTP_SSL) +NGINX_OPENSSL= yes +CONFIGURE_ARGS+=--with-http_ssl_module +.endif + +.if ${PORT_OPTIONS:MHTTP_SSL} +WITH_HTTP_SSL= yes +.endif + +pre-everything:: +.if ${PORT_OPTIONS:MHTTP_UPSTREAM_FAIR} + @${ECHO_MSG} "Enable http_ssl module to build upstream_fair with SSL support" +.endif + +post-extract: +.if ${PORT_OPTIONS:MGRIDFS} + @${RMDIR} ${WRKDIR}/mdirolf-nginx-gridfs-${GIT_GRIDFS_VERSION:S/^0-g//}/mongo-c-driver/ + @${MV} \ + ${WRKDIR}/mongodb-mongo-c-driver-${GIT_MONGO_C_DRIVER_VERSION:S/^0-g//}/ \ + ${WRKDIR}/mdirolf-nginx-gridfs-${GIT_GRIDFS_VERSION:S/^0-g//}/mongo-c-driver/ +.endif + +post-patch: + @${REINPLACE_CMD} 's!%%HTTP_PORT%%!${HTTP_PORT}!; \ + s!%%PREFIX%%!${PREFIX}!' \ + ${WRKSRC}/conf/nginx.conf +.if ${PORT_OPTIONS:MHTTP_ACCESSKEY} + @${REINPLACE_CMD} \ + 's!$$HTTP_ACCESSKEY_MODULE!ngx_http_accesskey_module!' \ + ${WRKDIR}/nginx-accesskey-${NGINX_ACCESSKEY_VERSION}/config +.endif +# Linker error acquire if --std=c99 defined, add "static" to inline function +.if ${PORT_OPTIONS:MHTTP_ZIP} + @${REINPLACE_CMD} \ + 's!^inline!static inline!' \ + ${WRKDIR}/mod_zip-${NGINX_ZIP_VERSION}/ngx_http_zip_parsers.* +.endif +.if ${PORT_OPTIONS:MDRIZZLE} + @${REINPLACE_CMD} \ + 's!%%PREFIX%%!${LOCALBASE}!g' \ + ${WRKDIR}/chaoslawful-drizzle-nginx-module-${GIT_DRIZZLE_VERSION:S/^0-g//}/config +.endif +# Respect CFLAGS by remove needless --std=c99 flag +.if ${PORT_OPTIONS:MGRIDFS} + @${REINPLACE_CMD} \ + 's!--std=c99!-DMONGO_HAVE_STDINT!' \ + ${WRKDIR}/mdirolf-nginx-gridfs-${GIT_GRIDFS_VERSION:S/^0-g//}/config +.endif +.if ${PORT_OPTIONS:MPOSTGRES} + @${REINPLACE_CMD} \ + 's!%%PREFIX%%!${LOCALBASE}!g' \ + ${WRKDIR}/ngx_postgres-${NGINX_POSTGRES_VERSION}/config +.endif +.if ${PORT_OPTIONS:MSFLOW} + @${REINPLACE_CMD} \ + 's!%%PREFIX%%!${LOCALBASE}!g' \ + ${WRKDIR}/nginx-sflow-module-${NGINX_SFLOW_VERSION}/ngx_http_sflow_config.h +.endif +.if ${PORT_OPTIONS:MDRIZZLE} + @${REINPLACE_CMD} '584d' \ + ${WRKDIR}/chaoslawful-drizzle-nginx-module-${GIT_DRIZZLE_VERSION:S/^0-g//}/src/ngx_http_drizzle_util.c +.endif +.if ${PORT_OPTIONS:MSUPERVISORD} + ( cd ${WRKDIR}/nginx_upstream_fair-${NGINX_UPSTREAM_FAIR_VERSION} && \ + ${PATCH} -p0 < \ + ${WRKDIR}/ngx_supervisord-${NGINX_SUPERVISORD_VERSION}/patches/ngx_http_upstream_fair_module.patch ) + ( cd ${WRKSRC} && \ + ${PATCH} -p0 < \ + ${WRKDIR}/ngx_supervisord-${NGINX_SUPERVISORD_VERSION}/patches/ngx_http_upstream_init_busy-0.8.17.patch ) +.endif +.if ${PORT_OPTIONS:MTCP_PROXY} + ( cd ${WRKSRC} && \ + ${PATCH} -p1 < \ + ${WRKDIR}/yaoweibin-nginx_tcp_proxy_module-${GIT_TCP_PROXY_VERSION:S/^0-g//}/tcp.patch ) +.endif +.if ${PORT_OPTIONS:MICONV} + @${REINPLACE_CMD} \ + 's!%%PREFIX%%!${LOCALBASE}!g' \ + ${WRKDIR}/calio-iconv-nginx-module-${GIT_ICONV_VERSION:S/^0-g//}/config +.endif +.if ${PORT_OPTIONS:MMODSECURITY} + @${REINPLACE_CMD} \ + 's!%%PREFIX%%!${LOCALBASE}!g' \ + ${WRKDIR}/modsecurity-apache_${NGINX_MODSECURITY_VERSION}/nginx/modsecurity/config +.endif + +pre-configure: +.if ${PORT_OPTIONS:MMODSECURITY} + ( cd ${WRKDIR}/modsecurity-apache_${NGINX_MODSECURITY_VERSION} && \ + CC="${CC}" ./${CONFIGURE_SCRIPT} --enable-standalone-module && \ + ${MAKE} ) +.endif + +do-build: + @cd ${WRKSRC} && ${MAKE} + +do-install: + ${MKDIR} ${STAGEDIR}${ETCDIR}/modules + ${MKDIR} ${STAGEDIR}${ETCDIR}/include + ${MKDIR} ${STAGEDIR}${NGINX_TMPDIR} + ${INSTALL_PROGRAM} ${WRKSRC}/objs/nginx ${STAGEDIR}${PREFIX}/sbin + ${INSTALL_SCRIPT} ${WRKSRC}/objs/dso_tool ${STAGEDIR}${PREFIX}/sbin +.for i in koi-utf koi-win win-utf + ${INSTALL_DATA} ${WRKSRC}/conf/${i} ${STAGEDIR}${ETCDIR} +.endfor +.for i in *.so + ${INSTALL_PROGRAM} ${WRKSRC}/objs/modules/${i} ${STAGEDIR}${ETCDIR}/modules +.endfor +.for i in *.h + ${INSTALL_DATA} ${WRKSRC}/src/core/${i} ${STAGEDIR}${ETCDIR}/include + ${INSTALL_DATA} ${WRKSRC}/src/event/${i} ${STAGEDIR}${ETCDIR}/include + ${INSTALL_DATA} ${WRKSRC}/src/os/unix/${i} ${STAGEDIR}${ETCDIR}/include + ${INSTALL_DATA} ${WRKSRC}/src/http/${i} ${STAGEDIR}${ETCDIR}/include + ${INSTALL_DATA} ${WRKSRC}/src/http/modules/${i} ${STAGEDIR}${ETCDIR}/include + ${INSTALL_DATA} ${WRKSRC}/src/http/modules/lua/${i} ${STAGEDIR}${ETCDIR}/include +.endfor + ${INSTALL_DATA} ${WRKSRC}/objs/ngx_auto_headers.h ${WRKSRC}/objs/ngx_auto_config.h ${STAGEDIR}${ETCDIR}/include +.for i in fastcgi_params mime.types nginx.conf scgi_params uwsgi_params + ${INSTALL_DATA} ${WRKSRC}/conf/${i} ${STAGEDIR}${ETCDIR}/${i}-dist +.endfor +.if !empty(PORT_OPTIONS:MHTTP) && !empty(PORT_OPTIONS:MWWW) + ${MKDIR} ${STAGEDIR}${PREFIX}/www/nginx-dist +.for i in index.html 50x.html + ${INSTALL_DATA} ${WRKSRC}/html/${i} ${STAGEDIR}${PREFIX}/www/nginx-dist +.endfor + ${ECHO_CMD} "" >>${STAGEDIR}${PREFIX}/www/nginx-dist/EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING +.endif + +.if !empty(PORT_OPTIONS:MHTTP) && !empty(PORT_OPTIONS:MHTTP_PERL) + ${MKDIR} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/${PERL_ARCH}/auto/nginx + ${INSTALL_PROGRAM} ${WRKSRC}/objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so \ + ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/${PERL_ARCH}/auto/nginx + ${INSTALL_DATA} ${WRKSRC}/objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.bs \ + ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/${PERL_ARCH}/auto/nginx + ${INSTALL_DATA} ${WRKSRC}/objs/src/http/modules/perl/blib/lib/nginx.pm \ + ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/${PERL_ARCH}/ +.endif + +post-install: +.if !empty(PORT_OPTIONS:MHTTP) && !empty(PORT_OPTIONS:MHTTP_PERL) + ${ECHO_CMD} ${SITE_PERL_REL}/${PERL_ARCH}/auto/nginx/nginx.so >> ${TMPPLIST} + ${ECHO_CMD} ${SITE_PERL_REL}/${PERL_ARCH}/auto/nginx/nginx.bs >> ${TMPPLIST} + ${ECHO_CMD} ${SITE_PERL_REL}/${PERL_ARCH}/nginx.pm >> ${TMPPLIST} + ${ECHO_CMD} @dirrm ${SITE_PERL_REL}/${PERL_ARCH}/auto/nginx >> ${TMPPLIST} +.endif + @${INSTALL_MAN} ${WRKSRC}/objs/nginx.8 ${STAGEDIR}${MAN8PREFIX}/man/man8 + +.include <bsd.port.mk> diff --git a/www/tengine/distinfo b/www/tengine/distinfo new file mode 100644 index 000000000000..c29e9965fb9c --- /dev/null +++ b/www/tengine/distinfo @@ -0,0 +1,96 @@ +SHA256 (tengine-2.0.3.tar.gz) = 16a07051a118f8ce17e227ba921b15af040c9e8bd98dd76edbb22d2c65f17b61 +SIZE (tengine-2.0.3.tar.gz) = 1534351 +SHA256 (giom-nginx_accept_language_module-2f69842.tar.gz) = fbcdf792160a1eff7b9549aeb5209d6e76716ff8e86b05e42c90b2d2f858e011 +SIZE (giom-nginx_accept_language_module-2f69842.tar.gz) = 3399 +SHA256 (nginx-accesskey-2.0.3.tar.gz) = d9e94321e78a02de16c57f3e048fd31059fd8116ed03d6de7180f435c52502b1 +SIZE (nginx-accesskey-2.0.3.tar.gz) = 2632 +SHA256 (samizdatco-nginx-http-auth-digest-bd1c86a.tar.gz) = e223f55fd97e56425e232d8698e024707d1b2ed3714eff7d91a4d1ca76b4cbee +SIZE (samizdatco-nginx-http-auth-digest-bd1c86a.tar.gz) = 14454 +SHA256 (http_auth_ldap-c4dc7c9153.tar.gz) = ac082a36afdbcfd883303bc2b1aaea5f2b4d2a772ad8eec9ecf3328e81300e1a +SIZE (http_auth_ldap-c4dc7c9153.tar.gz) = 5323 +SHA256 (ngx_http_auth_pam_module-1.2.tar.gz) = 5a85970ba61a99f55a26d2536a11d512b39bbd622f5737d25a9a8c10db81efa9 +SIZE (ngx_http_auth_pam_module-1.2.tar.gz) = 5424 +SHA256 (ngx_http_auth_request_module-0.2.tar.gz) = eea5d0ec02bba93d0b204a034230cc61462b60497cbac6f581d7e008a9262ba4 +SIZE (ngx_http_auth_request_module-0.2.tar.gz) = 6736 +SHA256 (ngx_cache_purge-2.1.tar.gz) = 424005af0c04e59ffa65a65e446081d4f95ee76a801a7555e001c67810bcb3b9 +SIZE (ngx_cache_purge-2.1.tar.gz) = 10535 +SHA256 (agentzh-echo-nginx-module-v0.50-0-gf827a4f.tar.gz) = 0121dd5a8053d6960c9acc364f7552db1bcc64aa4340d0bf7f6d09d3125cfbe9 +SIZE (agentzh-echo-nginx-module-v0.50-0-gf827a4f.tar.gz) = 62907 +SHA256 (agentzh-headers-more-nginx-module-v0.24-0-g7a6fd11.tar.gz) = 1bc8e48da5c6b9968620114776be2751ab600c7953a04c08e16901de3ef2aec2 +SIZE (agentzh-headers-more-nginx-module-v0.24-0-g7a6fd11.tar.gz) = 27666 +SHA256 (arut-nginx-dav-ext-module-v0.0.2-0-g0e07a3e.tar.gz) = a0d6fa256e354ce48c06e1f689d26ebb2f7b75f71ce682e34ae6c29331a7fbff +SIZE (arut-nginx-dav-ext-module-v0.0.2-0-g0e07a3e.tar.gz) = 6065 +SHA256 (vkholodkov-nginx-eval-module-1.0.3-0-g125fa2e.tar.gz) = 945046c42d973be9293e03ab41e3a0e04677524b2cd813cfc5146cf1d2f0ab8f +SIZE (vkholodkov-nginx-eval-module-1.0.3-0-g125fa2e.tar.gz) = 5727 +SHA256 (ngx-fancyindex-0.3.1.tar.gz) = 877e383c6bc06be92abb88f5ac251a165b63feb5f4828d52a554efc19a3f7c7d +SIZE (ngx-fancyindex-0.3.1.tar.gz) = 13071 +SHA256 (nginx_mogilefs_module-1.0.4.tar.gz) = 7ac230d30907f013dff8d435a118619ea6168aa3714dba62c6962d350c6295ae +SIZE (nginx_mogilefs_module-1.0.4.tar.gz) = 11208 +SHA256 (kr-nginx-notice-0-g3c95966.tar.gz) = bb0b8c603b2df206aeb13100fb60c1328aa6a69d0ac7f411e5dabe8fdb2affce +SIZE (kr-nginx-notice-0-g3c95966.tar.gz) = 3348 +SHA256 (nginx_http_push_module-0.692.tar.gz) = 64868708071aa21dbc4c7a07d149dd6ec9108fb7eaf2aad5ad069406151f17fe +SIZE (nginx_http_push_module-0.692.tar.gz) = 29119 +SHA256 (wandenberg-nginx-push-stream-module-0.3.5-0-gb6a8c46.tar.gz) = f2c5b2cc3430f023442381b734a1e547dd2ba75a05cd34f2cdcf2431acc4f77e +SIZE (wandenberg-nginx-push-stream-module-0.3.5-0-gb6a8c46.tar.gz) = 153187 +SHA256 (wandenberg-nginx-video-thumbextractor-module-0.2.0-0-g9406457.tar.gz) = 8c39593b7a16003cad5d071df96dcf451fe41d64ba5dbf658e26e7b4684528ff +SIZE (wandenberg-nginx-video-thumbextractor-module-0.2.0-0-g9406457.tar.gz) = 8812 +SHA256 (ngx_http_redis-0.3.7.tar.gz) = 9dfc14db81f431fdf3d69f3661a37daf110aef5f9479aa7c88cf362bb5d62604 +SIZE (ngx_http_redis-0.3.7.tar.gz) = 12165 +SHA256 (ngx_http_response-0.3.tar.gz) = 0835584029f053051c624adbe33a826ab0205c9d85a02af6019e6b57607e9045 +SIZE (ngx_http_response-0.3.tar.gz) = 2244 +SHA256 (nginx_upload_module-2.2.0.tar.gz) = b1c26abe0427180602e257627b4ed21848c93cc20cefc33af084983767d65805 +SIZE (nginx_upload_module-2.2.0.tar.gz) = 25796 +SHA256 (masterzen-nginx-upload-progress-module-v0.9.0-0-ga788dea.tar.gz) = 3fb903dab595cf6656fa0fc5743a48daffbba2f6b5c554836be630800eaad4e2 +SIZE (masterzen-nginx-upload-progress-module-v0.9.0-0-ga788dea.tar.gz) = 17020 +SHA256 (nginx_upstream_fair-20090923.tar.gz) = ec9ed7f856263e17faadee3dc7209932364ded4e546b829841c2454aa432450b +SIZE (nginx_upstream_fair-20090923.tar.gz) = 10024 +SHA256 (mod_zip-1.1.6.tar.gz) = d30546b4be8308c721df0240ebc38c474c6b577381a110321eded6dbed5104b1 +SIZE (mod_zip-1.1.6.tar.gz) = 21991 +SHA256 (chaoslawful-drizzle-nginx-module-v0.1.6-0-ge6937ba.tar.gz) = ec04631c6a1fe75329a831511c5693520bb2bfdedfb3ccc9de4b6a390bc2ba9c +SIZE (chaoslawful-drizzle-nginx-module-v0.1.6-0-ge6937ba.tar.gz) = 61351 +SHA256 (simpl-ngx_devel_kit-v0.2.19-0-g8dd0df5.tar.gz) = 9a8c372f8e750d33018d9587d288c17f755e8da38592bca8ef9bf9ea4bab59a7 +SIZE (simpl-ngx_devel_kit-v0.2.19-0-g8dd0df5.tar.gz) = 65033 +SHA256 (agentzh-encrypted-session-nginx-module-v0.03-0-g49d741b.tar.gz) = 4485214756dc935a959efd3a2fcd750263df1719956a4ac73f96b0cee0763395 +SIZE (agentzh-encrypted-session-nginx-module-v0.03-0-g49d741b.tar.gz) = 8947 +SHA256 (mdirolf-nginx-gridfs-v0.8-0-gb5f8113.tar.gz) = f55617873c9b123d610d59e4da52703c07be0bae5c719ef0cc3d45a53480d29c +SIZE (mdirolf-nginx-gridfs-v0.8-0-gb5f8113.tar.gz) = 18882 +SHA256 (mongodb-mongo-c-driver-v0.3.1-0-g9b4b232.tar.gz) = bfcdd60c6b53bd499e2bf22fefc96848de37e7d57dfaf7303bb00376dcb812f0 +SIZE (mongodb-mongo-c-driver-v0.3.1-0-g9b4b232.tar.gz) = 53033 +SHA256 (arut-nginx-let-module-v0.0.4-0-ga5e1dc5.tar.gz) = 9253581f11966329f64b4b4a49a2a60798665812f9007222592586e64bcd66da +SIZE (arut-nginx-let-module-v0.0.4-0-ga5e1dc5.tar.gz) = 20543 +SHA256 (agentzh-memc-nginx-module-v0.14-0-gde4cf86.tar.gz) = 5e8cacd7af42685794bbe121264173de4141e5746031e23f8e363ab14ccb1534 +SIZE (agentzh-memc-nginx-module-v0.14-0-gde4cf86.tar.gz) = 37755 +SHA256 (modsecurity-apache_2.7.5.tar.gz) = 9e907536278d8da80d3dbb29aeffe9c4ec37ce9b641035b2da64e993135647a2 +SIZE (modsecurity-apache_2.7.5.tar.gz) = 1045387 +SHA256 (ngx_postgres-0.9.tar.gz) = aac0141e73b5c440927b7e040072f120b36e49deb2ff36ad00ff96a80622fbec +SIZE (ngx_postgres-0.9.tar.gz) = 41022 +SHA256 (agentzh-rds-csv-nginx-module-v0.05-0-g607e26b.tar.gz) = 3fa9cb3960a97f505c9ad0cc8683c8fe17ba98aa98d003e255bf214e5144751c +SIZE (agentzh-rds-csv-nginx-module-v0.05-0-g607e26b.tar.gz) = 18423 +SHA256 (agentzh-rds-json-nginx-module-v0.13-0-g8292070.tar.gz) = 9e59b90d84f9bc814eba85bfcf126e3fd6406ddc771702c096a657c17354c302 +SIZE (agentzh-rds-json-nginx-module-v0.13-0-g8292070.tar.gz) = 32965 +SHA256 (agentzh-redis2-nginx-module-v0.10-0-g78a7622.tar.gz) = c2a164df07759d2a45beacc1f72316be84e9348b7ae5509723eabd2d61cb4897 +SIZE (agentzh-redis2-nginx-module-v0.10-0-g78a7622.tar.gz) = 29850 +SHA256 (rtmp-nginx-module-v1.0.8.tar.gz) = e905e40d1a1b81c720f1e799bee6a3525efaa6f2519212130d39eed3b8877c74 +SIZE (rtmp-nginx-module-v1.0.8.tar.gz) = 513086 +SHA256 (agentzh-set-misc-nginx-module-v0.23-0-g6ce586e.tar.gz) = a5dea4570efa138e15bb97babb02e76f16319b4b660763492ef02615dc1def1f +SIZE (agentzh-set-misc-nginx-module-v0.23-0-g6ce586e.tar.gz) = 40355 +SHA256 (nginx-sflow-module-0.9.7.tar.gz) = 508d15a43059abab08281bfa66d2dd520e2e7635d0b17043549bb331c8755b76 +SIZE (nginx-sflow-module-0.9.7.tar.gz) = 27614 +SHA256 (ngx_slowfs_cache-1.10.tar.gz) = 1e81453942e5b0877de1f1f06c56ae82918ea9818255cb935bcb673c95a758a1 +SIZE (ngx_slowfs_cache-1.10.tar.gz) = 11809 +SHA256 (agentzh-srcache-nginx-module-v0.24-0-g33f0f29.tar.gz) = 5e3f59821f73c205e1df0c40fd02d987b21b19e3c267866659f883bddd5674c9 +SIZE (agentzh-srcache-nginx-module-v0.24-0-g33f0f29.tar.gz) = 67239 +SHA256 (ngx_supervisord-1.4.tar.gz) = 0954a4efb1b955692acf523e169221146d6aa93ad1643c9f2482f75a1fbf9e3b +SIZE (ngx_supervisord-1.4.tar.gz) = 19351 +SHA256 (yaoweibin-nginx_tcp_proxy_module-v0.26-0-gb83e5a6.tar.gz) = 4d843b8d0511b269382938ba5546f902ec24dbfa76c12f6bd6961d7aaaf3866a +SIZE (yaoweibin-nginx_tcp_proxy_module-v0.26-0-gb83e5a6.tar.gz) = 127346 +SHA256 (gabor-nginx-x-rid-header-0daa3cc.tar.gz) = 136239b8f9ab2fbefb2aabc6897d3f12cc8063ce817901f9b8a624e12fbc6035 +SIZE (gabor-nginx-x-rid-header-0daa3cc.tar.gz) = 2714 +SHA256 (agentzh-xss-nginx-module-v0.04-0-g7e37038.tar.gz) = 3e5b1eba411e1e51bbb197d2adb2d5304cd4050dca95f506cae635e4af5e9b35 +SIZE (agentzh-xss-nginx-module-v0.04-0-g7e37038.tar.gz) = 10535 +SHA256 (agentzh-array-var-nginx-module-v0.03-0-g4676747.tar.gz) = 9670207b5a74ddbdf510b973ddbcf3e4ecd4c5fe50829b17c560ba4a30aa73f4 +SIZE (agentzh-array-var-nginx-module-v0.03-0-g4676747.tar.gz) = 9518 +SHA256 (calio-form-input-nginx-module-v0.07-0-g78de845.tar.gz) = d5b2c42a3b9fd2970107eb74c2226cbbfbad48c89807303db903932d21ff76aa +SIZE (calio-form-input-nginx-module-v0.07-0-g78de845.tar.gz) = 10580 +SHA256 (calio-iconv-nginx-module-v0.10-0-gb37efb5.tar.gz) = e90a406a14d5f419bd500e19082da81390e8ba6040926857926f1a899a53379d +SIZE (calio-iconv-nginx-module-v0.10-0-gb37efb5.tar.gz) = 12510 diff --git a/www/tengine/files/extra-patch-agentzh-set-misc-nginx-module-config b/www/tengine/files/extra-patch-agentzh-set-misc-nginx-module-config new file mode 100644 index 000000000000..5503641e8331 --- /dev/null +++ b/www/tengine/files/extra-patch-agentzh-set-misc-nginx-module-config @@ -0,0 +1,13 @@ +--- ../agentzh-set-misc-nginx-module-6ce586e/config.orig 2011-12-09 10:27:53.861265188 +0300 ++++ ../agentzh-set-misc-nginx-module-6ce586e/config 2011-12-09 10:28:07.107259301 +0300 +@@ -1,10 +1,3 @@ +-if echo $HTTP_MODULES | grep " ndk_http_module" > /dev/null; then +- echo "found ngx_devel_kit for ngx_set_misc; looks good." +-else +- echo "error: ngx_devel_kit is required to build ngx_set_misc; please put it before ngx_set_misc." 1>&2 +- exit 1 +-fi +- + ngx_addon_name=ngx_http_set_misc_module + HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_set_misc_module" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_set_base32.c $ngx_addon_dir/src/ngx_http_set_default_value.c $ngx_addon_dir/src/ngx_http_set_hashed_upstream.c $ngx_addon_dir/src/ngx_http_set_quote_sql.c $ngx_addon_dir/src/ngx_http_set_quote_json.c $ngx_addon_dir/src/ngx_http_set_unescape_uri.c $ngx_addon_dir/src/ngx_http_set_misc_module.c $ngx_addon_dir/src/ngx_http_set_escape_uri.c $ngx_addon_dir/src/ngx_http_set_hash.c $ngx_addon_dir/src/ngx_http_set_local_today.c $ngx_addon_dir/src/ngx_http_set_hex.c $ngx_addon_dir/src/ngx_http_set_base64.c $ngx_addon_dir/src/ngx_http_set_random.c" diff --git a/www/tengine/files/extra-patch-calio-iconv-nginx-module-config b/www/tengine/files/extra-patch-calio-iconv-nginx-module-config new file mode 100644 index 000000000000..e564d207c3f1 --- /dev/null +++ b/www/tengine/files/extra-patch-calio-iconv-nginx-module-config @@ -0,0 +1,19 @@ +--- ../calio-iconv-nginx-module-b37efb5/config.orig 2013-04-16 17:57:17.000000000 -0700 ++++ ../calio-iconv-nginx-module-b37efb5/config 2013-05-01 17:16:28.134624745 -0700 +@@ -39,12 +39,12 @@ + fi + + if [ $ngx_found = no ]; then +- ngx_feature="libiconv in /usr/local/" +- ngx_feature_path="/usr/local/include" ++ ngx_feature="libiconv in %%PREFIX%%/" ++ ngx_feature_path="%%PREFIX%%/include" + if [ $NGX_RPATH = YES ]; then +- ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -liconv" ++ ngx_feature_libs="-R%%PREFIX%%/lib -L%%PREFIX%%/lib -liconv" + else +- ngx_feature_libs="-L/usr/local/lib -liconv" ++ ngx_feature_libs="-L%%PREFIX%%/lib -liconv" + fi + . auto/feature + fi diff --git a/www/tengine/files/extra-patch-chaoslawful-drizzle-nginx-module-config b/www/tengine/files/extra-patch-chaoslawful-drizzle-nginx-module-config new file mode 100644 index 000000000000..05f3699f2c00 --- /dev/null +++ b/www/tengine/files/extra-patch-chaoslawful-drizzle-nginx-module-config @@ -0,0 +1,19 @@ +--- ../chaoslawful-drizzle-nginx-module-e6937ba/config.orig 2011-12-30 10:26:53.000000000 +0400 ++++ ../chaoslawful-drizzle-nginx-module-e6937ba/config 2011-12-30 10:28:20.000000000 +0400 +@@ -22,12 +22,12 @@ + + if [ $ngx_found = no ]; then + # FreeBSD, OpenBSD +- ngx_feature="libdrizzle library in /usr/local/" +- ngx_feature_path="/usr/local/include/libdrizzle-1.0" ++ ngx_feature="libdrizzle library in %%PREFIX%%" ++ ngx_feature_path="%%PREFIX%%/include/libdrizzle" + if [ $NGX_RPATH = YES ]; then +- ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -ldrizzle" ++ ngx_feature_libs="-R%%PREFIX%%/lib -L%%PREFIX%%/lib -ldrizzle" + else +- ngx_feature_libs="-L/usr/local/lib -ldrizzle" ++ ngx_feature_libs="-L%%PREFIX%%/lib -ldrizzle" + fi + . auto/feature + fi diff --git a/www/tengine/files/extra-patch-nginx-modsecurity-config b/www/tengine/files/extra-patch-nginx-modsecurity-config new file mode 100644 index 000000000000..a754631be8d4 --- /dev/null +++ b/www/tengine/files/extra-patch-nginx-modsecurity-config @@ -0,0 +1,10 @@ +--- ../modsecurity-apache_2.7.5/nginx/modsecurity/config.orig 2013-06-04 10:14:07.000000000 +0400 ++++ ../modsecurity-apache_2.7.5/nginx/modsecurity/config 2013-06-04 10:17:30.000000000 +0400 +@@ -3,5 +3,5 @@ + HTTP_AUX_FILTER_MODULES="ngx_http_modsecurity $HTTP_AUX_FILTER_MODULES" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_modsecurity.c $ngx_addon_dir/apr_bucket_nginx.c $ngx_addon_dir/ngx_pool_context.c" + NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/apr_bucket_nginx.h $ngx_addon_dir/ngx_pool_context.h" +-CORE_LIBS="$CORE_LIBS $ngx_addon_dir/../../standalone/.libs/standalone.a -L/usr/local/apr/lib -lapr-1 -L/usr/local/apr/lib -laprutil-1 -lpcre -lxml2 -lz -lm -ldl " +-CORE_INCS="$CORE_INCS $ngx_addon_dir $ngx_addon_dir/../../standalone $ngx_addon_dir/../../apache2 /usr/include/libxml2 /usr/local/apache2/include /usr/local/apr/include/apr-1 /usr/local/apr/include/apr-1" ++CORE_LIBS="$CORE_LIBS $ngx_addon_dir/../../standalone/.libs/standalone.a -lapr-1 -laprutil-1 -lpcre -lxml2 -lz -lm " ++CORE_INCS="$CORE_INCS $ngx_addon_dir $ngx_addon_dir/../../standalone $ngx_addon_dir/../../apache2 %%PREFIX%%/include/libxml2 %%PREFIX%%/include/apache22 %%PREFIX%%/include/apr-1 " diff --git a/www/tengine/files/extra-patch-ngx_http_notice_module.c b/www/tengine/files/extra-patch-ngx_http_notice_module.c new file mode 100644 index 000000000000..feb39a964b23 --- /dev/null +++ b/www/tengine/files/extra-patch-ngx_http_notice_module.c @@ -0,0 +1,11 @@ +--- ../kr-nginx-notice-3c95966/ngx_http_notice_module.c.orig 2009-07-16 18:37:57.000000000 +0200 ++++ ../kr-nginx-notice-3c95966/ngx_http_notice_module.c 2009-07-16 08:09:38.000000000 +0200 +@@ -153,7 +153,7 @@ + return NGX_HTTP_NOT_ALLOWED; + } + +- rc = ngx_http_discard_body(r); ++ rc = ngx_http_discard_request_body(r); + + if (rc != NGX_OK && rc != NGX_AGAIN) { + return rc; diff --git a/www/tengine/files/extra-patch-ngx_http_sflow_config.c b/www/tengine/files/extra-patch-ngx_http_sflow_config.c new file mode 100644 index 000000000000..f5a348e629bf --- /dev/null +++ b/www/tengine/files/extra-patch-ngx_http_sflow_config.c @@ -0,0 +1,10 @@ +--- ../nginx-sflow-module-0.9.7/ngx_http_sflow_config.c.orig 2012-06-07 04:52:57.000000000 +0400 ++++ ../nginx-sflow-module-0.9.7/ngx_http_sflow_config.c 2012-06-07 04:59:18.000000000 +0400 +@@ -26,7 +26,6 @@ + ngx_log_error(NGX_LOG_ERR, log, 0, "getaddrinfo() failed: %s", gai_strerror(err)); + switch(err) { + case EAI_NONAME: break; +- case EAI_NODATA: break; + case EAI_AGAIN: break; // loop and try again? + default: ngx_log_error(NGX_LOG_ERR, log, 0, "getaddrinfo() error: %s", gai_strerror(err)); break; + } diff --git a/www/tengine/files/extra-patch-ngx_http_sflow_config.h b/www/tengine/files/extra-patch-ngx_http_sflow_config.h new file mode 100644 index 000000000000..48d5f55d188e --- /dev/null +++ b/www/tengine/files/extra-patch-ngx_http_sflow_config.h @@ -0,0 +1,11 @@ +--- ../nginx-sflow-module-0.9.7/ngx_http_sflow_config.h.orig 2012-07-31 21:36:49.000000000 +0400 ++++ ../nginx-sflow-module-0.9.7/ngx_http_sflow_config.h 2012-07-31 21:37:20.000000000 +0400 +@@ -17,7 +17,7 @@ + -----------------___________________________------------------ + */ + +-#define SFWB_DEFAULT_CONFIGFILE "/etc/hsflowd.auto" ++#define SFWB_DEFAULT_CONFIGFILE "%%PREFIX%%/etc/hsflowd.auto" + #define SFWB_SEPARATORS " \t\r\n=" + #define SFWB_QUOTES "'\" \t\r\n" + /* SFWB_MAX LINE LEN must be enough to hold the whole list of targets */ diff --git a/www/tengine/files/extra-patch-ngx_http_upload_module.c b/www/tengine/files/extra-patch-ngx_http_upload_module.c new file mode 100644 index 000000000000..d626021fa649 --- /dev/null +++ b/www/tengine/files/extra-patch-ngx_http_upload_module.c @@ -0,0 +1,1658 @@ +--- ../nginx_upload_module-2.2.0/ngx_http_upload_module.c.orig 2010-09-27 21:54:15.000000000 +0300 ++++ ../nginx_upload_module-2.2.0/ngx_http_upload_module.c 2013-09-10 17:40:59.570815847 +0300 +@@ -50,7 +50,7 @@ + * State of multipart/form-data parser + */ + typedef enum { +- upload_state_boundary_seek, ++ upload_state_boundary_seek, + upload_state_after_boundary, + upload_state_headers, + upload_state_data, +@@ -95,6 +95,14 @@ + } ngx_http_upload_field_template_t; + + /* ++ * Template for a header ++ */ ++typedef struct { ++ ngx_http_complex_value_t *name; ++ ngx_http_complex_value_t *value; ++} ngx_http_upload_header_template_t; ++ ++/* + * Filter for fields in output form + */ + typedef struct { +@@ -106,6 +114,12 @@ + #endif + } ngx_http_upload_field_filter_t; + ++typedef struct { ++ ngx_path_t *path; ++ ngx_http_complex_value_t dynamic; ++ unsigned is_dynamic:1; ++} ngx_http_upload_path_t; ++ + /* + * Upload cleanup record + */ +@@ -124,8 +138,8 @@ + typedef struct { + ngx_str_t url; + ngx_http_complex_value_t *url_cv; +- ngx_path_t *state_store_path; +- ngx_path_t *store_path; ++ ngx_http_upload_path_t *state_store_path; ++ ngx_http_upload_path_t *store_path; + ngx_uint_t store_access; + size_t buffer_size; + size_t merge_buffer_size; +@@ -137,13 +151,17 @@ + ngx_array_t *aggregate_field_templates; + ngx_array_t *field_filters; + ngx_array_t *cleanup_statuses; ++ ngx_array_t *header_templates; + ngx_flag_t forward_args; + ngx_flag_t tame_arrays; + ngx_flag_t resumable_uploads; ++ ngx_flag_t empty_field_names; + size_t limit_rate; + + unsigned int md5:1; + unsigned int sha1:1; ++ unsigned int sha256:1; ++ unsigned int sha512:1; + unsigned int crc32:1; + } ngx_http_upload_loc_conf_t; + +@@ -157,6 +175,16 @@ + u_char sha1_digest[SHA_DIGEST_LENGTH * 2]; + } ngx_http_upload_sha1_ctx_t; + ++typedef struct ngx_http_upload_sha256_ctx_s { ++ SHA256_CTX sha256; ++ u_char sha256_digest[SHA256_DIGEST_LENGTH * 2]; ++} ngx_http_upload_sha256_ctx_t; ++ ++typedef struct ngx_http_upload_sha512_ctx_s { ++ SHA512_CTX sha512; ++ u_char sha512_digest[SHA512_DIGEST_LENGTH * 2]; ++} ngx_http_upload_sha512_ctx_t; ++ + struct ngx_http_upload_ctx_s; + + /* +@@ -219,7 +247,11 @@ + + ngx_http_upload_md5_ctx_t *md5_ctx; + ngx_http_upload_sha1_ctx_t *sha1_ctx; ++ ngx_http_upload_sha256_ctx_t *sha256_ctx; ++ ngx_http_upload_sha512_ctx_t *sha512_ctx; + uint32_t crc32; ++ ngx_path_t *store_path; ++ ngx_path_t *state_store_path; + + unsigned int first_part:1; + unsigned int discard_data:1; +@@ -233,7 +265,21 @@ + unsigned int raw_input:1; + } ngx_http_upload_ctx_t; + ++static ngx_int_t ngx_http_upload_test_expect(ngx_http_request_t *r); ++ ++static void ngx_http_read_client_request_body_handler(ngx_http_request_t *r); ++static ngx_int_t ngx_http_do_read_client_request_body(ngx_http_request_t *r); ++ ++static ngx_int_t ngx_http_write_request_body(ngx_http_request_t *r); ++static ngx_int_t ngx_http_request_body_filter(ngx_http_request_t *r, ngx_chain_t *in); ++ ++static ngx_int_t ngx_http_request_body_length_filter(ngx_http_request_t *r, ngx_chain_t *in); ++static ngx_int_t ngx_http_request_body_chunked_filter(ngx_http_request_t *r, ngx_chain_t *in); ++ ++static ngx_int_t ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in); ++ + static ngx_int_t ngx_http_upload_handler(ngx_http_request_t *r); ++static ngx_int_t ngx_http_upload_options_handler(ngx_http_request_t *r); + static ngx_int_t ngx_http_upload_body_handler(ngx_http_request_t *r); + + static void *ngx_http_upload_create_loc_conf(ngx_conf_t *cf); +@@ -248,6 +294,10 @@ + ngx_http_variable_value_t *v, uintptr_t data); + static ngx_int_t ngx_http_upload_sha1_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); ++static ngx_int_t ngx_http_upload_sha256_variable(ngx_http_request_t *r, ++ ngx_http_variable_value_t *v, uintptr_t data); ++static ngx_int_t ngx_http_upload_sha512_variable(ngx_http_request_t *r, ++ ngx_http_variable_value_t *v, uintptr_t data); + static ngx_int_t ngx_http_upload_file_size_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + static void ngx_http_upload_content_range_variable_set(ngx_http_request_t *r, +@@ -271,6 +321,7 @@ + static ngx_int_t ngx_http_upload_merge_ranges(ngx_http_upload_ctx_t *u, ngx_http_upload_range_t *range_n); + static ngx_int_t ngx_http_upload_parse_range(ngx_str_t *range, ngx_http_upload_range_t *range_n); + ++ + static void ngx_http_read_upload_client_request_body_handler(ngx_http_request_t *r); + static ngx_int_t ngx_http_do_read_upload_client_request_body(ngx_http_request_t *r); + static ngx_int_t ngx_http_process_request_body(ngx_http_request_t *r, ngx_chain_t *body); +@@ -279,8 +330,16 @@ + + static char *ngx_http_upload_set_form_field(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); ++static char *ngx_http_upload_add_header(ngx_conf_t *cf, ngx_command_t *cmd, ++ void *conf); ++static ngx_int_t ngx_http_upload_eval_path(ngx_http_request_t *r); ++static ngx_int_t ngx_http_upload_eval_state_path(ngx_http_request_t *r); + static char *ngx_http_upload_pass_form_field(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); ++static char *ngx_http_upload_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, ++ void *conf); ++static char *ngx_http_upload_merge_path_value(ngx_conf_t *cf, ngx_http_upload_path_t **path, ngx_http_upload_path_t *prev, ++ ngx_path_init_t *init); + static char *ngx_http_upload_cleanup(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); + static void ngx_upload_cleanup_handler(void *data); +@@ -391,7 +450,7 @@ + { ngx_string("upload_store"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LMT_CONF|NGX_HTTP_LIF_CONF + |NGX_CONF_TAKE1234, +- ngx_conf_set_path_slot, ++ ngx_http_upload_set_path_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_upload_loc_conf_t, store_path), + NULL }, +@@ -401,7 +460,7 @@ + */ + { ngx_string("upload_state_store"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, +- ngx_conf_set_path_slot, ++ ngx_http_upload_set_path_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_upload_loc_conf_t, state_store_path), + NULL }, +@@ -575,6 +634,28 @@ + offsetof(ngx_http_upload_loc_conf_t, resumable_uploads), + NULL }, + ++ /* ++ * Specifies whether empty field names are allowed ++ */ ++ { ngx_string("upload_empty_fiels_names"), ++ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LMT_CONF|NGX_HTTP_LIF_CONF ++ |NGX_CONF_FLAG, ++ ngx_conf_set_flag_slot, ++ NGX_HTTP_LOC_CONF_OFFSET, ++ offsetof(ngx_http_upload_loc_conf_t, empty_field_names), ++ NULL }, ++ ++ /* ++ * Specifies the name and content of the header that will be added to the response ++ */ ++ { ngx_string("upload_add_header"), ++ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LMT_CONF|NGX_HTTP_LIF_CONF ++ |NGX_CONF_TAKE2, ++ ngx_http_upload_add_header, ++ NGX_HTTP_LOC_CONF_OFFSET, ++ offsetof(ngx_http_upload_loc_conf_t, header_templates), ++ NULL}, ++ + ngx_null_command + }; /* }}} */ + +@@ -658,6 +739,22 @@ + (uintptr_t) "0123456789ABCDEF", + NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, + ++ { ngx_string("upload_file_sha256"), NULL, ngx_http_upload_sha256_variable, ++ (uintptr_t) "0123456789abcdef", ++ NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, ++ ++ { ngx_string("upload_file_sha256_uc"), NULL, ngx_http_upload_sha256_variable, ++ (uintptr_t) "0123456789ABCDEF", ++ NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, ++ ++ { ngx_string("upload_file_sha512"), NULL, ngx_http_upload_sha512_variable, ++ (uintptr_t) "0123456789abcdef", ++ NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, ++ ++ { ngx_string("upload_file_sha512_uc"), NULL, ngx_http_upload_sha512_variable, ++ (uintptr_t) "0123456789ABCDEF", ++ NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, ++ + { ngx_string("upload_file_crc32"), NULL, ngx_http_upload_crc32_variable, + (uintptr_t) offsetof(ngx_http_upload_ctx_t, crc32), + NGX_HTTP_VAR_CHANGEABLE|NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, +@@ -688,6 +785,9 @@ + ngx_http_upload_ctx_t *u; + ngx_int_t rc; + ++ if(r->method & NGX_HTTP_OPTIONS) ++ return ngx_http_upload_options_handler(r); ++ + if (!(r->method & NGX_HTTP_POST)) + return NGX_HTTP_NOT_ALLOWED; + +@@ -724,6 +824,26 @@ + }else + u->sha1_ctx = NULL; + ++ if(ulcf->sha256) { ++ if(u->sha256_ctx == NULL) { ++ u->sha256_ctx = ngx_palloc(r->pool, sizeof(ngx_http_upload_sha256_ctx_t)); ++ if (u->sha256_ctx == NULL) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ } ++ }else ++ u->sha256_ctx = NULL; ++ ++ if(ulcf->sha512) { ++ if(u->sha512_ctx == NULL) { ++ u->sha512_ctx = ngx_palloc(r->pool, sizeof(ngx_http_upload_sha512_ctx_t)); ++ if (u->sha512_ctx == NULL) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ } ++ }else ++ u->sha512_ctx = NULL; ++ + u->calculate_crc32 = ulcf->crc32; + + u->request = r; +@@ -746,6 +866,25 @@ + return rc; + } + ++ rc = ngx_http_upload_eval_path(r); ++ ++ if(rc != NGX_OK) { ++ upload_shutdown_ctx(u); ++ return rc; ++ } ++ ++ rc = ngx_http_upload_eval_state_path(r); ++ ++ if(rc != NGX_OK) { ++ upload_shutdown_ctx(u); ++ return rc; ++ } ++ ++ if (ngx_http_upload_test_expect(r) != NGX_OK) { ++ upload_shutdown_ctx(u); ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ + if(upload_start(u, ulcf) != NGX_OK) + return NGX_HTTP_INTERNAL_SERVER_ERROR; + +@@ -758,6 +897,124 @@ + return NGX_DONE; + } /* }}} */ + ++static ngx_int_t ngx_http_upload_add_headers(ngx_http_request_t *r, ngx_http_upload_loc_conf_t *ulcf) { /* {{{ */ ++ ngx_str_t name; ++ ngx_str_t value; ++ ngx_http_upload_header_template_t *t; ++ ngx_table_elt_t *h; ++ ngx_uint_t i; ++ ++ if(ulcf->header_templates != NULL) { ++ t = ulcf->header_templates->elts; ++ for(i = 0; i < ulcf->header_templates->nelts; i++) { ++ if(ngx_http_complex_value(r, t->name, &name) != NGX_OK) { ++ return NGX_ERROR; ++ } ++ ++ if(ngx_http_complex_value(r, t->value, &value) != NGX_OK) { ++ return NGX_ERROR; ++ } ++ ++ if(name.len != 0 && value.len != 0) { ++ h = ngx_list_push(&r->headers_out.headers); ++ if(h == NULL) { ++ return NGX_ERROR; ++ } ++ ++ h->hash = 1; ++ h->key.len = name.len; ++ h->key.data = name.data; ++ h->value.len = value.len; ++ h->value.data = value.data; ++ } ++ ++ t++; ++ } ++ } ++ ++ return NGX_OK; ++} /* }}} */ ++ ++static ngx_int_t /* {{{ */ ++ngx_http_upload_eval_path(ngx_http_request_t *r) { ++ ngx_http_upload_ctx_t *u; ++ ngx_http_upload_loc_conf_t *ulcf; ++ ngx_str_t value; ++ ++ ulcf = ngx_http_get_module_loc_conf(r, ngx_http_upload_module); ++ u = ngx_http_get_module_ctx(r, ngx_http_upload_module); ++ ++ if(ulcf->store_path->is_dynamic) { ++ u->store_path = ngx_pcalloc(r->pool, sizeof(ngx_path_t)); ++ if(u->store_path == NULL) { ++ return NGX_ERROR; ++ } ++ ++ ngx_memcpy(u->store_path, ulcf->store_path->path, sizeof(ngx_path_t)); ++ ++ if(ngx_http_complex_value(r, &ulcf->store_path->dynamic, &value) != NGX_OK) { ++ return NGX_ERROR; ++ } ++ ++ u->store_path->name.data = value.data; ++ u->store_path->name.len = value.len; ++ } ++ else{ ++ u->store_path = ulcf->store_path->path; ++ } ++ ++ return NGX_OK; ++} /* }}} */ ++ ++static ngx_int_t /* {{{ */ ++ngx_http_upload_eval_state_path(ngx_http_request_t *r) { ++ ngx_http_upload_ctx_t *u; ++ ngx_http_upload_loc_conf_t *ulcf; ++ ngx_str_t value; ++ ++ ulcf = ngx_http_get_module_loc_conf(r, ngx_http_upload_module); ++ u = ngx_http_get_module_ctx(r, ngx_http_upload_module); ++ ++ if(ulcf->state_store_path->is_dynamic) { ++ u->state_store_path = ngx_pcalloc(r->pool, sizeof(ngx_path_t)); ++ if(u->store_path == NULL) { ++ return NGX_ERROR; ++ } ++ ++ ngx_memcpy(u->state_store_path, ulcf->state_store_path->path, sizeof(ngx_path_t)); ++ ++ if(ngx_http_complex_value(r, &ulcf->state_store_path->dynamic, &value) != NGX_OK) { ++ return NGX_ERROR; ++ } ++ ++ u->state_store_path->name.data = value.data; ++ u->state_store_path->name.len = value.len; ++ } ++ else{ ++ u->state_store_path = ulcf->state_store_path->path; ++ } ++ ++ return NGX_OK; ++} /* }}} */ ++ ++static ngx_int_t ngx_http_upload_options_handler(ngx_http_request_t *r) { /* {{{ */ ++ ngx_http_upload_loc_conf_t *ulcf; ++ ++ ulcf = ngx_http_get_module_loc_conf(r, ngx_http_upload_module); ++ ++ r->headers_out.status = NGX_HTTP_OK; ++ ++ if(ngx_http_upload_add_headers(r, ulcf) != NGX_OK) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ r->header_only = 1; ++ r->headers_out.content_length_n = 0; ++ r->allow_ranges = 0; ++ ++ return ngx_http_send_header(r); ++} /* }}} */ ++ + static ngx_int_t ngx_http_upload_body_handler(ngx_http_request_t *r) { /* {{{ */ + ngx_http_upload_loc_conf_t *ulcf = ngx_http_get_module_loc_conf(r, ngx_http_upload_module); + ngx_http_upload_ctx_t *ctx = ngx_http_get_module_ctx(r, ngx_http_upload_module); +@@ -771,6 +1028,10 @@ + ngx_str_t dummy = ngx_string("<ngx_upload_module_dummy>"); + ngx_table_elt_t *h; + ++ if(ngx_http_upload_add_headers(r, ulcf) != NGX_OK) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ + if(ctx->prevent_output) { + r->headers_out.status = NGX_HTTP_CREATED; + +@@ -952,7 +1213,8 @@ + ngx_http_upload_loc_conf_t *ulcf = ngx_http_get_module_loc_conf(r, ngx_http_upload_module); + + ngx_file_t *file = &u->output_file; +- ngx_path_t *path = ulcf->store_path; ++ ngx_path_t *path = u->store_path; ++ ngx_path_t *state_path = u->state_store_path; + uint32_t n; + ngx_uint_t i; + ngx_int_t rc; +@@ -992,6 +1254,7 @@ + "hashed path: %s", file->name.data); + + if(u->partial_content) { ++ ngx_file_t *state_file = &u->state_file; + if(u->merge_buffer == NULL) { + u->merge_buffer = ngx_palloc(r->pool, ulcf->merge_buffer_size); + +@@ -999,21 +1262,20 @@ + return NGX_UPLOAD_NOMEM; + } + +- u->state_file.name.len = file->name.len + sizeof(".state") - 1; +- u->state_file.name.data = ngx_palloc(u->request->pool, u->state_file.name.len + 1); ++ state_file->name.len = state_path->name.len + 1 + state_path->len + u->session_id.len + sizeof(".state"); ++ state_file->name.data = ngx_palloc(u->request->pool, state_file->name.len + 1); + +- if(u->state_file.name.data == NULL) ++ if(state_file->name.data == NULL) + return NGX_UPLOAD_NOMEM; + +- ngx_memcpy(u->state_file.name.data, file->name.data, file->name.len); ++ ngx_memcpy(state_file->name.data, state_path->name.data, state_path->name.len); ++ (void) ngx_sprintf(state_file->name.data + state_path->name.len + 1 + state_path->len, ++ "%V.state%Z", &u->session_id); + +- /* +- * NOTE: we add terminating zero for system calls +- */ +- ngx_memcpy(u->state_file.name.data + file->name.len, ".state", sizeof(".state") - 1 + 1); ++ ngx_create_hashed_filename(state_path, state_file->name.data, state_file->name.len); + + ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0, +- "hashed path of state file: %s", u->state_file.name.data); ++ "hashed path of state file: %s", state_file->name.data); + } + + file->fd = ngx_open_file(file->name.data, NGX_FILE_WRONLY, NGX_FILE_CREATE_OR_OPEN, ulcf->store_access); +@@ -1117,6 +1379,12 @@ + if(u->sha1_ctx != NULL) + SHA1_Init(&u->sha1_ctx->sha1); + ++ if(u->sha256_ctx != NULL) ++ SHA256_Init(&u->sha256_ctx->sha256); ++ ++ if(u->sha512_ctx != NULL) ++ SHA512_Init(&u->sha512_ctx->sha512); ++ + if(u->calculate_crc32) + ngx_crc32_init(u->crc32); + +@@ -1150,7 +1418,10 @@ + #if (NGX_PCRE) + rc = ngx_regex_exec(f[i].regex, &u->field_name, NULL, 0); + +- if (rc != NGX_REGEX_NO_MATCHED && rc < 0) { ++ /* Modified by Naren to work around iMovie and Quicktime which send empty values Added: && u->field_name.len > 0 */ ++ if ((ulcf->empty_field_names && rc != NGX_REGEX_NO_MATCHED && rc < 0 && u->field_name.len != 0) ++ || (!ulcf->empty_field_names && rc != NGX_REGEX_NO_MATCHED && rc < 0)) ++ { + return NGX_UPLOAD_SCRIPTERROR; + } + +@@ -1166,7 +1437,7 @@ + } + } + +- if(pass_field && u->field_name.len > 0) { ++ if(pass_field && u->field_name.len != 0) { + /* + * Here we do a small hack: the content of a non-file field + * is not known until ngx_http_upload_flush_output_buffer +@@ -1207,6 +1478,12 @@ + if(u->sha1_ctx) + SHA1_Final(u->sha1_ctx->sha1_digest, &u->sha1_ctx->sha1); + ++ if(u->sha256_ctx) ++ SHA256_Final(u->sha256_ctx->sha256_digest, &u->sha256_ctx->sha256); ++ ++ if(u->sha512_ctx) ++ SHA512_Final(u->sha512_ctx->sha512_digest, &u->sha512_ctx->sha512); ++ + if(u->calculate_crc32) + ngx_crc32_final(u->crc32); + +@@ -1369,6 +1646,12 @@ + if(u->sha1_ctx) + SHA1_Update(&u->sha1_ctx->sha1, buf, len); + ++ if(u->sha256_ctx) ++ SHA256_Update(&u->sha256_ctx->sha256, buf, len); ++ ++ if(u->sha512_ctx) ++ SHA512_Update(&u->sha512_ctx->sha512, buf, len); ++ + if(u->calculate_crc32) + ngx_crc32_update(&u->crc32, buf, len); + +@@ -1678,7 +1961,7 @@ + ngx_http_upload_merger_state_t ms; + off_t remaining; + ssize_t rc; +- int result; ++ __attribute__((__unused__)) int result; + ngx_buf_t in_buf; + ngx_buf_t out_buf; + ngx_http_upload_loc_conf_t *ulcf = ngx_http_get_module_loc_conf(u->request, ngx_http_upload_module); +@@ -1799,6 +2082,7 @@ + conf->forward_args = NGX_CONF_UNSET; + conf->tame_arrays = NGX_CONF_UNSET; + conf->resumable_uploads = NGX_CONF_UNSET; ++ conf->empty_field_names = NGX_CONF_UNSET; + + conf->buffer_size = NGX_CONF_UNSET_SIZE; + conf->merge_buffer_size = NGX_CONF_UNSET_SIZE; +@@ -1809,6 +2093,7 @@ + conf->limit_rate = NGX_CONF_UNSET_SIZE; + + /* ++ * conf->header_templates, + * conf->field_templates, + * conf->aggregate_field_templates, + * and conf->field_filters are +@@ -1830,27 +2115,15 @@ + } + + if(conf->url.len != 0) { +-#if defined nginx_version && nginx_version >= 7052 +- ngx_conf_merge_path_value(cf, ++ ngx_http_upload_merge_path_value(cf, + &conf->store_path, + prev->store_path, + &ngx_http_upload_temp_path); + +- ngx_conf_merge_path_value(cf, ++ ngx_http_upload_merge_path_value(cf, + &conf->state_store_path, + prev->state_store_path, + &ngx_http_upload_temp_path); +-#else +- ngx_conf_merge_path_value(conf->store_path, +- prev->store_path, +- NGX_HTTP_PROXY_TEMP_PATH, 1, 2, 0, +- ngx_garbage_collector_temp_handler, cf); +- +- ngx_conf_merge_path_value(conf->state_store_path, +- prev->state_store_path, +- NGX_HTTP_PROXY_TEMP_PATH, 1, 2, 0, +- ngx_garbage_collector_temp_handler, cf); +-#endif + } + + ngx_conf_merge_uint_value(conf->store_access, +@@ -1897,6 +2170,11 @@ + prev->resumable_uploads : 0; + } + ++ if(conf->empty_field_names == NGX_CONF_UNSET) { ++ conf->empty_field_names = (prev->empty_field_names != NGX_CONF_UNSET) ? ++ prev->empty_field_names : 0; ++ } ++ + if(conf->field_templates == NULL) { + conf->field_templates = prev->field_templates; + } +@@ -1912,6 +2190,14 @@ + conf->sha1 = prev->sha1; + } + ++ if(prev->sha256) { ++ conf->sha256 = prev->sha256; ++ } ++ ++ if(prev->sha512) { ++ conf->sha512 = prev->sha512; ++ } ++ + if(prev->crc32) { + conf->crc32 = prev->crc32; + } +@@ -1925,6 +2211,10 @@ + conf->cleanup_statuses = prev->cleanup_statuses; + } + ++ if(conf->header_templates == NULL) { ++ conf->header_templates = prev->header_templates; ++ } ++ + return NGX_CONF_OK; + } /* }}} */ + +@@ -2066,6 +2356,80 @@ + return NGX_OK; + } /* }}} */ + ++static ngx_int_t /* {{{ ngx_http_upload_sha256_variable */ ++ngx_http_upload_sha256_variable(ngx_http_request_t *r, ++ ngx_http_variable_value_t *v, uintptr_t data) ++{ ++ ngx_uint_t i; ++ ngx_http_upload_ctx_t *u; ++ u_char *c; ++ u_char *hex_table; ++ ++ u = ngx_http_get_module_ctx(r, ngx_http_upload_module); ++ ++ if(u->sha256_ctx == NULL || u->partial_content) { ++ v->not_found = 1; ++ return NGX_OK; ++ } ++ ++ v->valid = 1; ++ v->no_cacheable = 0; ++ v->not_found = 0; ++ ++ hex_table = (u_char*)data; ++ c = u->sha256_ctx->sha256_digest + SHA256_DIGEST_LENGTH * 2; ++ ++ i = SHA256_DIGEST_LENGTH; ++ ++ do{ ++ i--; ++ *--c = hex_table[u->sha256_ctx->sha256_digest[i] & 0xf]; ++ *--c = hex_table[u->sha256_ctx->sha256_digest[i] >> 4]; ++ }while(i != 0); ++ ++ v->data = u->sha256_ctx->sha256_digest; ++ v->len = SHA256_DIGEST_LENGTH * 2; ++ ++ return NGX_OK; ++} /* }}} */ ++ ++static ngx_int_t /* {{{ ngx_http_upload_sha512_variable */ ++ngx_http_upload_sha512_variable(ngx_http_request_t *r, ++ ngx_http_variable_value_t *v, uintptr_t data) ++{ ++ ngx_uint_t i; ++ ngx_http_upload_ctx_t *u; ++ u_char *c; ++ u_char *hex_table; ++ ++ u = ngx_http_get_module_ctx(r, ngx_http_upload_module); ++ ++ if(u->sha512_ctx == NULL || u->partial_content) { ++ v->not_found = 1; ++ return NGX_OK; ++ } ++ ++ v->valid = 1; ++ v->no_cacheable = 0; ++ v->not_found = 0; ++ ++ hex_table = (u_char*)data; ++ c = u->sha512_ctx->sha512_digest + SHA512_DIGEST_LENGTH * 2; ++ ++ i = SHA512_DIGEST_LENGTH; ++ ++ do{ ++ i--; ++ *--c = hex_table[u->sha512_ctx->sha512_digest[i] & 0xf]; ++ *--c = hex_table[u->sha512_ctx->sha512_digest[i] >> 4]; ++ }while(i != 0); ++ ++ v->data = u->sha512_ctx->sha512_digest; ++ v->len = SHA512_DIGEST_LENGTH * 2; ++ ++ return NGX_OK; ++} /* }}} */ ++ + static ngx_int_t /* {{{ ngx_http_upload_crc32_variable */ + ngx_http_upload_crc32_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +@@ -2299,6 +2663,10 @@ + ", upload_file_md5_uc" + ", upload_file_sha1" + ", upload_file_sha1_uc" ++ ", upload_file_sha256" ++ ", upload_file_sha256_uc" ++ ", upload_file_sha512" ++ ", upload_file_sha512_uc" + ", upload_file_crc32" + ", upload_content_range" + " and upload_file_size" +@@ -2312,6 +2680,12 @@ + if(v->get_handler == ngx_http_upload_sha1_variable) + ulcf->sha1 = 1; + ++ if(v->get_handler == ngx_http_upload_sha256_variable) ++ ulcf->sha256 = 1; ++ ++ if(v->get_handler == ngx_http_upload_sha512_variable) ++ ulcf->sha512 = 1; ++ + if(v->get_handler == ngx_http_upload_crc32_variable) + ulcf->crc32 = 1; + } +@@ -2396,37 +2770,104 @@ + return NGX_CONF_OK; + } /* }}} */ + +-static char * /* {{{ ngx_http_upload_cleanup */ +-ngx_http_upload_cleanup(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ++static char * /* {{{ ngx_http_upload_add_header */ ++ngx_http_upload_add_header(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) + { +- ngx_http_upload_loc_conf_t *ulcf = conf; +- + ngx_str_t *value; +- ngx_uint_t i; +- ngx_int_t status, lo, hi; +- uint16_t *s; ++ ngx_http_upload_header_template_t *h; ++ ngx_array_t **field; ++ ngx_http_compile_complex_value_t ccv; ++ ++ field = (ngx_array_t**) (((u_char*)conf) + cmd->offset); + + value = cf->args->elts; + +- if (ulcf->cleanup_statuses == NULL) { +- ulcf->cleanup_statuses = ngx_array_create(cf->pool, 1, +- sizeof(uint16_t)); +- if (ulcf->cleanup_statuses == NULL) { ++ /* ++ * Add new entry to header template list ++ */ ++ if (*field == NULL) { ++ *field = ngx_array_create(cf->pool, 1, ++ sizeof(ngx_http_upload_header_template_t)); ++ if (*field == NULL) { + return NGX_CONF_ERROR; + } + } + +- for (i = 1; i < cf->args->nelts; i++) { +- if(value[i].len > 4 && value[i].data[3] == '-') { +- lo = ngx_atoi(value[i].data, 3); +- +- if (lo == NGX_ERROR) { +- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, +- "invalid lower bound \"%V\"", &value[i]); +- return NGX_CONF_ERROR; +- } +- +- hi = ngx_atoi(value[i].data + 4, value[i].len - 4); ++ h = ngx_array_push(*field); ++ if (h == NULL) { ++ return NGX_CONF_ERROR; ++ } ++ ++ /* ++ * Compile header name ++ */ ++ h->name = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t)); ++ if(h->name == NULL) { ++ return NGX_CONF_ERROR; ++ } ++ ++ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); ++ ++ ccv.cf = cf; ++ ccv.value = &value[1]; ++ ccv.complex_value = h->name; ++ ++ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { ++ return NGX_CONF_ERROR; ++ } ++ ++ /* ++ * Compile header value ++ */ ++ h->value = ngx_palloc(cf->pool, sizeof(ngx_http_complex_value_t)); ++ if(h->value == NULL) { ++ return NGX_CONF_ERROR; ++ } ++ ++ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); ++ ++ ccv.cf = cf; ++ ccv.value = &value[2]; ++ ccv.complex_value = h->value; ++ ++ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { ++ return NGX_CONF_ERROR; ++ } ++ ++ return NGX_CONF_OK; ++} /* }}} */ ++ ++static char * /* {{{ ngx_http_upload_cleanup */ ++ngx_http_upload_cleanup(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ++{ ++ ngx_http_upload_loc_conf_t *ulcf = conf; ++ ++ ngx_str_t *value; ++ ngx_uint_t i; ++ ngx_int_t status, lo, hi; ++ uint16_t *s; ++ ++ value = cf->args->elts; ++ ++ if (ulcf->cleanup_statuses == NULL) { ++ ulcf->cleanup_statuses = ngx_array_create(cf->pool, 1, ++ sizeof(uint16_t)); ++ if (ulcf->cleanup_statuses == NULL) { ++ return NGX_CONF_ERROR; ++ } ++ } ++ ++ for (i = 1; i < cf->args->nelts; i++) { ++ if(value[i].len > 4 && value[i].data[3] == '-') { ++ lo = ngx_atoi(value[i].data, 3); ++ ++ if (lo == NGX_ERROR) { ++ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, ++ "invalid lower bound \"%V\"", &value[i]); ++ return NGX_CONF_ERROR; ++ } ++ ++ hi = ngx_atoi(value[i].data + 4, value[i].len - 4); + + if (hi == NGX_ERROR) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, +@@ -2453,9 +2894,9 @@ + hi = lo = status; + } + +- if (lo < 400 || hi > 599) { ++ if (lo < 200 || hi > 599) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, +- "value(s) \"%V\" must be between 400 and 599", ++ "value(s) \"%V\" must be between 200 and 599", + &value[i]); + return NGX_CONF_ERROR; + } +@@ -2523,6 +2964,665 @@ + return NGX_CONF_OK; + } /* }}} */ + ++static char * /* {{{ ngx_http_upload_set_path_slot */ ++ngx_http_upload_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ++{ ++ char *p = conf; ++ ++ ssize_t level; ++ ngx_str_t *value; ++ ngx_uint_t i, n; ++ ngx_http_upload_path_t *path, **slot; ++ ngx_http_compile_complex_value_t ccv; ++ ++ slot = (ngx_http_upload_path_t **) (p + cmd->offset); ++ ++ if (*slot) { ++ return "is duplicate"; ++ } ++ ++ path = ngx_pcalloc(cf->pool, sizeof(ngx_http_upload_path_t)); ++ if (path == NULL) { ++ return NGX_CONF_ERROR; ++ } ++ ++ path->path = ngx_pcalloc(cf->pool, sizeof(ngx_path_t)); ++ if (path->path == NULL) { ++ return NGX_CONF_ERROR; ++ } ++ ++ value = cf->args->elts; ++ ++ path->path->name = value[1]; ++ ++ if (path->path->name.data[path->path->name.len - 1] == '/') { ++ path->path->name.len--; ++ } ++ ++ if (ngx_conf_full_name(cf->cycle, &path->path->name, 0) != NGX_OK) { ++ return NULL; ++ } ++ ++ path->path->len = 0; ++ path->path->manager = NULL; ++ path->path->loader = NULL; ++ path->path->conf_file = cf->conf_file->file.name.data; ++ path->path->line = cf->conf_file->line; ++ ++ for (i = 0, n = 2; n < cf->args->nelts; i++, n++) { ++ level = ngx_atoi(value[n].data, value[n].len); ++ if (level == NGX_ERROR || level == 0) { ++ return "invalid value"; ++ } ++ ++ path->path->level[i] = level; ++ path->path->len += level + 1; ++ } ++ ++ while (i < 3) { ++ path->path->level[i++] = 0; ++ } ++ ++ *slot = path; ++ ++ if(ngx_http_script_variables_count(&value[1])) { ++ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); ++ ++ ccv.cf = cf; ++ ccv.value = &value[1]; ++ ccv.complex_value = &path->dynamic; ++ ++ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { ++ return NGX_CONF_ERROR; ++ } ++ ++ path->is_dynamic = 1; ++ } ++ else { ++ if (ngx_add_path(cf, &path->path) == NGX_ERROR) { ++ return NGX_CONF_ERROR; ++ } ++ } ++ ++ return NGX_CONF_OK; ++} /* }}} */ ++ ++ ++static char * /* {{{ ngx_http_upload_merge_path_value */ ++ngx_http_upload_merge_path_value(ngx_conf_t *cf, ngx_http_upload_path_t **path, ngx_http_upload_path_t *prev, ++ ngx_path_init_t *init) ++{ ++ if (*path) { ++ return NGX_CONF_OK; ++ } ++ ++ if (prev) { ++ *path = prev; ++ return NGX_CONF_OK; ++ } ++ ++ *path = ngx_palloc(cf->pool, sizeof(ngx_http_upload_path_t)); ++ if(*path == NULL) { ++ return NGX_CONF_ERROR; ++ } ++ ++ (*path)->path = ngx_pcalloc(cf->pool, sizeof(ngx_path_t)); ++ if((*path)->path == NULL) { ++ return NGX_CONF_ERROR; ++ } ++ ++ (*path)->path->name = init->name; ++ ++ if(ngx_conf_full_name(cf->cycle, &(*path)->path->name, 0) != NGX_OK) { ++ return NGX_CONF_ERROR; ++ } ++ ++ (*path)->path->level[0] = init->level[0]; ++ (*path)->path->level[1] = init->level[1]; ++ (*path)->path->level[2] = init->level[2]; ++ ++ (*path)->path->len = init->level[0] + (init->level[0] ? 1 : 0) ++ + init->level[1] + (init->level[1] ? 1 : 0) ++ + init->level[2] + (init->level[2] ? 1 : 0); ++ ++ (*path)->path->manager = NULL; ++ (*path)->path->loader = NULL; ++ (*path)->path->conf_file = NULL; ++ ++ if(ngx_add_path(cf, &(*path)->path) != NGX_OK) { ++ return NGX_CONF_ERROR; ++ } ++ ++ return NGX_CONF_OK; ++} /* }}} */ ++ ++static ngx_int_t ++ngx_http_write_request_body(ngx_http_request_t *r) ++{ ++ ssize_t n; ++ ngx_chain_t *cl; ++ ngx_temp_file_t *tf; ++ ngx_http_request_body_t *rb; ++ ngx_http_core_loc_conf_t *clcf; ++ ++ rb = r->request_body; ++ ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, ++ "http write client request body, bufs %p", rb->bufs); ++ ++ if (rb->temp_file == NULL) { ++ tf = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)); ++ if (tf == NULL) { ++ return NGX_ERROR; ++ } ++ ++ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); ++ ++ tf->file.fd = NGX_INVALID_FILE; ++ tf->file.log = r->connection->log; ++ tf->path = clcf->client_body_temp_path; ++ tf->pool = r->pool; ++ tf->warn = "a client request body is buffered to a temporary file"; ++ tf->log_level = r->request_body_file_log_level; ++ tf->persistent = r->request_body_in_persistent_file; ++ tf->clean = r->request_body_in_clean_file; ++ ++ if (r->request_body_file_group_access) { ++ tf->access = 0660; ++ } ++ ++ rb->temp_file = tf; ++ ++ if (rb->bufs == NULL) { ++ /* empty body with r->request_body_in_file_only */ ++ ++ if (ngx_create_temp_file(&tf->file, tf->path, tf->pool, ++ tf->persistent, tf->clean, tf->access) ++ != NGX_OK) ++ { ++ return NGX_ERROR; ++ } ++ ++ return NGX_OK; ++ } ++ } ++ ++ if (rb->bufs == NULL) { ++ return NGX_OK; ++ } ++ ++ n = ngx_write_chain_to_temp_file(rb->temp_file, rb->bufs); ++ ++ /* TODO: n == 0 or not complete and level event */ ++ ++ if (n == NGX_ERROR) { ++ return NGX_ERROR; ++ } ++ ++ rb->temp_file->offset += n; ++ ++ /* mark all buffers as written */ ++ ++ for (cl = rb->bufs; cl; cl = cl->next) { ++ cl->buf->pos = cl->buf->last; ++ } ++ ++ rb->bufs = NULL; ++ ++ return NGX_OK; ++} ++ ++static ngx_int_t ++ngx_http_request_body_filter(ngx_http_request_t *r, ngx_chain_t *in) ++{ ++ if (r->headers_in.chunked) { ++ return ngx_http_request_body_chunked_filter(r, in); ++ ++ } else { ++ return ngx_http_request_body_length_filter(r, in); ++ } ++} ++ ++static ngx_int_t ++ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in) ++{ ++#if (NGX_DEBUG) ++ ngx_chain_t *cl; ++#endif ++ ngx_http_request_body_t *rb; ++ ++ rb = r->request_body; ++ ++#if (NGX_DEBUG) ++ ++ for (cl = rb->bufs; cl; cl = cl->next) { ++ ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, ++ "http body old buf t:%d f:%d %p, pos %p, size: %z " ++ "file: %O, size: %z", ++ cl->buf->temporary, cl->buf->in_file, ++ cl->buf->start, cl->buf->pos, ++ cl->buf->last - cl->buf->pos, ++ cl->buf->file_pos, ++ cl->buf->file_last - cl->buf->file_pos); ++ } ++ ++ for (cl = in; cl; cl = cl->next) { ++ ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, ++ "http body new buf t:%d f:%d %p, pos %p, size: %z " ++ "file: %O, size: %z", ++ cl->buf->temporary, cl->buf->in_file, ++ cl->buf->start, cl->buf->pos, ++ cl->buf->last - cl->buf->pos, ++ cl->buf->file_pos, ++ cl->buf->file_last - cl->buf->file_pos); ++ } ++ ++#endif ++ ++ /* TODO: coalesce neighbouring buffers */ ++ ++ if (ngx_chain_add_copy(r->pool, &rb->bufs, in) != NGX_OK) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ return NGX_OK; ++} ++ ++ ++static ngx_int_t ++ngx_http_request_body_length_filter(ngx_http_request_t *r, ngx_chain_t *in) ++{ ++ size_t size; ++ ngx_int_t rc; ++ ngx_buf_t *b; ++ ngx_chain_t *cl, *tl, *out, **ll; ++ ngx_http_request_body_t *rb; ++ ++ rb = r->request_body; ++ ++ if (rb->rest == -1) { ++ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, ++ "http request body content length filter"); ++ ++ rb->rest = r->headers_in.content_length_n; ++ } ++ ++ out = NULL; ++ ll = &out; ++ ++ for (cl = in; cl; cl = cl->next) { ++ ++ tl = ngx_chain_get_free_buf(r->pool, &rb->free); ++ if (tl == NULL) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ b = tl->buf; ++ ++ ngx_memzero(b, sizeof(ngx_buf_t)); ++ ++ b->temporary = 1; ++ b->tag = (ngx_buf_tag_t) &ngx_http_read_client_request_body; ++ b->start = cl->buf->start; ++ b->pos = cl->buf->pos; ++ b->last = cl->buf->last; ++ b->end = cl->buf->end; ++ ++ size = cl->buf->last - cl->buf->pos; ++ ++ if ((off_t) size < rb->rest) { ++ cl->buf->pos = cl->buf->last; ++ rb->rest -= size; ++ ++ } else { ++ cl->buf->pos += rb->rest; ++ rb->rest = 0; ++ b->last = cl->buf->pos; ++ b->last_buf = 1; ++ } ++ ++ *ll = tl; ++ ll = &tl->next; ++ } ++ ++ rc = ngx_http_request_body_save_filter(r, out); ++ ++ ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out, ++ (ngx_buf_tag_t) &ngx_http_read_client_request_body); ++ ++ return rc; ++} ++ ++static ngx_int_t ++ngx_http_request_body_chunked_filter(ngx_http_request_t *r, ngx_chain_t *in) ++{ ++ size_t size; ++ ngx_int_t rc; ++ ngx_buf_t *b; ++ ngx_chain_t *cl, *out, *tl, **ll; ++ ngx_http_request_body_t *rb; ++ ngx_http_core_loc_conf_t *clcf; ++ ++ rb = r->request_body; ++ ++ if (rb->rest == -1) { ++ ++ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, ++ "http request body chunked filter"); ++ ++ rb->chunked = ngx_pcalloc(r->pool, sizeof(ngx_http_chunked_t)); ++ if (rb->chunked == NULL) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ r->headers_in.content_length_n = 0; ++ rb->rest = 3; ++ } ++ ++ out = NULL; ++ ll = &out; ++ ++ for (cl = in; cl; cl = cl->next) { ++ ++ for ( ;; ) { ++ ++ ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0, ++ "http body chunked buf " ++ "t:%d f:%d %p, pos %p, size: %z file: %O, size: %z", ++ cl->buf->temporary, cl->buf->in_file, ++ cl->buf->start, cl->buf->pos, ++ cl->buf->last - cl->buf->pos, ++ cl->buf->file_pos, ++ cl->buf->file_last - cl->buf->file_pos); ++ ++ rc = ngx_http_parse_chunked(r, cl->buf, rb->chunked); ++ ++ if (rc == NGX_OK) { ++ ++ /* a chunk has been parsed successfully */ ++ ++ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); ++ ++ if (clcf->client_max_body_size ++ && clcf->client_max_body_size ++ < r->headers_in.content_length_n + rb->chunked->size) ++ { ++ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, ++ "client intended to send too large chunked " ++ "body: %O bytes", ++ r->headers_in.content_length_n ++ + rb->chunked->size); ++ ++ r->lingering_close = 1; ++ ++ return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE; ++ } ++ ++ tl = ngx_chain_get_free_buf(r->pool, &rb->free); ++ if (tl == NULL) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ b = tl->buf; ++ ++ ngx_memzero(b, sizeof(ngx_buf_t)); ++ ++ b->temporary = 1; ++ b->tag = (ngx_buf_tag_t) &ngx_http_read_client_request_body; ++ b->start = cl->buf->start; ++ b->pos = cl->buf->pos; ++ b->last = cl->buf->last; ++ b->end = cl->buf->end; ++ ++ *ll = tl; ++ ll = &tl->next; ++ ++ size = cl->buf->last - cl->buf->pos; ++ ++ if ((off_t) size > rb->chunked->size) { ++ cl->buf->pos += rb->chunked->size; ++ r->headers_in.content_length_n += rb->chunked->size; ++ rb->chunked->size = 0; ++ ++ } else { ++ rb->chunked->size -= size; ++ r->headers_in.content_length_n += size; ++ cl->buf->pos = cl->buf->last; ++ } ++ ++ b->last = cl->buf->pos; ++ ++ continue; ++ } ++ ++ if (rc == NGX_DONE) { ++ ++ /* a whole response has been parsed successfully */ ++ ++ rb->rest = 0; ++ ++ tl = ngx_chain_get_free_buf(r->pool, &rb->free); ++ if (tl == NULL) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ b = tl->buf; ++ ++ ngx_memzero(b, sizeof(ngx_buf_t)); ++ ++ b->last_buf = 1; ++ ++ *ll = tl; ++ ll = &tl->next; ++ ++ break; ++ } ++ ++ if (rc == NGX_AGAIN) { ++ ++ /* set rb->rest, amount of data we want to see next time */ ++ ++ rb->rest = rb->chunked->length; ++ ++ break; ++ } ++ ++ /* invalid */ ++ ++ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, ++ "client sent invalid chunked body"); ++ ++ return NGX_HTTP_BAD_REQUEST; ++ } ++ } ++ ++ rc = ngx_http_request_body_save_filter(r, out); ++ ++ ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out, ++ (ngx_buf_tag_t) &ngx_http_read_client_request_body); ++ ++ return rc; ++} ++ ++static ngx_int_t ++ngx_http_do_read_client_request_body(ngx_http_request_t *r) ++{ ++ off_t rest; ++ size_t size; ++ ssize_t n; ++ ngx_int_t rc; ++ ngx_buf_t *b; ++ ngx_chain_t *cl, out; ++ ngx_connection_t *c; ++ ngx_http_request_body_t *rb; ++ ngx_http_core_loc_conf_t *clcf; ++ ++ c = r->connection; ++ rb = r->request_body; ++ ++ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, ++ "http read client request body"); ++ ++ for ( ;; ) { ++ for ( ;; ) { ++ if (rb->buf->last == rb->buf->end) { ++ ++ /* pass buffer to request body filter chain */ ++ ++ out.buf = rb->buf; ++ out.next = NULL; ++ ++ rc = ngx_http_request_body_filter(r, &out); ++ ++ if (rc != NGX_OK) { ++ return rc; ++ } ++ ++ /* write to file */ ++ ++ if (ngx_http_write_request_body(r) != NGX_OK) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ /* update chains */ ++ ++ rc = ngx_http_request_body_filter(r, NULL); ++ ++ if (rc != NGX_OK) { ++ return rc; ++ } ++ ++ if (rb->busy != NULL) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ rb->buf->pos = rb->buf->start; ++ rb->buf->last = rb->buf->start; ++ } ++ size = rb->buf->end - rb->buf->last; ++ rest = rb->rest - (rb->buf->last - rb->buf->pos); ++ ++ if ((off_t) size > rest) { ++ size = (size_t) rest; ++ } ++ ++ n = c->recv(c, rb->buf->last, size); ++ ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, ++ "http client request body recv %z", n); ++ ++ if (n == NGX_AGAIN) { ++ break; ++ } ++ ++ if (n == 0) { ++ ngx_log_error(NGX_LOG_INFO, c->log, 0, ++ "client prematurely closed connection"); ++ } ++ ++ if (n == 0 || n == NGX_ERROR) { ++ c->error = 1; ++ return NGX_HTTP_BAD_REQUEST; ++ } ++ ++ rb->buf->last += n; ++ r->request_length += n; ++ ++ if (n == rest) { ++ /* pass buffer to request body filter chain */ ++ ++ out.buf = rb->buf; ++ out.next = NULL; ++ ++ rc = ngx_http_request_body_filter(r, &out); ++ ++ if (rc != NGX_OK) { ++ return rc; ++ } ++ } ++ ++ if (rb->rest == 0) { ++ break; ++ } ++ ++ if (rb->buf->last < rb->buf->end) { ++ break; ++ } ++ } ++ ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, ++ "http client request body rest %O", rb->rest); ++ if (rb->rest == 0) { ++ break; ++ } ++ ++ if (!c->read->ready) { ++ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); ++ ngx_add_timer(c->read, clcf->client_body_timeout); ++ ++ if (ngx_handle_read_event(c->read, 0) != NGX_OK) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ return NGX_AGAIN; ++ } ++ } ++ ++ if (c->read->timer_set) { ++ ngx_del_timer(c->read); ++ } ++ ++ if (rb->temp_file || r->request_body_in_file_only) { ++ ++ /* save the last part */ ++ ++ if (ngx_http_write_request_body(r) != NGX_OK) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ cl = ngx_chain_get_free_buf(r->pool, &rb->free); ++ if (cl == NULL) { ++ return NGX_HTTP_INTERNAL_SERVER_ERROR; ++ } ++ ++ b = cl->buf; ++ ++ ngx_memzero(b, sizeof(ngx_buf_t)); ++ ++ b->in_file = 1; ++ b->file_last = rb->temp_file->file.offset; ++ b->file = &rb->temp_file->file; ++ ++ rb->bufs = cl; ++ } ++ ++ r->read_event_handler = ngx_http_block_reading; ++ ++ rb->post_handler(r); ++ ++ return NGX_OK; ++} ++ ++ ++static void ++ngx_http_read_client_request_body_handler(ngx_http_request_t *r) ++{ ++ ngx_int_t rc; ++ ++ if (r->connection->read->timedout) { ++ r->connection->timedout = 1; ++ ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT); ++ return; ++ } ++ ++ rc = ngx_http_do_read_client_request_body(r); ++ ++ if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { ++ ngx_http_finalize_request(r, rc); ++ } ++} ++ ++ + ngx_int_t /* {{{ ngx_http_read_upload_client_request_body */ + ngx_http_read_upload_client_request_body(ngx_http_request_t *r) { + ssize_t size, preread; +@@ -2625,9 +3725,9 @@ + + /* the whole request body may be placed in r->header_in */ + +- rb->to_write = rb->bufs; +- +- r->read_event_handler = ngx_http_read_upload_client_request_body_handler; ++ rb->buf = r->header_in; ++ r->read_event_handler = ngx_http_read_client_request_body_handler; ++ r->write_event_handler = ngx_http_request_empty_handler; + + return ngx_http_do_read_upload_client_request_body(r); + } +@@ -2684,7 +3784,9 @@ + + *next = cl; + +- rb->to_write = rb->bufs; ++ /* ++ * rb->to_write = rb->bufs; ++ */ + + r->read_event_handler = ngx_http_read_upload_client_request_body_handler; + +@@ -2766,7 +3868,7 @@ + for ( ;; ) { + if (rb->buf->last == rb->buf->end) { + +- rc = ngx_http_process_request_body(r, rb->to_write); ++ rc = ngx_http_process_request_body(r, rb->bufs); + + switch(rc) { + case NGX_OK: +@@ -2781,8 +3883,7 @@ + default: + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } +- +- rb->to_write = rb->bufs->next ? rb->bufs->next : rb->bufs; ++ rb->bufs = rb->bufs->next ? rb->bufs->next : rb->bufs; + rb->buf->last = rb->buf->start; + } + +@@ -2874,7 +3975,7 @@ + ngx_del_timer(c->read); + } + +- rc = ngx_http_process_request_body(r, rb->to_write); ++ rc = ngx_http_process_request_body(r, rb->bufs); + + switch(rc) { + case NGX_OK: +@@ -3299,6 +4400,14 @@ + return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE; + } + ++ if( (upload_ctx->content_range_n.end - upload_ctx->content_range_n.start + 1) ++ != headers_in->content_length_n) ++ { ++ ngx_log_error(NGX_LOG_ERR, upload_ctx->log, 0, ++ "range length is not equal to content length"); ++ return NGX_HTTP_RANGE_NOT_SATISFIABLE; ++ } ++ + upload_ctx->partial_content = 1; + } + } +@@ -3436,8 +4545,8 @@ + return NGX_ERROR; + } + +- if(range_n->start >= range_n->end || range_n->start >= range_n->total +- || range_n->end > range_n->total) ++ if(range_n->start > range_n->end || range_n->start >= range_n->total ++ || range_n->end >= range_n->total) + { + return NGX_ERROR; + } +@@ -3673,3 +4782,43 @@ + } + } /* }}} */ + ++static ngx_int_t /* {{{ */ ++ngx_http_upload_test_expect(ngx_http_request_t *r) ++{ ++ ngx_int_t n; ++ ngx_str_t *expect; ++ ++ if (r->expect_tested ++ || r->headers_in.expect == NULL ++ || r->http_version < NGX_HTTP_VERSION_11) ++ { ++ return NGX_OK; ++ } ++ ++ r->expect_tested = 1; ++ ++ expect = &r->headers_in.expect->value; ++ ++ if (expect->len != sizeof("100-continue") - 1 ++ || ngx_strncasecmp(expect->data, (u_char *) "100-continue", ++ sizeof("100-continue") - 1) ++ != 0) ++ { ++ return NGX_OK; ++ } ++ ++ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, ++ "send 100 Continue"); ++ ++ n = r->connection->send(r->connection, ++ (u_char *) "HTTP/1.1 100 Continue" CRLF CRLF, ++ sizeof("HTTP/1.1 100 Continue" CRLF CRLF) - 1); ++ ++ if (n == sizeof("HTTP/1.1 100 Continue" CRLF CRLF) - 1) { ++ return NGX_OK; ++ } ++ ++ /* we assume that such small packet should be send successfully */ ++ ++ return NGX_ERROR; ++} /* }}} */ + diff --git a/www/tengine/files/extra-patch-ngx_http_upstream.h b/www/tengine/files/extra-patch-ngx_http_upstream.h new file mode 100644 index 000000000000..f4c1f7ada782 --- /dev/null +++ b/www/tengine/files/extra-patch-ngx_http_upstream.h @@ -0,0 +1,13 @@ +--- src/http/ngx_http_upstream.h.orig 2010-01-14 04:20:57.000000000 +0300 ++++ src/http/ngx_http_upstream.h 2010-01-14 04:22:00.000000000 +0300 +@@ -105,6 +105,10 @@ + + ngx_array_t *servers; /* ngx_http_upstream_server_t */ + ++ ngx_array_t *values; ++ ngx_array_t *lengths; ++ ngx_uint_t retries; ++ + ngx_uint_t flags; + ngx_str_t host; + u_char *file_name; diff --git a/www/tengine/files/extra-patch-ngx_postgres-config b/www/tengine/files/extra-patch-ngx_postgres-config new file mode 100644 index 000000000000..cfba3278ca87 --- /dev/null +++ b/www/tengine/files/extra-patch-ngx_postgres-config @@ -0,0 +1,19 @@ +--- ../ngx_postgres-0.9/config.orig 2011-12-29 11:17:24.000000000 +0400 ++++ ../ngx_postgres-0.9/config 2011-12-29 11:18:47.000000000 +0400 +@@ -48,12 +48,12 @@ + + if [ $ngx_found = no ]; then + # FreeBSD +- ngx_feature="libpq library in /usr/local/" +- ngx_feature_path="/usr/local/include" ++ ngx_feature="libpq library in %%PREFIX%%/" ++ ngx_feature_path="%%PREFIX%%/include" + if [ $NGX_RPATH = YES ]; then +- ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lpq" ++ ngx_feature_libs="-R%%PREFIX%%/lib -L%%PREFIX%%/lib -lpq" + else +- ngx_feature_libs="-L/usr/local/lib -lpq" ++ ngx_feature_libs="-L%%PREFIX%%/lib -lpq" + fi + . auto/feature + fi diff --git a/www/tengine/files/nginx.in b/www/tengine/files/nginx.in new file mode 100644 index 000000000000..fc339c30ac34 --- /dev/null +++ b/www/tengine/files/nginx.in @@ -0,0 +1,116 @@ +#!/bin/sh + +# PROVIDE: nginx +# REQUIRE: LOGIN cleanvar +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable nginx: +# nginx_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable nginx +# nginx_profiles (str): Set to "" by default. +# Define your profiles here. +# nginx_pid_prefix (str): Set to "" by default. +# When using profiles manually assign value to "nginx_" +# for prevent collision with other PIDs names. +# nginxlimits_enable (bool): Set to "NO" by default. +# Set it to yes to run `limits $limits_args` +# just before nginx starts. +# nginx_flags (str): Set to "" by default. +# Extra flags passed to start command. +# nginxlimits_args (str): Default to "-e -U %%WWWOWN%%" +# Arguments of pre-start limits run. + +. /etc/rc.subr + +name="nginx" +rcvar=nginx_enable + +start_precmd="nginx_precmd" +restart_precmd="nginx_checkconfig" +reload_precmd="nginx_checkconfig" +configtest_cmd="nginx_checkconfig" +gracefulstop_cmd="nginx_gracefulstop" +command="%%PREFIX%%/sbin/nginx" +_pidprefix="%%NGINX_RUNDIR%%" +pidfile="${_pidprefix}/${name}.pid" +_tmpprefix="%%NGINX_TMPDIR%%" +required_files=%%PREFIX%%/etc/tengine/nginx.conf +extra_commands="reload configtest gracefulstop" + +[ -z "$nginx_enable" ] && nginx_enable="NO" +[ -z "$nginxlimits_enable" ] && nginxlimits_enable="NO" +[ -z "$nginxlimits_args" ] && nginxlimits_args="-e -U %%WWWOWN%%" + +load_rc_config $name + +if [ -n "$2" ]; then + profile="$2" + if [ "x${nginx_profiles}" != "x" ]; then + pidfile="${_pidprefix}/${nginx_pid_prefix}${profile}.pid" + eval nginx_configfile="\${nginx_${profile}_configfile:-}" + if [ "x${nginx_configfile}" = "x" ]; then + echo "You must define a configuration file (nginx_${profile}_configfile)" + exit 1 + fi + required_files="${nginx_configfile}" + eval nginx_enable="\${nginx_${profile}_enable:-${nginx_enable}}" + eval nginx_flags="\${nginx_${profile}_flags:-${nginx_flags}}" + eval nginxlimits_enable="\${nginxlimits_${profile}_enable:-${nginxlimits_enable}}" + eval nginxlimits_args="\${nginxlimits_${profile}_args:-${nginxlimits_args}}" + nginx_flags="-c ${nginx_configfile} -g \"pid ${pidfile};\" ${nginx_flags}" + else + echo "$0: extra argument ignored" + fi +else + if [ "x${nginx_profiles}" != "x" -a "x$1" != "x" ]; then + for profile in ${nginx_profiles}; do + echo "===> nginx profile: ${profile}" + %%PREFIX%%/etc/rc.d/nginx $1 ${profile} + retcode="$?" + if [ "0${retcode}" -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + exit 0 + fi +fi + +# tmpfs(5) +nginx_checktmpdir() +{ + if [ ! -d ${_tmpprefix} ] ; then + install -d -o %%WWWOWN%% -g %%WWWGRP%% -m 755 ${_tmpprefix} + fi +} + +nginx_checkconfig() +{ + nginx_checktmpdir + + echo "Performing sanity check on nginx configuration:" + eval ${command} ${nginx_flags} -t +} + +nginx_gracefulstop() +{ + echo "Performing a graceful stop:" + sig_stop="QUIT" + run_rc_command ${rc_prefix}stop $rc_extra_args || return 1 +} + +nginx_precmd() +{ + nginx_checkconfig + + if checkyesno nginxlimits_enable + then + eval `/usr/bin/limits ${nginxlimits_args}` 2>/dev/null + else + return 0 + fi +} + +run_rc_command "$1" diff --git a/www/tengine/files/patch-conf-nginx.conf b/www/tengine/files/patch-conf-nginx.conf new file mode 100644 index 000000000000..fb323ec67620 --- /dev/null +++ b/www/tengine/files/patch-conf-nginx.conf @@ -0,0 +1,100 @@ +--- conf/nginx.conf.orig 2014-01-08 13:24:46.000000000 +0100 ++++ conf/nginx.conf 2014-01-11 18:04:48.015083445 +0100 +@@ -13,12 +13,45 @@ + worker_connections 1024; + } + +-# load modules compiled as Dynamic Shared Object (DSO) ++# Load modules compiled as Dynamic Shared Object (DSO) ++# Comment out modules you do not wish to load + # +-#dso { +-# load ngx_http_fastcgi_module.so; +-# load ngx_http_rewrite_module.so; +-#} ++dso { ++ load ngx_http_access_module.so; ++ load ngx_http_addition_filter_module.so; ++ load ngx_http_autoindex_module.so; ++ load ngx_http_browser_module.so; ++ load ngx_http_charset_filter_module.so; ++ load ngx_http_concat_module.so; ++ load ngx_http_empty_gif_module.so; ++ load ngx_http_fastcgi_module.so; ++ load ngx_http_flv_module.so; ++ load ngx_http_footer_filter_module.so; ++ load ngx_http_geoip_module.so; ++ load ngx_http_image_filter_module.so; ++ load ngx_http_limit_conn_module.so; ++ load ngx_http_limit_req_module.so; ++ load ngx_http_lua_module.so; ++ load ngx_http_map_module.so; ++ load ngx_http_memcached_module.so; ++ load ngx_http_mp4_module.so; ++ load ngx_http_random_index_module.so; ++ load ngx_http_referer_module.so; ++ load ngx_http_scgi_module.so; ++ load ngx_http_secure_link_module.so; ++ load ngx_http_slice_module.so; ++ load ngx_http_split_clients_module.so; ++ load ngx_http_sub_filter_module.so; ++ load ngx_http_sysguard_module.so; ++ load ngx_http_trim_filter_module.so; ++ load ngx_http_upstream_ip_hash_module.so; ++ load ngx_http_upstream_least_conn_module.so; ++ load ngx_http_upstream_session_sticky_module.so; ++ load ngx_http_user_agent_module.so; ++ load ngx_http_userid_filter_module.so; ++ load ngx_http_uwsgi_module.so; ++ load ngx_http_xslt_filter_module.so; ++} + + http { + include mime.types; +@@ -39,7 +72,7 @@ + #gzip on; + + server { +- listen 80; ++ listen %%HTTP_PORT%%; + server_name localhost; + + #charset koi8-r; +@@ -47,7 +80,7 @@ + #access_log logs/host.access.log main; + + location / { +- root html; ++ root %%PREFIX%%/www/nginx; + index index.html index.htm; + } + +@@ -57,7 +90,7 @@ + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { +- root html; ++ root %%PREFIX%%/www/nginx-dist; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 +@@ -102,16 +135,16 @@ + # HTTPS server + # + #server { +- # listen 443; ++ # listen 443 ssl; + # server_name localhost; + +- # ssl on; + # ssl_certificate cert.pem; + # ssl_certificate_key cert.key; + ++ # ssl_session_cache shared:SSL:1m; + # ssl_session_timeout 5m; + +- # ssl_protocols SSLv2 SSLv3 TLSv1; ++ # ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; + # ssl_ciphers HIGH:!aNULL:!MD5; + # ssl_prefer_server_ciphers on; + diff --git a/www/tengine/files/patch-man-nginx b/www/tengine/files/patch-man-nginx new file mode 100644 index 000000000000..b49b214d777c --- /dev/null +++ b/www/tengine/files/patch-man-nginx @@ -0,0 +1,108 @@ +--- man/nginx.8.orig 2013-11-22 08:47:33.000000000 +0100 ++++ man/nginx.8 2014-01-17 04:06:57.811820154 +0100 +@@ -1,6 +1,8 @@ + .\" + .\" Copyright (C) 2010 Sergey A. Osokin ++.\" Copyright (C) 2014 Jim Ohlstein + .\" Copyright (C) Nginx, Inc. ++.\" Copyright (C) Taobao, Inc. + .\" All rights reserved. + .\" + .\" Redistribution and use in source and binary forms, with or without +@@ -25,7 +27,7 @@ + .\" SUCH DAMAGE. + .\" + .\" +-.Dd March 6, 2012 ++.Dd January 16, 2014 + .Dt NGINX 8 + .Os + .Sh NAME +@@ -35,7 +35,7 @@ + .Nd "HTTP and reverse proxy server, mail proxy server" + .Sh SYNOPSIS + .Nm +-.Op Fl ?hqtVv ++.Op Fl ?dhlmqtVv + .Op Fl c Ar file + .Op Fl g Ar directives + .Op Fl p Ar prefix +@@ -46,6 +48,13 @@ + It is known for its high performance, stability, rich feature set, simple + configuration, and low resource consumption. + .Pp ++Tengine (pronounced ++.Dq T engine ) ++is a fork of ++.Nm ++by Taobao in 2011. It supports dynamic shared objects (DSO's) ++and has other enhanced features. ++.Pp + The options are as follows: + .Bl -tag -width ".Fl d Ar directives" + .It Fl ?\& , h +@@ -53,11 +62,22 @@ + .It Fl c Ar file + Use an alternative configuration + .Ar file . ++.It Fl d ++Dump the contents of the configuration file, including the ++contents of 'included' files. + .It Fl g Ar directives + Set global configuration directives. + See + .Sx EXAMPLES + for details. ++.It Fl l ++Show all supported directives then exit. ++.It Fl m ++Show all compiled-in modules then exit. ++Tengine supports DSO modules since 1.4.0. ++The tag 'static' means static module. ++The tag 'shared' means dynamic shared module which is also ++attached with major and minor version of this modules. + .It Fl p Ar prefix + Set the prefix path. + The default value is +@@ -113,10 +133,6 @@ + Shut down gracefully. + .It Dv SIGUSR1 + Reopen log files. +-.It Dv SIGUSR2 +-Upgrade the +-.Nm +-executable on the fly. + .It Dv SIGWINCH + Shut down worker processes gracefully. + .El +@@ -183,14 +199,20 @@ + .\"Xr nginx.conf 5 + .\"Pp + Documentation at +-.Pa http://nginx.org/en/docs/ . ++.Pa http://nginx.org/en/docs/ ++and ++.Pa http://tengine.taobao.org/documentation.html . + .Pp + For questions and technical support, please refer to +-.Pa http://nginx.org/en/support.html . ++.Pa http://nginx.org/en/support.html ++and ++.Pa http://tengine.taobao.org/ . + .Sh HISTORY + Development of + .Nm + started in 2002, with the first public release on October 4, 2004. ++.Pp ++Tengine was open sourced in 2011. + .Sh AUTHORS + .An -nosplit + .An Igor Sysoev Aq igor@sysoev.ru . +@@ -199,4 +221,6 @@ + .An Sergey A. Osokin Aq osa@FreeBSD.org.ru + as a result of compiling many + .Nm +-documents from all over the world. ++documents from all over the world. Tengine specific ++portions added by ++.An Jim Ohlstein Aq jim@ohlste.in diff --git a/www/tengine/pkg-descr b/www/tengine/pkg-descr new file mode 100644 index 000000000000..7441b185ed15 --- /dev/null +++ b/www/tengine/pkg-descr @@ -0,0 +1,7 @@ +Tengine is a web server originated by Taobao, the largest e-commerce +website in Asia. It is based on the Nginx HTTP server and has many +advanced features. Tengine has proven to be very stable and +efficient on some of the top 100 websites in the world, including +taobao.com and tmall.com. + +WWW: https://github.com/alibaba/tengine diff --git a/www/tengine/pkg-plist b/www/tengine/pkg-plist new file mode 100644 index 000000000000..838c51402831 --- /dev/null +++ b/www/tengine/pkg-plist @@ -0,0 +1,205 @@ +@unexec if cmp -s %D/%%ETCDIR%%/fastcgi_params-dist %D/%%ETCDIR%%/fastcgi_params; then rm -f %D/%%ETCDIR%%/fastcgi_params; fi +%%ETCDIR%%/fastcgi_params-dist +@exec if [ ! -f %D/%%ETCDIR%%/fastcgi_params ] ; then cp -p %D/%F %B/fastcgi_params && chmod u+w %B/fastcgi_params; fi +%%ETCDIR%%/koi-utf +%%ETCDIR%%/koi-win +@unexec if cmp -s %D/%%ETCDIR%%/scgi_params-dist %D/%%ETCDIR%%/scgi_params; then rm -f %D/%%ETCDIR%%/scgi_params; fi +%%ETCDIR%%/scgi_params-dist +@exec if [ ! -f %D/%%ETCDIR%%/scgi_params ] ; then cp -p %D/%F %B/scgi_params && chmod u+w %B/scgi_params; fi +@unexec if cmp -s %D/%%ETCDIR%%/uwsgi_params-dist %D/%%ETCDIR%%/uwsgi_params; then rm -f %D/%%ETCDIR%%/uwsgi_params; fi +%%ETCDIR%%/uwsgi_params-dist +@exec if [ ! -f %D/%%ETCDIR%%/uwsgi_params ] ; then cp -p %D/%F %B/uwsgi_params && chmod u+w %B/uwsgi_params; fi +%%ETCDIR%%/win-utf +@unexec if cmp -s %D/%%ETCDIR%%/mime.types-dist %D/%%ETCDIR%%/mime.types; then rm -f %D/%%ETCDIR%%/mime.types; fi +%%ETCDIR%%/mime.types-dist +@exec if [ ! -f %D/%%ETCDIR%%/mime.types ] ; then cp -p %D/%F %B/mime.types && chmod u+w %B/mime.types; fi +@unexec if cmp -s %D/%%ETCDIR%%/nginx.conf-dist %D/%%ETCDIR%%/nginx.conf; then rm -f %D/%%ETCDIR%%/nginx.conf; fi +@dirrmtry %%ETCDIR%% +%%ETCDIR%%/nginx.conf-dist +@exec if [ ! -f %D/%%ETCDIR%%/nginx.conf ] ; then cp -p %D/%F %B/nginx.conf && chmod u+w %B/nginx.conf; fi +@exec if [ ! -d %%NGINX_TMPDIR%% ] ; then mkdir %%NGINX_TMPDIR%%; fi +%%WWWDATA%%@exec mkdir -p -m 755 %D/www/nginx-dist +%%WWWDATA%%@exec if [ ! -d %D/www/nginx/ ] ; then ln -fs %D/www/nginx-dist %D/www/nginx; fi +%%WWWDATA%%www/nginx-dist/EXAMPLE_DIRECTORY-DONT_ADD_OR_TOUCH_ANYTHING +%%WWWDATA%%www/nginx-dist/index.html +%%WWWDATA%%www/nginx-dist/50x.html +%%WWWDATA%%@exec chmod a-w %D/www/nginx-dist +%%WWWDATA%%@unexec if [ -L %D/www/nginx ]; then rm -f %D/www/nginx; fi +%%WWWDATA%%@dirrmtry www/nginx-dist +%%ETCDIR%%/include/ddebug.h +%%ETCDIR%%/include/nginx.h +%%ETCDIR%%/include/ngx_alloc.h +%%ETCDIR%%/include/ngx_array.h +%%ETCDIR%%/include/ngx_atomic.h +%%ETCDIR%%/include/ngx_auto_config.h +%%ETCDIR%%/include/ngx_auto_headers.h +%%ETCDIR%%/include/ngx_buf.h +%%ETCDIR%%/include/ngx_channel.h +%%ETCDIR%%/include/ngx_conf_file.h +%%ETCDIR%%/include/ngx_config.h +%%ETCDIR%%/include/ngx_connection.h +%%ETCDIR%%/include/ngx_core.h +%%ETCDIR%%/include/ngx_crc.h +%%ETCDIR%%/include/ngx_crc32.h +%%ETCDIR%%/include/ngx_crypt.h +%%ETCDIR%%/include/ngx_cycle.h +%%ETCDIR%%/include/ngx_darwin.h +%%ETCDIR%%/include/ngx_darwin_config.h +%%ETCDIR%%/include/ngx_errno.h +%%ETCDIR%%/include/ngx_event.h +%%ETCDIR%%/include/ngx_event_busy_lock.h +%%ETCDIR%%/include/ngx_event_connect.h +%%ETCDIR%%/include/ngx_event_openssl.h +%%ETCDIR%%/include/ngx_event_pipe.h +%%ETCDIR%%/include/ngx_event_posted.h +%%ETCDIR%%/include/ngx_event_timer.h +%%ETCDIR%%/include/ngx_file.h +%%ETCDIR%%/include/ngx_files.h +%%ETCDIR%%/include/ngx_freebsd.h +%%ETCDIR%%/include/ngx_freebsd_config.h +%%ETCDIR%%/include/ngx_freebsd_rfork_thread.h +%%ETCDIR%%/include/ngx_gcc_atomic_amd64.h +%%ETCDIR%%/include/ngx_gcc_atomic_ppc.h +%%ETCDIR%%/include/ngx_gcc_atomic_sparc64.h +%%ETCDIR%%/include/ngx_gcc_atomic_x86.h +%%ETCDIR%%/include/ngx_hash.h +%%ETCDIR%%/include/ngx_http.h +%%ETCDIR%%/include/ngx_http_busy_lock.h +%%ETCDIR%%/include/ngx_http_cache.h +%%ETCDIR%%/include/ngx_http_config.h +%%ETCDIR%%/include/ngx_http_core_module.h +%%ETCDIR%%/include/ngx_http_lua_accessby.h +%%ETCDIR%%/include/ngx_http_lua_args.h +%%ETCDIR%%/include/ngx_http_lua_bodyfilterby.h +%%ETCDIR%%/include/ngx_http_lua_cache.h +%%ETCDIR%%/include/ngx_http_lua_capturefilter.h +%%ETCDIR%%/include/ngx_http_lua_clfactory.h +%%ETCDIR%%/include/ngx_http_lua_common.h +%%ETCDIR%%/include/ngx_http_lua_conf.h +%%ETCDIR%%/include/ngx_http_lua_consts.h +%%ETCDIR%%/include/ngx_http_lua_contentby.h +%%ETCDIR%%/include/ngx_http_lua_control.h +%%ETCDIR%%/include/ngx_http_lua_coroutine.h +%%ETCDIR%%/include/ngx_http_lua_ctx.h +%%ETCDIR%%/include/ngx_http_lua_directive.h +%%ETCDIR%%/include/ngx_http_lua_exception.h +%%ETCDIR%%/include/ngx_http_lua_headerfilterby.h +%%ETCDIR%%/include/ngx_http_lua_headers.h +%%ETCDIR%%/include/ngx_http_lua_headers_in.h +%%ETCDIR%%/include/ngx_http_lua_headers_out.h +%%ETCDIR%%/include/ngx_http_lua_initby.h +%%ETCDIR%%/include/ngx_http_lua_log.h +%%ETCDIR%%/include/ngx_http_lua_logby.h +%%ETCDIR%%/include/ngx_http_lua_misc.h +%%ETCDIR%%/include/ngx_http_lua_ndk.h +%%ETCDIR%%/include/ngx_http_lua_output.h +%%ETCDIR%%/include/ngx_http_lua_pcrefix.h +%%ETCDIR%%/include/ngx_http_lua_phase.h +%%ETCDIR%%/include/ngx_http_lua_probe.h +%%ETCDIR%%/include/ngx_http_lua_regex.h +%%ETCDIR%%/include/ngx_http_lua_req_body.h +%%ETCDIR%%/include/ngx_http_lua_req_method.h +%%ETCDIR%%/include/ngx_http_lua_rewriteby.h +%%ETCDIR%%/include/ngx_http_lua_script.h +%%ETCDIR%%/include/ngx_http_lua_setby.h +%%ETCDIR%%/include/ngx_http_lua_shdict.h +%%ETCDIR%%/include/ngx_http_lua_sleep.h +%%ETCDIR%%/include/ngx_http_lua_socket_tcp.h +%%ETCDIR%%/include/ngx_http_lua_socket_udp.h +%%ETCDIR%%/include/ngx_http_lua_string.h +%%ETCDIR%%/include/ngx_http_lua_subrequest.h +%%ETCDIR%%/include/ngx_http_lua_time.h +%%ETCDIR%%/include/ngx_http_lua_uri.h +%%ETCDIR%%/include/ngx_http_lua_uthread.h +%%ETCDIR%%/include/ngx_http_lua_util.h +%%ETCDIR%%/include/ngx_http_lua_variable.h +%%ETCDIR%%/include/ngx_http_reqstat.h +%%ETCDIR%%/include/ngx_http_request.h +%%ETCDIR%%/include/ngx_http_script.h +%%ETCDIR%%/include/ngx_http_spdy.h +%%ETCDIR%%/include/ngx_http_spdy_module.h +%%ETCDIR%%/include/ngx_http_ssi_filter_module.h +%%ETCDIR%%/include/ngx_http_ssl_module.h +%%ETCDIR%%/include/ngx_http_upstream.h +%%ETCDIR%%/include/ngx_http_upstream_round_robin.h +%%ETCDIR%%/include/ngx_http_variables.h +%%ETCDIR%%/include/ngx_inet.h +%%ETCDIR%%/include/ngx_linux.h +%%ETCDIR%%/include/ngx_linux_config.h +%%ETCDIR%%/include/ngx_list.h +%%ETCDIR%%/include/ngx_log.h +%%ETCDIR%%/include/ngx_md5.h +%%ETCDIR%%/include/ngx_murmurhash.h +%%ETCDIR%%/include/ngx_open_file_cache.h +%%ETCDIR%%/include/ngx_os.h +%%ETCDIR%%/include/ngx_palloc.h +%%ETCDIR%%/include/ngx_parse.h +%%ETCDIR%%/include/ngx_pipe.h +%%ETCDIR%%/include/ngx_posix_config.h +%%ETCDIR%%/include/ngx_process.h +%%ETCDIR%%/include/ngx_process_cycle.h +%%ETCDIR%%/include/ngx_queue.h +%%ETCDIR%%/include/ngx_radix_tree.h +%%ETCDIR%%/include/ngx_rbtree.h +%%ETCDIR%%/include/ngx_regex.h +%%ETCDIR%%/include/ngx_resolver.h +%%ETCDIR%%/include/ngx_segment_tree.h +%%ETCDIR%%/include/ngx_setaffinity.h +%%ETCDIR%%/include/ngx_setproctitle.h +%%ETCDIR%%/include/ngx_sha1.h +%%ETCDIR%%/include/ngx_shmem.h +%%ETCDIR%%/include/ngx_shmtx.h +%%ETCDIR%%/include/ngx_slab.h +%%ETCDIR%%/include/ngx_socket.h +%%ETCDIR%%/include/ngx_solaris.h +%%ETCDIR%%/include/ngx_solaris_config.h +%%ETCDIR%%/include/ngx_string.h +%%ETCDIR%%/include/ngx_sunpro_atomic_sparc64.h +%%ETCDIR%%/include/ngx_sysinfo.h +%%ETCDIR%%/include/ngx_syslog.h +%%ETCDIR%%/include/ngx_thread.h +%%ETCDIR%%/include/ngx_time.h +%%ETCDIR%%/include/ngx_times.h +%%ETCDIR%%/include/ngx_trie.h +%%ETCDIR%%/include/ngx_user.h +%%ETCDIR%%/modules/ngx_http_access_module.so +%%ETCDIR%%/modules/ngx_http_addition_filter_module.so +%%ETCDIR%%/modules/ngx_http_autoindex_module.so +%%ETCDIR%%/modules/ngx_http_browser_module.so +%%ETCDIR%%/modules/ngx_http_charset_filter_module.so +%%ETCDIR%%/modules/ngx_http_concat_module.so +%%ETCDIR%%/modules/ngx_http_empty_gif_module.so +%%ETCDIR%%/modules/ngx_http_fastcgi_module.so +%%ETCDIR%%/modules/ngx_http_flv_module.so +%%ETCDIR%%/modules/ngx_http_footer_filter_module.so +%%ETCDIR%%/modules/ngx_http_geoip_module.so +%%ETCDIR%%/modules/ngx_http_image_filter_module.so +%%ETCDIR%%/modules/ngx_http_limit_conn_module.so +%%ETCDIR%%/modules/ngx_http_limit_req_module.so +%%ETCDIR%%/modules/ngx_http_lua_module.so +%%ETCDIR%%/modules/ngx_http_map_module.so +%%ETCDIR%%/modules/ngx_http_memcached_module.so +%%ETCDIR%%/modules/ngx_http_mp4_module.so +%%ETCDIR%%/modules/ngx_http_random_index_module.so +%%ETCDIR%%/modules/ngx_http_referer_module.so +%%ETCDIR%%/modules/ngx_http_scgi_module.so +%%ETCDIR%%/modules/ngx_http_secure_link_module.so +%%ETCDIR%%/modules/ngx_http_slice_module.so +%%ETCDIR%%/modules/ngx_http_split_clients_module.so +%%ETCDIR%%/modules/ngx_http_sub_filter_module.so +%%ETCDIR%%/modules/ngx_http_sysguard_module.so +%%ETCDIR%%/modules/ngx_http_trim_filter_module.so +%%ETCDIR%%/modules/ngx_http_upstream_ip_hash_module.so +%%ETCDIR%%/modules/ngx_http_upstream_least_conn_module.so +%%ETCDIR%%/modules/ngx_http_upstream_session_sticky_module.so +%%ETCDIR%%/modules/ngx_http_user_agent_module.so +%%ETCDIR%%/modules/ngx_http_userid_filter_module.so +%%ETCDIR%%/modules/ngx_http_uwsgi_module.so +%%ETCDIR%%/modules/ngx_http_xslt_filter_module.so +sbin/nginx +sbin/dso_tool +@unexec if [ -z ${UPGRADE_PORT} ] ; then rm -fr %%NGINX_TMPDIR%%; fi +man/man8/nginx.8.gz +@dirrmtry %%ETCDIR%%/modules +@dirrmtry %%ETCDIR%%/include +@dirrmtry %%NGINX_TMPDIR%% |