4
use Test::Nginx::Socket::Chunkin;
7
#warn 'repeat each: ', repeat_each, "\n";
9
plan tests => repeat_each() * 2 * blocks();
17
=== TEST 1: binary in data
24
Transfer-Encoding: chunked
28
".'%Q`3�BBT0123456789AF%Q_�k%Q_�kwtk-emulatorSunMicrosystems_wtk AX7`encoding=pcm encoding=pcm&rate=8000&bits=8&channels=1 encoding=pcm&rate=22050&bits=16&chanZach-Laptop-W1.01.0en-US1.01.11.11.0SunMicrosystems_wtMIDP-2.11.0.10H,1Haudio/x-wavtruetruetruetruenencoding=rgb565&width=160&height=120 encoding=rgb565&width=320&height=240 encoding=rgb565&width=120&height=160encoding=jpeg encoding=png+12345678900http://mmsc.127.0.0.01'."\r
32
--- response_body eval
33
'%Q`3�BBT0123456789AF%Q_�k%Q_�kwtk-emulatorSunMicrosystems_wtk AX7`encoding=pcm encoding=pcm&rate=8000&bits=8&channels=1 encoding=pcm&rate=22050&bits=16&chanZach-Laptop-W1.01.0en-US1.01.11.11.0SunMicrosystems_wtMIDP-2.11.0.10H,1Haudio/x-wavtruetruetruetruenencoding=rgb565&width=160&height=120 encoding=rgb565&width=320&height=240 encoding=rgb565&width=120&height=160encoding=jpeg encoding=png+12345678900http://mmsc.127.0.0.01'
37
=== TEST 2: CRLF in data (missing trailing CRLF)
44
Transfer-Encoding: chunked
52
--- response_body_like: 400 Bad Request
57
=== TEST 3: CRLF in data
64
Transfer-Encoding: chunked
73
--- response_body eval
78
=== TEST 4: leading CRLF in data
85
Transfer-Encoding: chunked
94
--- response_body eval
99
=== TEST 5: trailing CRLF in data
106
Transfer-Encoding: chunked
115
--- response_body eval
120
=== TEST 6: embedded CRLF in data
127
Transfer-Encoding: chunked
136
--- response_body eval
141
=== TEST 7: 413 in proxy
145
proxy_pass $scheme://127.0.0.1:$server_port/proxy;
151
Transfer-Encoding: chunked
159
--- response_body_like: 411 Length Required
164
=== TEST 8: padding spaces
171
Transfer-Encoding: chunked
180
--- response_body eval
185
=== TEST 9: padding spaces (using HT)
192
Transfer-Encoding: chunked
201
--- response_body eval
206
=== TEST 10: padding spaces (using \t and ' ' in last chunk)
213
Transfer-Encoding: chunked
222
--- response_body eval
227
=== TEST 11: padding LWS (using \t and ' ' with a leading CRLF in last chunk)
234
Transfer-Encoding: chunked
247
--- response_body_like: 400 Bad Request
252
=== TEST 12: leading CRLF
259
Transfer-Encoding: chunked
269
--- response_body_like: 400 Bad Request
274
=== TEST 13: zero-padding
281
Transfer-Encoding: chunked
290
--- response_body eval
295
=== TEST 14: leading new lines
302
Transfer-Encoding: chunked
312
--- response_body_like: 400 Bad Request
317
=== TEST 15: internal guard
325
Transfer-Encoding: chunked
335
--- response_body_like: 404 Not Found
340
=== TEST 16: phase issue
348
Transfer-Encoding: chunked
356
--- response_body_like: 403 Forbidden
361
=== TEST 17: contenth-length AND chunked
368
Transfer-Encoding: chunked
370
"POST /aar.do HTTP/1.1\r
371
Host: data.test.com\r
372
Content-Type:application/octet-stream\r
373
transfer-encoding:chunked\r
374
User-Agent: SEC-SGHD840/1.0 NetFront/3.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 UNTRUSTED/1.0\r
375
Content-Length: 6263\r
376
Via: ZXWAP GateWay,ZTE Technologies\r
377
x-up-calling-line-id: 841223657459\r
385
--- response_body: hello
390
=== TEST 18: Content-length AND chunked
397
["POST /aar.do HTTP/1.1\r
398
Host: data.test.com\r
399
Content-Type:application/octet-stream\r
400
transfer-encoding:chunked\r
401
User-Agent: SEC-SGHD840/1.0 NetFront/3.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 UNTRUSTED/1.0\r
402
Content-Length: 6263\r
403
Via: ZXWAP GateWay,ZTE Technologies\r
404
x-up-calling-line-id: 841223657459\r
412
--- raw_request_middle_delay: 0.001
413
--- response_body: hello
418
=== TEST 19: Content-length AND chunked (ready for the read_discard_request_body to work)
425
["POST /aar.do HTTP/1.1\r
426
Host: data.test.com\r
427
Content-Type:application/octet-stream\r
428
transfer-encoding:chunked\r
429
User-Agent: SEC-SGHD840/1.0 NetFront/3.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 UNTRUSTED/1.0\r
430
Content-Length: 6263\r
431
Via: ZXWAP GateWay,ZTE Technologies\r
432
x-up-calling-line-id: 841223657459\r
440
--- raw_request_middle_delay: 0
441
--- response_body: hello
446
=== TEST 20: packets in a single buf
450
client_body_buffer_size 1m;
454
["POST /aar.do HTTP/1.1\r
455
Content-Type: application/octet-stream\r
457
Host: data.test.com\r
458
Transfer-Encoding: chunked\r
459
User-Agent: SonyEricssonW395/R1BA010 Profile/MIDP-2.1 Configuration/CLDC-1.1 UNTRUSTED/1.0\r
468
--- raw_request_middle_delay: 0.002
469
--- response_body: hello
475
=== TEST 21: packets in a single buf
479
client_body_buffer_size 1m;
483
["POST /aar.do HTTP/1.1\r
484
Content-Type: application/octet-stream\r
486
Host: data.test.com\r
487
Transfer-Encoding: chunked\r
488
User-Agent: SonyEricssonW395/R1BA010 Profile/MIDP-2.1 Configuration/CLDC-1.1 UNTRUSTED/1.0\r
497
--- raw_request_middle_delay: 0.002
498
--- response_body eval
504
=== TEST 22: packets in a single buf
508
client_body_buffer_size 1m;
512
["POST /aar.do HTTP/1.1\r
513
Content-Type: application/octet-stream\r
515
Host: data.test.com\r
516
Transfer-Encoding: chunked\r
517
User-Agent: SonyEricssonW395/R1BA010 Profile/MIDP-2.1 Configuration/CLDC-1.1 UNTRUSTED/1.0\r
526
--- raw_request_middle_delay: 0.002
527
--- response_body eval
534
=== TEST 23: not exceeding max body limit (chunk spanning preread and rb->buf)
538
client_body_buffer_size 10m;
539
client_max_body_size 10m;
540
chunkin_max_chunks_per_buf 2048;
542
echo_read_request_body;
548
#Transfer-Encoding: chunked
551
".("a" x (1 * 1024 * 1024))
552
--- response_body eval
553
"a" x (1 * 1024 * 1024)
559
=== TEST 24: binary in data
563
echo $request_method;
567
Transfer-Encoding: chunked
575
--- response_body chop