~ubuntu-branches/ubuntu/quantal/nginx/quantal-updates

« back to all changes in this revision

Viewing changes to debian/modules/chunkin-nginx-module/t/pressure.t

  • Committer: Package Import Robot
  • Author(s): Dmitry E. Oboukhov
  • Date: 2011-11-24 14:16:50 UTC
  • mfrom: (4.2.40 sid)
  • Revision ID: package-import@ubuntu.com-20111124141650-4n06eynzekxycf6c
Tags: 1.1.8-2
* debian/modules/chunkin-nginx-module:
  + Reinclude HttpChunkin Module with new upstream version (closes: #638814)
* debian/control:
  + Add myself to uploaders list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vi:filetype=
 
2
 
 
3
use lib 't/lib';
 
4
use Test::Nginx::LWP::Chunkin;
 
5
 
 
6
plan tests => repeat_each() * 2 * blocks();
 
7
 
 
8
#no_diff;
 
9
 
 
10
run_tests();
 
11
 
 
12
__DATA__
 
13
 
 
14
=== TEST 1: many little chunks
 
15
--- config
 
16
    chunkin on;
 
17
    location /main {
 
18
        client_body_buffer_size    4;
 
19
        echo_request_body;
 
20
    }
 
21
--- request
 
22
POST /main
 
23
--- chunked_body eval
 
24
[split //,
 
25
  "hello world blah blah blah! oh, yay! end"]
 
26
--- response_body eval
 
27
"hello world blah blah blah! oh, yay! end"
 
28
 
 
29
 
 
30
 
 
31
=== TEST 2: many little chunks (more!)
 
32
--- config
 
33
    chunkin on;
 
34
    location /main {
 
35
        client_body_buffer_size    1k;
 
36
        #echo_sleep 500;
 
37
        echo_request_body;
 
38
    }
 
39
--- request
 
40
POST /main
 
41
--- chunked_body eval
 
42
[split //,
 
43
  ("hello world blah blah blah! o, yah!" x 4) . 'end']
 
44
--- response_body eval
 
45
("hello world blah blah blah! o, yah!" x 4) . 'end'
 
46
 
 
47
 
 
48
 
 
49
=== TEST 3: many little chunks (more!)
 
50
--- config
 
51
    chunkin on;
 
52
    location /main {
 
53
        client_body_buffer_size    60;
 
54
        #echo_sleep 500;
 
55
        echo_request_body;
 
56
    }
 
57
--- request
 
58
POST /main
 
59
--- chunked_body eval
 
60
[split //,
 
61
  ("hello world blah blah blah! oh, yah!" x 100) . 'end']
 
62
--- response_body eval
 
63
("hello world blah blah blah! oh, yah!" x 100) . 'end'
 
64
 
 
65
 
 
66
 
 
67
=== TEST 4: exceeding max body limit (this test may fail randomly with the error "500 write failed: Connection reset by peer", which is considered OK).
 
68
--- config
 
69
    chunkin on;
 
70
    location /main {
 
71
        client_body_buffer_size    512;
 
72
        client_max_body_size       1024;
 
73
 
 
74
        echo_request_body;
 
75
    }
 
76
--- request
 
77
POST /main
 
78
--- chunked_body eval
 
79
[split //,
 
80
  ("a" x 1024) . 'e']
 
81
--- response_body_like: 413 Request Entity Too Large
 
82
--- error_code: 413
 
83
 
 
84
 
 
85
 
 
86
=== TEST 5: not exceeding max body limit (chunk spanning preread and rb->buf)
 
87
--- config
 
88
    chunkin on;
 
89
    location /main {
 
90
        client_body_buffer_size    512;
 
91
        client_max_body_size       1048;
 
92
 
 
93
        echo_request_body;
 
94
    }
 
95
--- request
 
96
POST /main
 
97
--- chunked_body eval
 
98
["a" x 1024]
 
99
--- response_body eval
 
100
"a" x 1024
 
101
 
 
102
 
 
103
 
 
104
=== TEST 6: next chunk reset bug
 
105
--- config
 
106
    chunkin on;
 
107
    location /main {
 
108
        client_body_buffer_size    600;
 
109
        client_max_body_size       8k;
 
110
 
 
111
        echo_request_body;
 
112
    }
 
113
--- request
 
114
POST /main
 
115
--- middle_chunk_delay: 0.001
 
116
--- chunked_body eval
 
117
[split //,
 
118
  ("a" x 700) . 'e']
 
119
--- response_body eval
 
120
"a" x 700 . 'e'
 
121
 
 
122
 
 
123
 
 
124
=== TEST 7: next chunk reset bug (too many chunks)
 
125
--- config
 
126
    chunkin on;
 
127
    location /main {
 
128
        client_body_buffer_size    8k;
 
129
        client_max_body_size       8k;
 
130
 
 
131
        echo_request_body;
 
132
    }
 
133
--- request
 
134
POST /main
 
135
--- chunked_body eval
 
136
[split //,
 
137
  ("a" x 700) . 'e']
 
138
--- response_body eval
 
139
"a" x 700 . 'e'
 
140
 
 
141
 
 
142
 
 
143
=== TEST 8: normal POST with chunkin on
 
144
--- config
 
145
    chunkin on;
 
146
    location /main {
 
147
        client_body_buffer_size    600;
 
148
        client_max_body_size       8k;
 
149
 
 
150
        echo_read_request_body;
 
151
        echo_request_body;
 
152
    }
 
153
--- request
 
154
POST /main
 
155
hello, world
 
156
--- response_body chomp
 
157
hello, world
 
158
 
 
159
 
 
160
 
 
161
=== TEST 9: not exceeding max body limit (chunk spanning preread and rb->buf)
 
162
--- config
 
163
    chunkin on;
 
164
    location /main {
 
165
        client_body_buffer_size    10m;
 
166
        client_max_body_size       10m;
 
167
 
 
168
        echo_request_body;
 
169
        echo;
 
170
    }
 
171
--- request
 
172
POST /main
 
173
--- chunked_body eval
 
174
[split //, "a" x (500 * 1024)]
 
175
--- middle_chunk_delay: 0
 
176
--- response_body eval
 
177
"a" x (500 * 1024)
 
178
--- quit
 
179
--- SKIP
 
180