658
658
ngx.header.cache_control = { "private", "no-store" }
659
659
ngx.header.cache_control = { "no-cache", "blah", "foo" }
660
660
ngx.say("Cache-Control: ", ngx.var.sent_http_cache_control)
661
ngx.say("Cache-Control: ", table.concat(ngx.header.cache_control, "; "))
661
ngx.say("Cache-Control: ", table.concat(ngx.header.cache_control, ", "))
666
666
--- response_headers
667
667
Cache-Control: no-cache, blah, foo
669
Cache-Control: no-cache; blah; foo
670
Cache-Control: no-cache; blah; foo
668
--- response_body_like chop
669
^Cache-Control: no-cache[;,] blah[;,] foo
670
Cache-Control: no-cache[;,] blah[;,] foo$
859
=== TEST 43: set multiple response header
864
ngx.header["X-Direct-" .. i] = "text/my-plain-" .. i;
867
ngx.say(ngx.header["X-Direct-50"]);
879
=== TEST 44: set multiple response header and then reset and then clear
884
ngx.header["X-Direct-" .. i] = "text/my-plain-" .. i;
888
ngx.header["X-Direct-" .. i] = "text/my-plain"
892
ngx.header["X-Direct-" .. i] = nil
907
=== TEST 45: set response content-type header for multiple times
911
ngx.header.content_type = "text/my-plain";
912
ngx.header.content_type = "text/my-plain-2";
919
Content-Type: text/my-plain-2
925
=== TEST 46: set Last-Modified response header for multiple times
929
ngx.header.last_modified = ngx.http_time(1290079655)
930
ngx.header.last_modified = ngx.http_time(1290079654)
937
Last-Modified: Thu, 18 Nov 2010 11:27:34 GMT
943
=== TEST 47: set Last-Modified response header and then clear
947
ngx.header.last_modified = ngx.http_time(1290079655)
948
ngx.header.last_modified = nil
961
=== TEST 48: github #20: segfault caused by the nasty optimization in the nginx core (write)
964
header_filter_by_lua '
967
proxy_pass http://127.0.0.1:$server_port;
975
Location: http://localhost:$ServerPort/t/
976
--- response_body_like: 301 Moved Permanently
983
=== TEST 49: github #20: segfault caused by the nasty optimization in the nginx core (read)
986
header_filter_by_lua '
987
local v = ngx.header.foo
989
proxy_pass http://127.0.0.1:$server_port;
996
--- response_body_like: 301 Moved Permanently
998
Location: http://localhost:$ServerPort/t/
1005
=== TEST 50: github #20: segfault caused by the nasty optimization in the nginx core (read Location)
1008
header_filter_by_lua '
1009
ngx.header.Foo = ngx.header.location
1011
proxy_pass http://127.0.0.1:$server_port;
1018
--- response_headers
1019
Location: http://localhost:$ServerPort/t/
1021
--- response_body_like: 301 Moved Permanently
1028
=== TEST 51: github #20: segfault caused by the nasty optimization in the nginx core (set Foo and read Location)
1031
header_filter_by_lua '
1033
ngx.header.Foo = ngx.header.location
1035
proxy_pass http://127.0.0.1:$server_port;
1042
--- response_headers
1043
Location: http://localhost:$ServerPort/t/
1045
--- response_body_like: 301 Moved Permanently
1052
=== TEST 52: case sensitive cache-control header
1056
ngx.header["cache-Control"] = "private"
1057
ngx.say("Cache-Control: ", ngx.var.sent_http_cache_control)
1062
--- raw_response_headers_like chop
1063
cache-Control: private
1065
Cache-Control: private
1069
=== TEST 53: clear Cache-Control when there was no Cache-Control
1073
ngx.header["Cache-Control"] = nil
1074
ngx.say("Cache-Control: ", ngx.var.sent_http_cache_control)
1079
--- raw_response_headers_unlike eval
1086
=== TEST 54: set response content-type header
1090
local s = "content_type"
1091
local v = ngx.header[s]
1105
=== TEST 55: set a number header name
1109
ngx.header[32] = "private"
1110
ngx.say("32: ", ngx.var.sent_http_32)
1115
--- response_headers
1124
=== TEST 56: set a number header name (in a table value)
1128
ngx.header.foo = {32}
1129
ngx.say("foo: ", ngx.var.sent_http_foo)
1134
--- response_headers