159
158
calendar:datetime_to_gregorian_seconds(FileInfo#file_info.mtime),
161
160
Mod = httpd_util:rfc1123_date(calendar:gregorian_seconds_to_datetime(
164
163
%% Test that we get the data when the file is modified
165
164
ok = httpd_test_lib:verify_request(Type, Host, Port, Node,
166
"GET / HTTP/1.1\r\nHost:" ++ Host ++
167
"\r\nIf-Modified-Since:" ++
169
[{statuscode, 200}]),
170
Mod1 = httpd_util:rfc1123_date(calendar:gregorian_seconds_to_datetime(
172
ok = httpd_test_lib:verify_request(Type,Host,Port,Node,
173
"GET / HTTP/1.1\r\nHost:"
174
++ Host ++"\r\nIf-Modified-Since:"
175
++ Mod1 ++"\r\n\r\n",
176
[{statuscode, 304}]),
165
"GET / HTTP/1.1\r\nHost:" ++ Host ++
166
"\r\nIf-Modified-Since:" ++
168
[{statuscode, 200}]),
169
Mod1 = httpd_util:rfc1123_date(calendar:gregorian_seconds_to_datetime(
171
ok = httpd_test_lib:verify_request(Type,Host,Port,Node,
172
"GET / HTTP/1.1\r\nHost:"
173
++ Host ++"\r\nIf-Modified-Since:"
174
++ Mod1 ++"\r\n\r\n",
175
[{statuscode, 304}]),
178
ok = httpd_test_lib:verify_request(Type, Host, Port, Node,
179
"GET / HTTP/1.1\r\nHost:" ++ Host ++
180
"\r\nIf-Modified-Since:" ++
181
"AAA[...]AAAA" ++ "\r\n\r\n",
182
[{statuscode, 400}]),
178
185
Mod2 = httpd_util:rfc1123_date(calendar:gregorian_seconds_to_datetime(
180
187
%% Control that the If-Unmodified-Header lmits the response
181
188
ok = httpd_test_lib:verify_request(Type,Host,Port,Node,
182
"GET / HTTP/1.1\r\nHost:"
184
"\r\nIf-Unmodified-Since:" ++ Mod2
186
[{statuscode, 200}]),
189
"GET / HTTP/1.1\r\nHost:"
191
"\r\nIf-Unmodified-Since:" ++ Mod2
193
[{statuscode, 200}]),
187
194
Mod3 = httpd_util:rfc1123_date(calendar:gregorian_seconds_to_datetime(
190
197
ok = httpd_test_lib:verify_request(Type, Host, Port, Node,
191
"GET / HTTP/1.1\r\nHost:"
193
"\r\nIf-Unmodified-Since:"++ Mod3
195
[{statuscode, 412}]),
198
"GET / HTTP/1.1\r\nHost:"
200
"\r\nIf-Unmodified-Since:"++ Mod3
202
[{statuscode, 412}]),
197
204
%% Control that we get the body when the etag match
198
205
ok = httpd_test_lib:verify_request(Type, Host, Port, Node,
199
"GET / HTTP/1.1\r\nHost:" ++ Host
202
httpd_util:create_etag(FileInfo)++
204
[{statuscode, 200}]),
206
"GET / HTTP/1.1\r\nHost:" ++ Host
209
httpd_util:create_etag(FileInfo)++
211
[{statuscode, 200}]),
205
212
ok = httpd_test_lib:verify_request(Type, Host, Port, Node,
206
"GET / HTTP/1.1\r\nHost:" ++
208
"If-Match:NotEtag\r\n\r\n",
209
[{statuscode, 412}]),
213
"GET / HTTP/1.1\r\nHost:" ++
215
"If-Match:NotEtag\r\n\r\n",
216
[{statuscode, 412}]),
211
218
%% Control the response when the if-none-match header is there
212
219
ok = httpd_test_lib:verify_request(Type, Host, Port, Node,
213
"GET / HTTP/1.1\r\nHost:"
215
"If-None-Match:NoTaag," ++
216
httpd_util:create_etag(FileInfo) ++
218
[{statuscode, 304}]),
220
"GET / HTTP/1.1\r\nHost:"
222
"If-None-Match:NoTaag," ++
223
httpd_util:create_etag(FileInfo) ++
225
[{statuscode, 304}]),
220
227
ok = httpd_test_lib:verify_request(Type, Host, Port, Node,
221
"GET / HTTP/1.1\r\nHost:"
223
"If-None-Match:NotEtag,"
224
"NeihterEtag\r\n\r\n",
228
"GET / HTTP/1.1\r\nHost:"
230
"If-None-Match:NotEtag,"
231
"NeihterEtag\r\n\r\n",
227
235
http_trace(Type, Port, Host, Node)->
228
236
ok = httpd_test_lib:verify_request(Type, Host, Port, Node,