~ubuntu-branches/ubuntu/raring/nginx/raring-security

« back to all changes in this revision

Viewing changes to debian/modules/nginx-lua/t/024-access/client-abort.t

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry, Kartik Mistry, Cyril Lavier, Michael Lustfield
  • Date: 2012-12-18 10:29:18 UTC
  • mfrom: (4.2.56 sid)
  • Revision ID: package-import@ubuntu.com-20121218102918-dxtwj9vj89sbj8dz
Tags: 1.2.6-1
[ Kartik Mistry ]
* New upstream release.
* debian/nginx-common.nginx.init:
  + Used log_*_msg instead of echo for better init messages.
  + Added patch to check start-stop-daemon exit status, Thanks to
    Sergey B Kirpichev <skirpichev@gmail.com> (Closes: #695374).
* debian/po/ja.po:
  + Added new Japanese translation. Thanks to victory <victory.deb@gmail.com>
    (Closes: #692481).
* debian/po/pt_BR.po:
  + Added new Brazilian Portuguese translation. Thanks to
    Adriano Rafael Gomes <adrianorg@gmail.com> (Closes: #692481).

[ Cyril Lavier ]
* debian/rules
  + Added RealIP module in nginx-naxsi (Closes: #693302).
* debian/modules/nginx-cache-purge/
  + Updated nginx-cache-purge module with the 2.0 version.
* debian/modules/nginx-lua/
  + Updated nginx-lua module with the 0.7.8 version.
* debian/modules/nginx-echo/
  + Updated the nginx-echo module with the 0.41 version.
* debian/modules/headers-more-nginx-module/
  + Updated the Headers-more module with the 0.19 version.
* debian/modules/README.Modules-versions
  + Updated the current version of modules following the updates.

[ Michael Lustfield ]
* debian/conf/sites-available/default
  + Uncommented listen lines to make server block default.

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
use t::StapThread;
 
6
 
 
7
our $GCScript = <<_EOC_;
 
8
$t::StapThread::GCScript
 
9
 
 
10
F(ngx_http_lua_check_broken_connection) {
 
11
    println("lua check broken conn")
 
12
}
 
13
 
 
14
F(ngx_http_lua_request_cleanup) {
 
15
    println("lua req cleanup")
 
16
}
 
17
_EOC_
 
18
 
 
19
our $StapScript = $t::StapThread::StapScript;
 
20
 
 
21
repeat_each(2);
 
22
 
 
23
plan tests => repeat_each() * (blocks() * 3 - 1);
 
24
 
 
25
$ENV{TEST_NGINX_RESOLVER} ||= '8.8.8.8';
 
26
$ENV{TEST_NGINX_MEMCACHED_PORT} ||= '11211';
 
27
$ENV{TEST_NGINX_REDIS_PORT} ||= '6379';
 
28
 
 
29
#no_shuffle();
 
30
no_long_string();
 
31
run_tests();
 
32
 
 
33
__DATA__
 
34
 
 
35
=== TEST 1: sleep + stop
 
36
--- config
 
37
    location /t {
 
38
        lua_check_client_abort on;
 
39
        access_by_lua '
 
40
            ngx.sleep(1)
 
41
        ';
 
42
    }
 
43
--- request
 
44
GET /t
 
45
 
 
46
--- stap2 eval: $::StapScript
 
47
--- stap eval: $::GCScript
 
48
--- stap_out
 
49
lua check broken conn
 
50
lua req cleanup
 
51
delete thread 1
 
52
 
 
53
--- wait: 0.1
 
54
--- timeout: 0.2
 
55
--- abort
 
56
--- ignore_response
 
57
--- no_error_log
 
58
[error]
 
59
--- error_log
 
60
client prematurely closed connection
 
61
 
 
62
 
 
63
 
 
64
=== TEST 2: sleep + stop (log handler still gets called)
 
65
--- config
 
66
    location /t {
 
67
        lua_check_client_abort on;
 
68
        access_by_lua '
 
69
            ngx.sleep(1)
 
70
        ';
 
71
        log_by_lua '
 
72
            ngx.log(ngx.NOTICE, "here in log by lua")
 
73
        ';
 
74
    }
 
75
--- request
 
76
GET /t
 
77
 
 
78
--- stap2 eval: $::StapScript
 
79
--- stap eval: $::GCScript
 
80
--- stap_out
 
81
lua check broken conn
 
82
lua req cleanup
 
83
delete thread 1
 
84
 
 
85
--- timeout: 0.2
 
86
--- abort
 
87
--- ignore_response
 
88
--- no_error_log
 
89
[error]
 
90
--- error_log
 
91
client prematurely closed connection
 
92
here in log by lua
 
93
 
 
94
 
 
95
 
 
96
=== TEST 3: sleep + ignore
 
97
--- config
 
98
    location /t {
 
99
        lua_check_client_abort off;
 
100
        access_by_lua '
 
101
            ngx.sleep(1)
 
102
        ';
 
103
        content_by_lua return;
 
104
    }
 
105
--- request
 
106
GET /t
 
107
 
 
108
--- stap2 eval: $::StapScript
 
109
--- stap eval: $::GCScript
 
110
--- stap_out
 
111
terminate 1: ok
 
112
delete thread 1
 
113
terminate 2: ok
 
114
delete thread 2
 
115
lua req cleanup
 
116
 
 
117
--- wait: 1
 
118
--- timeout: 0.2
 
119
--- abort
 
120
--- ignore_response
 
121
--- no_error_log
 
122
[error]
 
123
 
 
124
 
 
125
 
 
126
=== TEST 4: subrequest + stop
 
127
--- config
 
128
    location /t {
 
129
        lua_check_client_abort on;
 
130
        access_by_lua '
 
131
            ngx.location.capture("/sub")
 
132
            error("bad things happen")
 
133
        ';
 
134
    }
 
135
 
 
136
    location /sub {
 
137
        echo_sleep 1;
 
138
    }
 
139
--- request
 
140
GET /t
 
141
 
 
142
--- stap2 eval: $::StapScript
 
143
--- stap eval: $::GCScript
 
144
--- stap_out
 
145
lua check broken conn
 
146
lua req cleanup
 
147
delete thread 1
 
148
 
 
149
--- timeout: 0.2
 
150
--- abort
 
151
--- ignore_response
 
152
--- no_error_log
 
153
[error]
 
154
--- error_log
 
155
client prematurely closed connection
 
156
 
 
157
 
 
158
 
 
159
=== TEST 5: subrequest + ignore
 
160
--- config
 
161
    location /t {
 
162
        lua_check_client_abort off;
 
163
        access_by_lua '
 
164
            ngx.location.capture("/sub")
 
165
            error("bad things happen")
 
166
        ';
 
167
    }
 
168
 
 
169
    location /sub {
 
170
        echo_sleep 1;
 
171
    }
 
172
--- request
 
173
GET /t
 
174
 
 
175
--- stap2 eval: $::StapScript
 
176
--- stap eval: $::GCScript
 
177
--- stap_out
 
178
terminate 1: fail
 
179
lua req cleanup
 
180
delete thread 1
 
181
 
 
182
--- wait: 1.1
 
183
--- timeout: 0.2
 
184
--- abort
 
185
--- ignore_response
 
186
--- error_log
 
187
bad things happen
 
188
 
 
189
 
 
190
 
 
191
=== TEST 6: subrequest + stop (proxy, ignore client abort)
 
192
--- config
 
193
    location = /t {
 
194
        lua_check_client_abort on;
 
195
        access_by_lua '
 
196
            ngx.location.capture("/sub")
 
197
            error("bad things happen")
 
198
        ';
 
199
    }
 
200
 
 
201
    location = /sub {
 
202
        proxy_ignore_client_abort on;
 
203
        proxy_pass http://www.google.com:1234/;
 
204
    }
 
205
 
 
206
    location = /sleep {
 
207
        lua_check_client_abort on;
 
208
        access_by_lua '
 
209
            ngx.sleep(1)
 
210
        ';
 
211
    }
 
212
--- request
 
213
GET /t
 
214
 
 
215
--- stap2 eval: $::StapScript
 
216
--- stap eval: $::GCScript
 
217
--- stap_out
 
218
lua check broken conn
 
219
lua req cleanup
 
220
delete thread 1
 
221
 
 
222
--- timeout: 0.2
 
223
--- abort
 
224
--- ignore_response
 
225
--- no_error_log
 
226
[error]
 
227
--- error_log
 
228
client prematurely closed connection
 
229
 
 
230
 
 
231
 
 
232
=== TEST 7: subrequest + stop (proxy, check client abort)
 
233
--- config
 
234
    location = /t {
 
235
        lua_check_client_abort on;
 
236
        access_by_lua '
 
237
            ngx.location.capture("/sub")
 
238
            error("bad things happen")
 
239
        ';
 
240
    }
 
241
 
 
242
    location = /sub {
 
243
        proxy_ignore_client_abort off;
 
244
        proxy_pass http://www.google.com:1234/;
 
245
    }
 
246
--- request
 
247
GET /t
 
248
 
 
249
--- stap2 eval: $::StapScript
 
250
--- stap eval: $::GCScript
 
251
--- stap_out
 
252
lua check broken conn
 
253
lua req cleanup
 
254
delete thread 1
 
255
 
 
256
--- timeout: 0.2
 
257
--- abort
 
258
--- ignore_response
 
259
--- no_error_log
 
260
[error]
 
261
--- error_log
 
262
client prematurely closed connection
 
263
 
 
264
 
 
265
 
 
266
=== TEST 8: need body on + sleep + stop (log handler still gets called)
 
267
--- config
 
268
    location /t {
 
269
        lua_check_client_abort on;
 
270
        lua_need_request_body on;
 
271
        access_by_lua '
 
272
            ngx.sleep(1)
 
273
        ';
 
274
        log_by_lua '
 
275
            ngx.log(ngx.NOTICE, "here in log by lua")
 
276
        ';
 
277
    }
 
278
--- request
 
279
POST /t
 
280
hello
 
281
 
 
282
--- stap2 eval: $::StapScript
 
283
--- stap eval: $::GCScript
 
284
--- stap_out
 
285
lua check broken conn
 
286
lua req cleanup
 
287
delete thread 1
 
288
 
 
289
--- timeout: 0.2
 
290
--- abort
 
291
--- ignore_response
 
292
--- no_error_log
 
293
[error]
 
294
--- error_log
 
295
client prematurely closed connection
 
296
here in log by lua
 
297
 
 
298
 
 
299
 
 
300
=== TEST 9: ngx.req.read_body + sleep + stop (log handler still gets called)
 
301
--- config
 
302
    location /t {
 
303
        lua_check_client_abort on;
 
304
        access_by_lua '
 
305
            ngx.req.read_body()
 
306
            ngx.sleep(1)
 
307
        ';
 
308
        log_by_lua '
 
309
            ngx.log(ngx.NOTICE, "here in log by lua")
 
310
        ';
 
311
    }
 
312
--- request
 
313
POST /t
 
314
hello
 
315
 
 
316
--- stap2 eval: $::StapScript
 
317
--- stap eval: $::GCScript
 
318
--- stap_out
 
319
lua check broken conn
 
320
lua req cleanup
 
321
delete thread 1
 
322
 
 
323
--- timeout: 0.2
 
324
--- abort
 
325
--- ignore_response
 
326
--- no_error_log
 
327
[error]
 
328
--- error_log
 
329
client prematurely closed connection
 
330
here in log by lua
 
331
 
 
332
 
 
333
 
 
334
=== TEST 10: ngx.req.socket + receive() + sleep + stop
 
335
--- config
 
336
    location /t {
 
337
        lua_check_client_abort on;
 
338
        access_by_lua '
 
339
            local sock = ngx.req.socket()
 
340
            sock:receive()
 
341
            ngx.sleep(1)
 
342
        ';
 
343
    }
 
344
--- request
 
345
POST /t
 
346
hello
 
347
 
 
348
--- stap2 eval: $::StapScript
 
349
--- stap eval: $::GCScript
 
350
--- stap_out
 
351
lua check broken conn
 
352
lua req cleanup
 
353
delete thread 1
 
354
 
 
355
--- timeout: 0.2
 
356
--- abort
 
357
--- ignore_response
 
358
--- no_error_log
 
359
[error]
 
360
--- error_log
 
361
client prematurely closed connection
 
362
 
 
363
 
 
364
 
 
365
=== TEST 11: ngx.req.socket + receive(N) + sleep + stop
 
366
--- config
 
367
    location /t {
 
368
        lua_check_client_abort on;
 
369
        access_by_lua '
 
370
            local sock = ngx.req.socket()
 
371
            sock:receive(5)
 
372
            ngx.sleep(1)
 
373
        ';
 
374
    }
 
375
--- request
 
376
POST /t
 
377
hello
 
378
 
 
379
--- stap2 eval: $::StapScript
 
380
--- stap eval: $::GCScript
 
381
--- stap_out
 
382
lua check broken conn
 
383
lua check broken conn
 
384
lua req cleanup
 
385
delete thread 1
 
386
 
 
387
--- timeout: 0.2
 
388
--- abort
 
389
--- ignore_response
 
390
--- no_error_log
 
391
[error]
 
392
--- error_log
 
393
client prematurely closed connection
 
394
 
 
395
 
 
396
 
 
397
=== TEST 12: ngx.req.socket + receive(n) + sleep + stop
 
398
--- config
 
399
    location /t {
 
400
        lua_check_client_abort on;
 
401
        access_by_lua '
 
402
            local sock = ngx.req.socket()
 
403
            sock:receive(2)
 
404
            ngx.sleep(1)
 
405
        ';
 
406
        content_by_lua return;
 
407
    }
 
408
--- request
 
409
POST /t
 
410
hello
 
411
 
 
412
--- stap2 eval: $::StapScript
 
413
--- stap eval: $::GCScript
 
414
--- stap_out_like
 
415
^(?:lua check broken conn
 
416
terminate 1: ok
 
417
delete thread 1
 
418
terminate 2: ok
 
419
delete thread 2
 
420
lua req cleanup|lua check broken conn
 
421
lua req cleanup
 
422
delete thread 1)$
 
423
 
 
424
--- wait: 1
 
425
--- timeout: 0.2
 
426
--- abort
 
427
--- ignore_response
 
428
--- no_error_log
 
429
[error]
 
430
 
 
431
 
 
432
 
 
433
=== TEST 13: ngx.req.socket + m * receive(n) + sleep + stop
 
434
--- config
 
435
    location /t {
 
436
        lua_check_client_abort on;
 
437
        access_by_lua '
 
438
            local sock = ngx.req.socket()
 
439
            sock:receive(2)
 
440
            sock:receive(2)
 
441
            sock:receive(1)
 
442
            ngx.sleep(1)
 
443
        ';
 
444
    }
 
445
--- request
 
446
POST /t
 
447
hello
 
448
 
 
449
--- stap2 eval: $::StapScript
 
450
--- stap eval: $::GCScript
 
451
--- stap_out
 
452
lua check broken conn
 
453
lua check broken conn
 
454
lua req cleanup
 
455
delete thread 1
 
456
 
 
457
--- wait: 1
 
458
--- timeout: 0.2
 
459
--- abort
 
460
--- ignore_response
 
461
--- no_error_log
 
462
[error]
 
463
--- error_log
 
464
client prematurely closed connection
 
465
 
 
466
 
 
467
 
 
468
=== TEST 14: ngx.req.socket + receiveuntil + sleep + stop
 
469
--- config
 
470
    location /t {
 
471
        lua_check_client_abort on;
 
472
        access_by_lua '
 
473
            local sock = ngx.req.socket()
 
474
            local it = sock:receiveuntil("\\n")
 
475
            it()
 
476
            ngx.sleep(1)
 
477
        ';
 
478
    }
 
479
--- request
 
480
POST /t
 
481
hello
 
482
 
 
483
--- stap2 eval: $::StapScript
 
484
--- stap eval: $::GCScript
 
485
--- stap_out
 
486
lua check broken conn
 
487
lua req cleanup
 
488
delete thread 1
 
489
 
 
490
--- wait: 1
 
491
--- timeout: 0.2
 
492
--- abort
 
493
--- ignore_response
 
494
--- no_error_log
 
495
[error]
 
496
--- error_log
 
497
client prematurely closed connection
 
498
 
 
499
 
 
500
 
 
501
=== TEST 15: ngx.req.socket + receiveuntil + it(n) + sleep + stop
 
502
--- config
 
503
    location /t {
 
504
        lua_check_client_abort on;
 
505
        access_by_lua '
 
506
            local sock = ngx.req.socket()
 
507
            local it = sock:receiveuntil("\\n")
 
508
            it(2)
 
509
            it(3)
 
510
            ngx.sleep(1)
 
511
        ';
 
512
    }
 
513
--- request
 
514
POST /t
 
515
hello
 
516
 
 
517
--- stap2 eval: $::StapScript
 
518
--- stap eval: $::GCScript
 
519
--- stap_out
 
520
lua check broken conn
 
521
lua check broken conn
 
522
lua req cleanup
 
523
delete thread 1
 
524
 
 
525
--- timeout: 0.2
 
526
--- abort
 
527
--- ignore_response
 
528
--- no_error_log
 
529
[error]
 
530
--- error_log
 
531
client prematurely closed connection
 
532
 
 
533
 
 
534
 
 
535
=== TEST 16: cosocket + stop
 
536
--- config
 
537
    location /t {
 
538
        lua_check_client_abort on;
 
539
        access_by_lua '
 
540
            ngx.req.discard_body()
 
541
 
 
542
            local sock, err = ngx.socket.tcp()
 
543
            if not sock then
 
544
                ngx.log(ngx.ERR, "failed to get socket: ", err)
 
545
                return
 
546
            end
 
547
 
 
548
            ok, err = sock:connect("127.0.0.1", $TEST_NGINX_REDIS_PORT)
 
549
            if not ok then
 
550
                ngx.log(ngx.ERR, "failed to connect: ", err)
 
551
                return
 
552
            end
 
553
 
 
554
            local bytes, err = sock:send("blpop nonexist 2\\r\\n")
 
555
            if not bytes then
 
556
                ngx.log(ngx.ERR, "failed to send query: ", err)
 
557
                return
 
558
            end
 
559
 
 
560
            -- ngx.log(ngx.ERR, "about to receive")
 
561
 
 
562
            local res, err = sock:receive()
 
563
            if not res then
 
564
                ngx.log(ngx.ERR, "failed to receive query: ", err)
 
565
                return
 
566
            end
 
567
 
 
568
            ngx.log(ngx.ERR, "res: ", res)
 
569
        ';
 
570
    }
 
571
--- request
 
572
GET /t
 
573
 
 
574
--- stap2 eval: $::StapScript
 
575
--- stap eval: $::GCScript
 
576
--- stap_out
 
577
lua check broken conn
 
578
lua req cleanup
 
579
delete thread 1
 
580
 
 
581
--- wait: 1
 
582
--- timeout: 0.2
 
583
--- abort
 
584
--- ignore_response
 
585
--- no_error_log
 
586
[error]
 
587
--- error_log
 
588
client prematurely closed connection
 
589
 
 
590
 
 
591
 
 
592
=== TEST 17: ngx.req.socket + receive n < content-length + stop
 
593
--- config
 
594
    location /t {
 
595
        lua_check_client_abort on;
 
596
        access_by_lua '
 
597
            local sock = ngx.req.socket()
 
598
            local res, err = sock:receive("*a")
 
599
            if not res then
 
600
                ngx.log(ngx.NOTICE, "failed to receive: ", err)
 
601
                return
 
602
            end
 
603
            error("bad")
 
604
        ';
 
605
        content_by_lua return;
 
606
    }
 
607
--- raw_request eval
 
608
"POST /t HTTP/1.0\r
 
609
Host: localhost\r
 
610
Connection: close\r
 
611
Content-Length: 100\r
 
612
\r
 
613
hello"
 
614
--- stap2 eval: $::StapScript
 
615
--- stap eval: $::GCScript
 
616
--- stap_out
 
617
terminate 1: ok
 
618
delete thread 1
 
619
terminate 2: ok
 
620
delete thread 2
 
621
lua req cleanup
 
622
 
 
623
--- timeout: 0.2
 
624
--- abort
 
625
--- ignore_response
 
626
--- no_error_log
 
627
[error]
 
628
--- error_log
 
629
failed to receive: client aborted
 
630
 
 
631
 
 
632
 
 
633
=== TEST 18: ngx.req.socket + receive n == content-length + stop
 
634
--- config
 
635
    location /t {
 
636
        lua_check_client_abort on;
 
637
        access_by_lua '
 
638
            local sock = ngx.req.socket()
 
639
            local res, err = sock:receive("*a")
 
640
            if not res then
 
641
                ngx.log(ngx.NOTICE, "failed to receive: ", err)
 
642
                return
 
643
            end
 
644
            ngx.sleep(1)
 
645
            error("bad")
 
646
        ';
 
647
 
 
648
        content_by_lua return;
 
649
    }
 
650
--- raw_request eval
 
651
"POST /t HTTP/1.0\r
 
652
Host: localhost\r
 
653
Connection: close\r
 
654
Content-Length: 5\r
 
655
\r
 
656
hello"
 
657
--- stap2 eval: $::StapScript
 
658
--- stap eval: $::GCScript
 
659
--- stap_out
 
660
lua check broken conn
 
661
lua check broken conn
 
662
lua req cleanup
 
663
delete thread 1
 
664
 
 
665
--- timeout: 0.2
 
666
--- abort
 
667
--- ignore_response
 
668
--- no_error_log
 
669
[error]
 
670
--- error_log
 
671
client prematurely closed connection
 
672
 
 
673
 
 
674
 
 
675
=== TEST 19: ngx.req.socket + receive n == content-length + ignore
 
676
--- config
 
677
    location /t {
 
678
        access_by_lua '
 
679
            local sock = ngx.req.socket()
 
680
            local res, err = sock:receive("*a")
 
681
            if not res then
 
682
                ngx.log(ngx.NOTICE, "failed to receive: ", err)
 
683
                return
 
684
            end
 
685
            ngx.say("done")
 
686
        ';
 
687
        content_by_lua return;
 
688
    }
 
689
--- raw_request eval
 
690
"POST /t HTTP/1.0\r
 
691
Host: localhost\r
 
692
Connection: close\r
 
693
Content-Length: 5\r
 
694
\r
 
695
hello"
 
696
--- stap2 eval: $::StapScript
 
697
--- stap eval: $::GCScript
 
698
--- stap_out
 
699
terminate 1: ok
 
700
delete thread 1
 
701
terminate 2: ok
 
702
delete thread 2
 
703
lua req cleanup
 
704
 
 
705
--- shutdown: 1
 
706
--- ignore_response
 
707
--- no_error_log
 
708
[error]
 
709
[alert]
 
710
 
 
711
 
 
712
 
 
713
=== TEST 20: ngx.req.read_body + sleep + stop (log handler still gets called)
 
714
--- config
 
715
    location /t {
 
716
        lua_check_client_abort on;
 
717
        access_by_lua '
 
718
            ngx.req.read_body()
 
719
        ';
 
720
        content_by_lua return;
 
721
    }
 
722
--- request
 
723
POST /t
 
724
hello
 
725
 
 
726
--- stap2 eval: $::StapScript
 
727
--- stap eval: $::GCScript
 
728
--- stap_out
 
729
terminate 1: ok
 
730
delete thread 1
 
731
terminate 2: ok
 
732
delete thread 2
 
733
lua req cleanup
 
734
 
 
735
--- shutdown: 1
 
736
--- ignore_response
 
737
--- no_error_log
 
738
[error]
 
739
 
 
740
 
 
741
 
 
742
=== TEST 21: exec to lua + ignore
 
743
--- config
 
744
    location = /t {
 
745
        lua_check_client_abort on;
 
746
        access_by_lua '
 
747
            ngx.exec("/t2")
 
748
        ';
 
749
    }
 
750
 
 
751
    location = /t2 {
 
752
        lua_check_client_abort off;
 
753
        content_by_lua '
 
754
            ngx.sleep(1)
 
755
        ';
 
756
    }
 
757
--- request
 
758
GET /t
 
759
 
 
760
--- stap2 eval: $::StapScript
 
761
--- stap eval: $::GCScript
 
762
--- stap_out
 
763
terminate 1: ok
 
764
lua req cleanup
 
765
delete thread 1
 
766
terminate 2: ok
 
767
delete thread 2
 
768
lua req cleanup
 
769
 
 
770
--- wait: 1
 
771
--- timeout: 0.2
 
772
--- abort
 
773
--- ignore_response
 
774
--- no_error_log
 
775
[error]
 
776
[alert]
 
777
 
 
778
 
 
779
 
 
780
=== TEST 22: exec to proxy + ignore
 
781
--- config
 
782
    location = /t {
 
783
        lua_check_client_abort on;
 
784
        access_by_lua '
 
785
            ngx.exec("/t2")
 
786
        ';
 
787
    }
 
788
 
 
789
    location = /t2 {
 
790
        proxy_ignore_client_abort on;
 
791
        proxy_pass http://127.0.0.1:$server_port/sleep;
 
792
    }
 
793
 
 
794
    location = /sleep {
 
795
        echo_sleep 1;
 
796
    }
 
797
--- request
 
798
GET /t
 
799
 
 
800
--- stap2 eval: $::StapScript
 
801
--- stap eval: $::GCScript
 
802
--- stap_out
 
803
terminate 1: ok
 
804
lua req cleanup
 
805
delete thread 1
 
806
 
 
807
--- wait: 1
 
808
--- timeout: 0.2
 
809
--- abort
 
810
--- ignore_response
 
811
--- no_error_log
 
812
[error]
 
813
[alert]
 
814
 
 
815
 
 
816
 
 
817
=== TEST 23: exec (named location) to proxy + ignore
 
818
--- config
 
819
    location = /t {
 
820
        lua_check_client_abort on;
 
821
        access_by_lua '
 
822
            ngx.exec("@t2")
 
823
        ';
 
824
    }
 
825
 
 
826
    location @t2 {
 
827
        proxy_ignore_client_abort on;
 
828
        proxy_pass http://127.0.0.1:$server_port/sleep;
 
829
    }
 
830
 
 
831
    location = /sleep {
 
832
        echo_sleep 1;
 
833
    }
 
834
--- request
 
835
GET /t
 
836
 
 
837
--- stap2 eval: $::StapScript
 
838
--- stap eval: $::GCScript
 
839
--- stap_out
 
840
terminate 1: ok
 
841
lua req cleanup
 
842
delete thread 1
 
843
 
 
844
--- wait: 1
 
845
--- timeout: 0.2
 
846
--- abort
 
847
--- ignore_response
 
848
--- no_error_log
 
849
[error]
 
850
[alert]
 
851