diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2021-07-02 03:48:04 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2021-08-27 02:16:54 -0400 |
commit | f7bebe99a5809c0c32178a8c35ca9f0fe1ea652e (patch) | |
tree | ddaa8426ac59da2024eac9d69f805f51a6d50187 | |
parent | 361b96476e71ff10717237e204d67ca00cb7859c (diff) | |
download | lighttpd-git-f7bebe99a5809c0c32178a8c35ca9f0fe1ea652e.tar.gz |
[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
-rwxr-xr-x | tests/request.t | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/request.t b/tests/request.t index 432bb51e..ea4b1fb7 100755 --- a/tests/request.t +++ b/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' => '' } ]; |