~ubuntu-branches/ubuntu/saucy/nginx/saucy-updates

« back to all changes in this revision

Viewing changes to debian/modules/nginx-lua/t/020-subrequest.t

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry, Cyril Lavier, Michael Lustfield, Kartik Mistry
  • Date: 2012-05-14 11:15:00 UTC
  • mfrom: (4.2.49 sid)
  • Revision ID: package-import@ubuntu.com-20120514111500-1y9ij7zulu9xnmry
Tags: 1.2.0-1
[Cyril Lavier]
* New upstream release. (Closes: #670306)
  + 1.2.x is stable release now.
* debian/modules/chunkin-nginx-module:
  + Updated chunkin-nginx-module to v0.23rc2-3-g85eca98.
* debian/modules/headers-more-module:
  + Updated headers-more-module to v0.17rc1-4-g33a82ed.
* debian/modules/nginx-development-kit:
  + Updated nginx-development-kit to v0.2.17-7-g24202b4.
* debian/modules/nginx-echo:
  + Updated nginx-echo to v0.38rc2-7-g080c0a1.
* debian/modules/nginx-lua:
  + Updated nginx-lua to v0.5.0rc25-5-g8d28785.
* debian/modules/nginx-upstream-fair:
  + Updated nginx-upstream-fair to a18b409.
* debian/modules/nginx-upload-progress:
  + Updated nginx-upload-progress to v0.9.0-0-ga788dea.
* debian/modules/naxsi:
  + Updated naxsi to 0.46
* debian/modules/README.Modules-versions:
  + Updated versions and URLs for modules.
* debian/naxsi-ui-extract, debian/naxsi-ui-intercept,
  debian/nginx-naxsi-ui.*, debian/naxsi-ui-extract.1,
  debian/naxsi-ui-intercept.1, debian/rules:
  + Added nginx-naxsi-ui package containing the learning daemon
    and the WebUI.
* debian/nginx-common.nginx.default, debian/nginx-common.nginx.init:
  + Renamed files to be compliant with the nginx-naxsi-ui package.
* debian/po:
  + Added needed files for using po-debconf.
  + Added French translation.
* debian/control:
  + Applied the modifications given after the review by Justin Rye.

[Michael Lustfield]
* debian/conf/uwsgi_params:
  + Added UWSGI_SCHEME to uwsgi_params. (Closes: #664878)
* debian/conf/sites-available/default:
  + Added allow directive for ipv6 localhost. (Closes: #664271)

[Kartik Mistry]
* debian/control:
  + wrap-and-sort.
* debian/copyright:
  + Added missing copyrights, minor formatting fixes.
* debian/nginx-common.nginx.init:
  + Added ulimit for restarts, Thanks to Daniel Roschka
    <danielroschka@phoenitydawn.de> for patch. (Closes: #673580)
* debian/conf/sites-available/default:
  + Added patch to fix deprecated "listen" directive, Thanks to
    Guillaume Plessis <gui@dotdeb.org> for patch. (Closes: #672632)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
use lib 'lib';
3
3
use Test::Nginx::Socket;
4
4
 
 
5
#master_on();
 
6
workers(1);
5
7
#worker_connections(1014);
 
8
#log_level('warn');
6
9
#master_process_enabled(1);
7
 
#log_level('warn');
8
10
 
9
11
repeat_each(2);
10
 
#repeat_each(1);
11
12
 
12
 
plan tests => repeat_each() * (blocks() * 2);
 
13
plan tests => repeat_each() * (blocks() * 2 + 8);
13
14
 
14
15
$ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211;
15
16
 
385
386
 
386
387
            res = ngx.location.capture("/memc", { share_all_vars = true });
387
388
            ngx.say("cached: " .. res.body);
388
 
 
389
389
        ';
390
390
    }
391
391
--- request
699
699
hello, a
700
700
hello, b
701
701
hello, c
 
702
--- error_log
 
703
lua reuse free buf memory
702
704
 
703
705
 
704
706
 
798
800
--- response_body
799
801
bar
800
802
 
 
803
 
 
804
 
 
805
=== TEST 32: test memcached with subrequests
 
806
--- http_config
 
807
    upstream memc {
 
808
        server 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
 
809
        keepalive 100 single;
 
810
    }
 
811
--- config
 
812
    location /memc {
 
813
        set $memc_key some_key;
 
814
        set $memc_exptime 600;
 
815
        memc_pass memc;
 
816
    }
 
817
 
 
818
    location /t {
 
819
        content_by_lua '
 
820
            res = ngx.location.capture("/memc",
 
821
                { method = ngx.HTTP_PUT, body = "hello 1234" });
 
822
            -- ngx.say("PUT: " .. res.status);
 
823
 
 
824
            res = ngx.location.capture("/memc");
 
825
            ngx.say("some_key: " .. res.body);
 
826
        ';
 
827
    }
 
828
--- request
 
829
GET /t
 
830
--- response_body
 
831
some_key: hello 1234
 
832
--- error_log
 
833
lua reuse free buf chain, but reallocate memory because
 
834
--- no_error_log
 
835
[error]
 
836
 
 
837
 
 
838
 
 
839
=== TEST 33: main POST, sub GET (main does not read the body)
 
840
--- config
 
841
    location /other {
 
842
        default_type 'foo/bar';
 
843
        content_by_lua '
 
844
            ngx.req.read_body()
 
845
            ngx.say(ngx.var.request_method)
 
846
            ngx.say(ngx.req.get_body_data())
 
847
        ';
 
848
    }
 
849
 
 
850
    location /foo {
 
851
        proxy_pass http://127.0.0.1:$server_port/other;
 
852
        #proxy_pass http://127.0.0.1:8892/other;
 
853
    }
 
854
 
 
855
    location /lua {
 
856
        content_by_lua '
 
857
            res = ngx.location.capture("/foo",
 
858
                { method = ngx.HTTP_GET });
 
859
 
 
860
            ngx.print(res.body)
 
861
        ';
 
862
    }
 
863
--- request
 
864
POST /lua
 
865
hello, world
 
866
--- response_body
 
867
GET
 
868
nil
 
869
--- no_error_log
 
870
[error]
 
871
 
 
872
 
 
873
 
 
874
=== TEST 34: main POST, sub GET (main has read the body)
 
875
--- config
 
876
    location /other {
 
877
        default_type 'foo/bar';
 
878
        content_by_lua '
 
879
            ngx.req.read_body()
 
880
            ngx.say(ngx.var.request_method)
 
881
            ngx.say(ngx.req.get_body_data())
 
882
        ';
 
883
    }
 
884
 
 
885
    location /foo {
 
886
        proxy_pass http://127.0.0.1:$server_port/other;
 
887
        #proxy_pass http://127.0.0.1:8892/other;
 
888
    }
 
889
 
 
890
    location /lua {
 
891
        content_by_lua '
 
892
            ngx.req.read_body()
 
893
 
 
894
            res = ngx.location.capture("/foo",
 
895
                { method = ngx.HTTP_GET });
 
896
 
 
897
            ngx.print(res.body)
 
898
        ';
 
899
    }
 
900
--- request
 
901
POST /lua
 
902
hello, world
 
903
--- response_body
 
904
GET
 
905
nil
 
906
--- no_error_log
 
907
[error]
 
908
 
 
909
 
 
910
 
 
911
=== TEST 35: main POST, sub POST (inherit bodies directly)
 
912
--- config
 
913
    location /other {
 
914
        default_type 'foo/bar';
 
915
        content_by_lua '
 
916
            ngx.req.read_body()
 
917
            ngx.say(ngx.var.request_method)
 
918
            ngx.say(ngx.req.get_body_data())
 
919
        ';
 
920
    }
 
921
 
 
922
    location /foo {
 
923
        proxy_pass http://127.0.0.1:$server_port/other;
 
924
        #proxy_pass http://127.0.0.1:8892/other;
 
925
    }
 
926
 
 
927
    location /lua {
 
928
        content_by_lua '
 
929
            ngx.req.read_body()
 
930
 
 
931
            res = ngx.location.capture("/foo",
 
932
                { method = ngx.HTTP_POST });
 
933
 
 
934
            ngx.print(res.body)
 
935
        ';
 
936
    }
 
937
--- request
 
938
POST /lua
 
939
hello, world
 
940
--- response_body
 
941
POST
 
942
hello, world
 
943
--- no_error_log
 
944
[error]
 
945
 
 
946
 
 
947
 
 
948
=== TEST 36: main POST, sub PUT (inherit bodies directly)
 
949
--- config
 
950
    location /other {
 
951
        default_type 'foo/bar';
 
952
        content_by_lua '
 
953
            ngx.req.read_body()
 
954
            ngx.say(ngx.var.request_method)
 
955
            ngx.say(ngx.req.get_body_data())
 
956
        ';
 
957
    }
 
958
 
 
959
    location /foo {
 
960
        proxy_pass http://127.0.0.1:$server_port/other;
 
961
        #proxy_pass http://127.0.0.1:8892/other;
 
962
    }
 
963
 
 
964
    location /lua {
 
965
        content_by_lua '
 
966
            ngx.req.read_body()
 
967
 
 
968
            res = ngx.location.capture("/foo",
 
969
                { method = ngx.HTTP_PUT });
 
970
 
 
971
            ngx.print(res.body)
 
972
        ';
 
973
    }
 
974
--- request
 
975
POST /lua
 
976
hello, world
 
977
--- response_body
 
978
PUT
 
979
hello, world
 
980
--- no_error_log
 
981
[error]
 
982
 
 
983
 
 
984
 
 
985
=== TEST 37: recursive calls
 
986
--- config
 
987
    location /t {
 
988
        content_by_lua '
 
989
            ngx.location.capture("/t")
 
990
        ';
 
991
    }
 
992
--- request
 
993
    GET /t
 
994
--- ignore_response
 
995
--- error_log
 
996
subrequests cycle while processing "/t"
 
997
 
 
998
 
 
999
 
 
1000
=== TEST 38: OPTIONS
 
1001
--- config
 
1002
    location /other {
 
1003
        default_type 'foo/bar';
 
1004
        echo $echo_request_method;
 
1005
    }
 
1006
 
 
1007
    location /lua {
 
1008
        content_by_lua '
 
1009
            res = ngx.location.capture("/other",
 
1010
                { method = ngx.HTTP_OPTIONS });
 
1011
 
 
1012
            ngx.print(res.body)
 
1013
        ';
 
1014
    }
 
1015
--- request
 
1016
GET /lua
 
1017
--- response_body
 
1018
OPTIONS
 
1019
--- no_error_log
 
1020
[error]
 
1021
 
 
1022
 
 
1023
 
 
1024
=== TEST 39: OPTIONS with a body
 
1025
--- config
 
1026
    location /other {
 
1027
        default_type 'foo/bar';
 
1028
        echo $echo_request_method;
 
1029
        echo_request_body;
 
1030
    }
 
1031
 
 
1032
    location /lua {
 
1033
        content_by_lua '
 
1034
            res = ngx.location.capture("/other",
 
1035
                { method = ngx.HTTP_OPTIONS, body = "hello world" });
 
1036
 
 
1037
            ngx.print(res.body)
 
1038
        ';
 
1039
    }
 
1040
--- request
 
1041
GET /lua
 
1042
--- response_body chop
 
1043
OPTIONS
 
1044
hello world
 
1045
--- no_error_log
 
1046
[error]
 
1047