File tree Expand file tree Collapse file tree 4 files changed +84
-2
lines changed Expand file tree Collapse file tree 4 files changed +84
-2
lines changed Original file line number Diff line number Diff line change 1+ language : c
2+ compiler :
3+ - clang
4+ - gcc
5+ env :
6+ matrix :
7+ - NGINX_VERSION=1.16.0
8+ - NGINX_VERSION=1.17.2 -
9+ addons :
10+ apt :
11+ packages :
12+ - libpcre3-dev
13+ - libssl-dev
14+ - perl
15+ - cpanminus
16+ cache :
17+ ccache : true
18+ directories :
19+ - $HOME/perl5
20+ before_install :
21+ - test $TRAVIS_BRANCH != coverity_scan -o ${TRAVIS_JOB_NUMBER##*.} = 1 || exit 0
22+ - cpanm --notest --local-lib=$HOME/perl5 Test::Nginx
23+ install :
24+ - test $TRAVIS_BRANCH != coverity_scan || exit 0
25+ - wget -O - http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -xzf -
26+ - cd nginx-${NGINX_VERSION}
27+ - ./configure --with-debug --add-module=..
28+ - make -j2
29+ - export PATH=$(pwd)/objs:$PATH
30+ - cd ..
31+ script :
32+ - test $TRAVIS_BRANCH != coverity_scan || exit 0
33+ - PERL5LIB=$HOME/perl5/lib/perl5 TEST_NGINX_VERBOSE=true prove -v
34+ after_failure :
35+ - cat t/servroot/conf/nginx.conf
36+ - cat t/servroot/access.log
37+ - cat t/servroot/error.log
Original file line number Diff line number Diff line change 11ngx_addon_name=ngx_http_security_headers_module
22
33if test -n "$ngx_module_link"; then
4- ngx_module_type=HTTP_FILTER
4+ ngx_module_type=HTTP_AUX_FILTER
55 ngx_module_name=ngx_http_security_headers_module
66 ngx_module_srcs="$ngx_addon_dir/src/ngx_http_security_headers_module.c"
77
88 . auto/module
99else
10- HTTP_MODULES ="$HTTP_MODULES ngx_http_security_headers_module"
10+ HTTP_AUX_FILTER_MODULES ="$HTTP_AUX_FILTER_MODULES ngx_http_security_headers_module"
1111 NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_security_headers_module.c"
1212fi
Original file line number Diff line number Diff line change 1+ use Test::Nginx::Socket ' no_plan' ;
2+
3+ run_tests();
4+
5+ __DATA__
6+
7+ === TEST 1: dying on bad config
8+ --- http_config
9+ security_headers bad;
10+ --- config
11+ --- must_die
12+ --- error_log
13+ invalid value "bad" in "security_headers" directive, it must be "on" or "off"
Original file line number Diff line number Diff line change 1+ use Test::Nginx::Socket ' no_plan' ;
2+
3+ run_tests();
4+
5+ __DATA__
6+
7+ === TEST 1: server is hidden
8+ --- config
9+ security_headers on;
10+ location = /hello {
11+ return 200 "hello world\n";
12+ }
13+ --- request
14+ GET /hello
15+ --- response_body
16+ hello world
17+ --- response_headers
18+ !Server
19+
20+
21+ === TEST 2: x-xss-protection added
22+ --- config
23+ security_headers on;
24+ location = /hello {
25+ return 200 "hello world\n";
26+ }
27+ --- request
28+ GET /hello
29+ --- response_body
30+ hello world
31+ --- response_headers
32+ X-XSS-Protection: 1; mode=block
You can’t perform that action at this time.
0 commit comments