Browse Source

[tests] use generated date in HTTP If conditionals

replace hard-coded date in HTTP If conditional tests

x-ref:
  "Make tests pass after 2035"
  https://github.com/lighttpd/lighttpd1.4/pull/106

github: closes #106
master
Glenn Strauss 5 months ago
parent
commit
f7bebe99a5
  1. 14
      tests/request.t

14
tests/request.t

@ -460,10 +460,12 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'OPTIONS for RTSP');
my $nextyr = (gmtime(time()))[5] + 1900 + 1;
$t->{REQUEST} = ( <<EOF
GET /index.html HTTP/1.0
If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
If-Modified-Since: Sun, 01 Jan $nextyr 00:00:02 GMT
If-Modified-Since: Sun, 01 Jan $nextyr 00:00:02 GMT
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
@ -484,8 +486,8 @@ ok($tf->handle_http($t) == 0, 'broken If-Modified-Since');
$t->{REQUEST} = ( <<EOF
GET /index.html HTTP/1.0
If-Modified-Since2: Sun, 01 Jan 2036 00:00:03 GMT
If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
If-Modified-Since2: Sun, 01 Jan $nextyr 00:00:03 GMT
If-Modified-Since: Sun, 01 Jan $nextyr 00:00:02 GMT
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
@ -493,7 +495,7 @@ ok($tf->handle_http($t) == 0, 'Similar Headers (bug #1287)');
$t->{REQUEST} = ( <<EOF
GET /index.html HTTP/1.0
If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
If-Modified-Since: Sun, 01 Jan $nextyr 00:00:02 GMT
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, 'Content-Type' => 'text/html' } ];
@ -501,7 +503,7 @@ ok($tf->handle_http($t) == 0, 'If-Modified-Since');
$t->{REQUEST} = ( <<EOF
GET /index.html HTTP/1.0
If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
If-Modified-Since: Sun, 01 Jan $nextyr 00:00:02 GMT
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, '-Content-Length' => '' } ];

Loading…
Cancel
Save