~ubuntu-branches/ubuntu/utopic/nginx/utopic

« back to all changes in this revision

Viewing changes to debian/modules/headers-more-nginx-module/t/input-cookie.t

  • Committer: Package Import Robot
  • Author(s): Robie Basak
  • Date: 2014-08-15 16:46:48 UTC
  • mfrom: (4.3.16 sid)
  • Revision ID: package-import@ubuntu.com-20140815164648-a5f0kta1qhtpw161
Tags: 1.6.1-1ubuntu1
* Merge from Debian. Remaining changes:
  - debian/patches/ubuntu-branding.patch: add Ubuntu branding
    (refreshed).
  - debian/rules: Drop from -O3 to -O2 to work around a build failure.
  - d/{control,rules,nginx-core.*}: add new binary package for main,
    nginx-core, which contains only source-tarball-included modules
    and no third-party modules.
* Add dep8 smoke test

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim:set ft= ts=4 sw=4 et fdm=marker:
 
2
 
 
3
use lib 'lib';
 
4
use Test::Nginx::Socket;
 
5
 
 
6
#worker_connections(1014);
 
7
#master_process_enabled(1);
 
8
#log_level('warn');
 
9
 
 
10
repeat_each(2);
 
11
 
 
12
plan tests => repeat_each() * (4 * blocks());
 
13
 
 
14
#no_diff();
 
15
no_long_string();
 
16
 
 
17
run_tests();
 
18
 
 
19
__DATA__
 
20
 
 
21
=== TEST 1: clear cookie (with existing cookies)
 
22
--- config
 
23
    location /t {
 
24
        more_clear_input_headers Cookie;
 
25
        echo "Cookie foo: $cookie_foo";
 
26
        echo "Cookie baz: $cookie_baz";
 
27
        echo "Cookie: $http_cookie";
 
28
    }
 
29
--- request
 
30
GET /t
 
31
--- more_headers
 
32
Cookie: foo=bar
 
33
Cookie: baz=blah
 
34
 
 
35
--- stap
 
36
F(ngx_http_headers_more_exec_input_cmd) {
 
37
    printf("rewrite: cookies: %d\n", $r->headers_in->cookies->nelts)
 
38
}
 
39
 
 
40
F(ngx_http_core_content_phase) {
 
41
    printf("content: cookies: %d\n", $r->headers_in->cookies->nelts)
 
42
}
 
43
 
 
44
--- stap_out
 
45
rewrite: cookies: 2
 
46
content: cookies: 0
 
47
 
 
48
--- response_body
 
49
Cookie foo: 
 
50
Cookie baz: 
 
51
Cookie: 
 
52
 
 
53
--- no_error_log
 
54
[error]
 
55
 
 
56
 
 
57
 
 
58
=== TEST 2: clear cookie (without existing cookies)
 
59
--- config
 
60
    location /t {
 
61
        more_clear_input_headers Cookie;
 
62
        echo "Cookie foo: $cookie_foo";
 
63
        echo "Cookie baz: $cookie_baz";
 
64
        echo "Cookie: $http_cookie";
 
65
    }
 
66
--- request
 
67
GET /t
 
68
 
 
69
--- stap
 
70
F(ngx_http_headers_more_exec_input_cmd) {
 
71
    printf("rewrite: cookies: %d\n", $r->headers_in->cookies->nelts)
 
72
}
 
73
 
 
74
F(ngx_http_core_content_phase) {
 
75
    printf("content: cookies: %d\n", $r->headers_in->cookies->nelts)
 
76
}
 
77
 
 
78
--- stap_out
 
79
rewrite: cookies: 0
 
80
content: cookies: 0
 
81
 
 
82
--- response_body
 
83
Cookie foo: 
 
84
Cookie baz: 
 
85
Cookie: 
 
86
 
 
87
--- no_error_log
 
88
[error]
 
89
 
 
90
 
 
91
 
 
92
=== TEST 3: set one custom cookie (with existing cookies)
 
93
--- config
 
94
    location /t {
 
95
        more_set_input_headers "Cookie: boo=123";
 
96
        echo "Cookie foo: $cookie_foo";
 
97
        echo "Cookie baz: $cookie_baz";
 
98
        echo "Cookie boo: $cookie_boo";
 
99
        echo "Cookie: $http_cookie";
 
100
    }
 
101
--- request
 
102
GET /t
 
103
--- more_headers
 
104
Cookie: foo=bar
 
105
Cookie: baz=blah
 
106
 
 
107
--- stap
 
108
F(ngx_http_headers_more_exec_input_cmd) {
 
109
    printf("rewrite: cookies: %d\n", $r->headers_in->cookies->nelts)
 
110
}
 
111
 
 
112
F(ngx_http_core_content_phase) {
 
113
    printf("content: cookies: %d\n", $r->headers_in->cookies->nelts)
 
114
}
 
115
 
 
116
--- stap_out
 
117
rewrite: cookies: 2
 
118
content: cookies: 1
 
119
 
 
120
--- response_body
 
121
Cookie foo: 
 
122
Cookie baz: 
 
123
Cookie boo: 123
 
124
Cookie: boo=123
 
125
 
 
126
--- no_error_log
 
127
[error]
 
128
 
 
129
 
 
130
 
 
131
=== TEST 4: set one custom cookie (without existing cookies)
 
132
--- config
 
133
    location /t {
 
134
        more_set_input_headers "Cookie: boo=123";
 
135
        echo "Cookie foo: $cookie_foo";
 
136
        echo "Cookie baz: $cookie_baz";
 
137
        echo "Cookie boo: $cookie_boo";
 
138
        echo "Cookie: $http_cookie";
 
139
    }
 
140
--- request
 
141
GET /t
 
142
 
 
143
--- stap
 
144
F(ngx_http_headers_more_exec_input_cmd) {
 
145
    printf("rewrite: cookies: %d\n", $r->headers_in->cookies->nelts)
 
146
}
 
147
 
 
148
F(ngx_http_core_content_phase) {
 
149
    printf("content: cookies: %d\n", $r->headers_in->cookies->nelts)
 
150
}
 
151
 
 
152
--- stap_out
 
153
rewrite: cookies: 0
 
154
content: cookies: 1
 
155
 
 
156
--- response_body
 
157
Cookie foo: 
 
158
Cookie baz: 
 
159
Cookie boo: 123
 
160
Cookie: boo=123
 
161
 
 
162
--- no_error_log
 
163
[error]
 
164