comparison http_host.t @ 224:ba992cfdc606

Tests: remove TODO from tests which pass in 1.2.x.
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 03 Jun 2012 14:47:10 +0400
parents a7cc4371f4ad
children d5bf5942a8b2
comparison
equal deleted inserted replaced
223:f9325406df0b 224:ba992cfdc606
65 65
66 66
67 is(http_host_header('www.abcd-ef.g02.xyz.'), 'www.abcd-ef.g02.xyz', 67 is(http_host_header('www.abcd-ef.g02.xyz.'), 'www.abcd-ef.g02.xyz',
68 'domain w/ ending dot w/o port (host header)'); 68 'domain w/ ending dot w/o port (host header)');
69 69
70 TODO:{
71 local $TODO = 'fix this';
72
73 is(http_host_header('abcd-ef.g02.xyz.:88'), 'abcd-ef.g02.xyz', 70 is(http_host_header('abcd-ef.g02.xyz.:88'), 'abcd-ef.g02.xyz',
74 'domain w/ ending dot w/port (host header)'); 71 'domain w/ ending dot w/port (host header)');
75
76 }
77 72
78 is(http_absolute_path('www.abcd-ef.g02.xyz.'), 'www.abcd-ef.g02.xyz', 73 is(http_absolute_path('www.abcd-ef.g02.xyz.'), 'www.abcd-ef.g02.xyz',
79 'domain w/ ending dot w/o port (absolute request)'); 74 'domain w/ ending dot w/o port (absolute request)');
80 is(http_absolute_path('abcd-ef.g02.xyz.:2'), 'abcd-ef.g02.xyz', 75 is(http_absolute_path('abcd-ef.g02.xyz.:2'), 'abcd-ef.g02.xyz',
81 'domain w/ ending dot w/port (absolute request)'); 76 'domain w/ ending dot w/port (absolute request)');
95 is(http_absolute_path('123.49.0.78'), '123.49.0.78', 90 is(http_absolute_path('123.49.0.78'), '123.49.0.78',
96 'ipv4 w/o port (absolute request)'); 91 'ipv4 w/o port (absolute request)');
97 is(http_absolute_path('123.40.56.78:123'), '123.40.56.78', 92 is(http_absolute_path('123.40.56.78:123'), '123.40.56.78',
98 'ipv4 w/port (absolute request)'); 93 'ipv4 w/port (absolute request)');
99 94
100 TODO: {
101 local $TODO = 'ipv6 literals';
102
103 is(http_host_header('[abcd::ef98:0:7654:321]'), '[abcd::ef98:0:7654:321]', 95 is(http_host_header('[abcd::ef98:0:7654:321]'), '[abcd::ef98:0:7654:321]',
104 'ipv6 literal w/o port (host header)'); 96 'ipv6 literal w/o port (host header)');
105
106 }
107
108 is(http_host_header('[abcd::ef98:0:7654:321]:80'), '[abcd::ef98:0:7654:321]', 97 is(http_host_header('[abcd::ef98:0:7654:321]:80'), '[abcd::ef98:0:7654:321]',
109 'ipv6 literal w/port (host header)'); 98 'ipv6 literal w/port (host header)');
110
111 TODO: {
112 local $TODO = 'ipv6 literals';
113 99
114 is(http_absolute_path('[abcd::ef98:0:7654:321]'), '[abcd::ef98:0:7654:321]', 100 is(http_absolute_path('[abcd::ef98:0:7654:321]'), '[abcd::ef98:0:7654:321]',
115 'ipv6 literal w/o port (absolute request)'); 101 'ipv6 literal w/o port (absolute request)');
116 is(http_absolute_path('[abcd::ef98:0:7654:321]:5'), '[abcd::ef98:0:7654:321]', 102 is(http_absolute_path('[abcd::ef98:0:7654:321]:5'), '[abcd::ef98:0:7654:321]',
117 'ipv6 literal w/port (absolute request)'); 103 'ipv6 literal w/port (absolute request)');
118 104
119 is(http_host_header('[::ffff:12.30.67.89]'), '[::ffff:12.30.67.89]', 105 is(http_host_header('[::ffff:12.30.67.89]'), '[::ffff:12.30.67.89]',
120 'ipv4-mapped ipv6 w/o port (host header)'); 106 'ipv4-mapped ipv6 w/o port (host header)');
121 }
122
123 is(http_host_header('[::123.45.67.89]:4321'), '[::123.45.67.89]', 107 is(http_host_header('[::123.45.67.89]:4321'), '[::123.45.67.89]',
124 'ipv4-mapped ipv6 w/port (host header)'); 108 'ipv4-mapped ipv6 w/port (host header)');
125
126 TODO: {
127 local $TODO = 'ipv6 literals';
128 109
129 is(http_absolute_path('[::123.45.67.89]'), '[::123.45.67.89]', 110 is(http_absolute_path('[::123.45.67.89]'), '[::123.45.67.89]',
130 'ipv4-mapped ipv6 w/o port (absolute request)'); 111 'ipv4-mapped ipv6 w/o port (absolute request)');
131 is(http_absolute_path('[::ffff:12.30.67.89]:4321'), '[::ffff:12.30.67.89]', 112 is(http_absolute_path('[::ffff:12.30.67.89]:4321'), '[::ffff:12.30.67.89]',
132 'ipv4-mapped ipv6 w/port (absolute request)'); 113 'ipv4-mapped ipv6 w/port (absolute request)');
133
134 }
135 114
136 like(http_host_header('example.com/\:552', 1), qr/400/, 115 like(http_host_header('example.com/\:552', 1), qr/400/,
137 'domain w/ path separators (host header)'); 116 'domain w/ path separators (host header)');
138 like(http_absolute_path('\e/xample.com', 1), qr/400/, 117 like(http_absolute_path('\e/xample.com', 1), qr/400/,
139 'domain w/ path separators (absolute request)'); 118 'domain w/ path separators (absolute request)');
172 # / "*" / "+" / "," / ";" / "=" 151 # / "*" / "+" / "," / ";" / "="
173 # 152 #
174 # unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" 153 # unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
175 # 154 #
176 155
177 TODO: {
178 local $TODO = 'IPvFuture';
179
180 is(http_host_header( 156 is(http_host_header(
181 '[v0123456789aBcDeF.!$&\'()*+,;=-._~AbCdEfGhIjKlMnOpQrStUvWxYz' 157 '[v0123456789aBcDeF.!$&\'()*+,;=-._~AbCdEfGhIjKlMnOpQrStUvWxYz'
182 . '0123456789:]'), 158 . '0123456789:]'),
183 '[v0123456789abcdef.!$&\'()*+,;=-._~abcdefghijklmnopqrstuvwxyz' 159 '[v0123456789abcdef.!$&\'()*+,;=-._~abcdefghijklmnopqrstuvwxyz'
184 . '0123456789:]', 160 . '0123456789:]',
189 . '0123456789:]'), 165 . '0123456789:]'),
190 '[v0123456789abcdef.!$&\'()*+,;=-._~abcdefghijklmnopqrstuvwxyz' 166 '[v0123456789abcdef.!$&\'()*+,;=-._~abcdefghijklmnopqrstuvwxyz'
191 . '0123456789:]', 167 . '0123456789:]',
192 'IPvFuture all symbols (absolute request)'); 168 'IPvFuture all symbols (absolute request)');
193 169
194 }
195
196 TODO: {
197 local $TODO = 'or not TODO';
198
199 is(http_host_header('123.40.56.78:9000:80'), '123.40.56.78', 170 is(http_host_header('123.40.56.78:9000:80'), '123.40.56.78',
200 'double port hack'); 171 'double port hack');
201
202 }
203 172
204 ############################################################################### 173 ###############################################################################
205 174
206 sub http_host_header { 175 sub http_host_header {
207 my ($host, $all) = @_; 176 my ($host, $all) = @_;