Mercurial > hg > nginx-tests
comparison not_modified.t @ 491:d5bf5942a8b2
Tests: disambiguated parsing of the status code.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 07 Nov 2014 13:05:07 +0300 |
parents | 37a46774e307 |
children | 907e89fba9c3 |
comparison
equal
deleted
inserted
replaced
490:65d2d372ee31 | 491:d5bf5942a8b2 |
---|---|
50 | 50 |
51 $t->run(); | 51 $t->run(); |
52 | 52 |
53 ############################################################################### | 53 ############################################################################### |
54 | 54 |
55 like(http_get_ims('/t', 'Wed, 08 Jul 2037 22:53:52 GMT'), qr/304/, | 55 like(http_get_ims('/t', 'Wed, 08 Jul 2037 22:53:52 GMT'), qr/ 304 /, |
56 '0x7F000000'); | 56 '0x7F000000'); |
57 like(http_get_ims('/t', 'Tue, 19 Jan 2038 03:14:07 GMT'), qr/304/, | 57 like(http_get_ims('/t', 'Tue, 19 Jan 2038 03:14:07 GMT'), qr/ 304 /, |
58 '0x7FFFFFFF'); | 58 '0x7FFFFFFF'); |
59 | 59 |
60 SKIP: { | 60 SKIP: { |
61 skip "only for 32-bit time_t", 2 if (gmtime(0xFFFFFFFF))[5] == 206; | 61 skip "only for 32-bit time_t", 2 if (gmtime(0xFFFFFFFF))[5] == 206; |
62 | 62 |
63 like(http_get_ims('/t', 'Tue, 19 Jan 2038 03:14:08 GMT'), qr/200/, | 63 like(http_get_ims('/t', 'Tue, 19 Jan 2038 03:14:08 GMT'), qr/ 200 /, |
64 '0x7FFFFFFF + 1'); | 64 '0x7FFFFFFF + 1'); |
65 like(http_get_ims('/t', 'Fri, 25 Feb 2174 09:42:23 GMT'), qr/200/, | 65 like(http_get_ims('/t', 'Fri, 25 Feb 2174 09:42:23 GMT'), qr/ 200 /, |
66 '0x17FFFFFFF'); | 66 '0x17FFFFFFF'); |
67 } | 67 } |
68 | 68 |
69 # If-Match, If-None-Match tests | 69 # If-Match, If-None-Match tests |
70 | 70 |
72 | 72 |
73 $t1 = http_get('/t'); | 73 $t1 = http_get('/t'); |
74 $t1 =~ /ETag: (".*")/; | 74 $t1 =~ /ETag: (".*")/; |
75 $etag = $1; | 75 $etag = $1; |
76 | 76 |
77 like(http_get_inm('/t', $etag), qr/304/, 'if-none-match'); | 77 like(http_get_inm('/t', $etag), qr/ 304 /, 'if-none-match'); |
78 like(http_get_inm('/t', '"foo"'), qr/200/, 'if-none-match fail'); | 78 like(http_get_inm('/t', '"foo"'), qr/ 200 /, 'if-none-match fail'); |
79 like(http_get_inm('/t', '"foo", "bar", ' . $etag . ' , "baz"'), qr/304/, | 79 like(http_get_inm('/t', '"foo", "bar", ' . $etag . ' , "baz"'), qr/ 304 /, |
80 'if-none-match with complex list'); | 80 'if-none-match with complex list'); |
81 like(http_get_inm('/t', '*'), qr/304/, 'if-none-match all'); | 81 like(http_get_inm('/t', '*'), qr/ 304 /, 'if-none-match all'); |
82 | 82 |
83 TODO: { | 83 TODO: { |
84 local $TODO = 'not yet' unless $t->has_version('1.7.3'); | 84 local $TODO = 'not yet' unless $t->has_version('1.7.3'); |
85 | 85 |
86 like(http_get_inm('/t', 'W/' . $etag), qr/304/, 'if-none-match weak'); | 86 like(http_get_inm('/t', 'W/' . $etag), qr/ 304 /, 'if-none-match weak'); |
87 | 87 |
88 } | 88 } |
89 | 89 |
90 like(http_get_im('/t', $etag), qr/200/, 'if-match'); | 90 like(http_get_im('/t', $etag), qr/ 200 /, 'if-match'); |
91 like(http_get_im('/t', '"foo"'), qr/412/, 'if-match fail'); | 91 like(http_get_im('/t', '"foo"'), qr/ 412 /, 'if-match fail'); |
92 like(http_get_im('/t', '"foo", "bar", ' . "\t" . $etag . ' , "baz"'), | 92 like(http_get_im('/t', '"foo", "bar", ' . "\t" . $etag . ' , "baz"'), |
93 qr/200/, 'if-match with complex list'); | 93 qr/ 200 /, 'if-match with complex list'); |
94 like(http_get_im('/t', '*'), qr/200/, 'if-match all'); | 94 like(http_get_im('/t', '*'), qr/ 200 /, 'if-match all'); |
95 like(http_get_im('/t', 'W/' . $etag), qr/412/, 'if-match weak fail'); | 95 like(http_get_im('/t', 'W/' . $etag), qr/ 412 /, 'if-match weak fail'); |
96 | 96 |
97 # server MUST ignore precondition if its response wouldn't be 2xx or 412 | 97 # server MUST ignore precondition if its response wouldn't be 2xx or 412 |
98 | 98 |
99 like(http_get_im('/nx', '"foo"'), qr/404/, 'if-match ignored with 404'); | 99 like(http_get_im('/nx', '"foo"'), qr/ 404 /, 'if-match ignored with 404'); |
100 | 100 |
101 ############################################################################### | 101 ############################################################################### |
102 | 102 |
103 sub http_get_ims { | 103 sub http_get_ims { |
104 my ($url, $ims) = @_; | 104 my ($url, $ims) = @_; |