From de9e2f988166f17bd3d4a08e635edbf29236e370 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Mon, 20 Jul 2020 03:59:40 -0400 Subject: [tests] mod_compress -> mod_deflate --- tests/CMakeLists.txt | 2 +- tests/Makefile.am | 4 +- tests/SConscript | 4 +- tests/meson.build | 2 +- tests/mod-compress.conf | 38 ------------------ tests/mod-compress.t | 103 ------------------------------------------------ tests/mod-deflate.conf | 38 ++++++++++++++++++ tests/mod-deflate.t | 103 ++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 147 insertions(+), 147 deletions(-) delete mode 100644 tests/mod-compress.conf delete mode 100755 tests/mod-compress.t create mode 100644 tests/mod-deflate.conf create mode 100755 tests/mod-deflate.t diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f4c4867e..51d534bd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -23,7 +23,7 @@ set(T_FILES lowercase.t mod-auth.t mod-cgi.t - mod-compress.t + mod-deflate.t mod-extforward.t mod-fastcgi.t mod-proxy.t diff --git a/tests/Makefile.am b/tests/Makefile.am index af901c9e..7edc1a5a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -36,8 +36,8 @@ CONFS=\ mod-auth.conf \ mod-auth.t \ mod-cgi.t \ - mod-compress.conf \ - mod-compress.t \ + mod-deflate.conf \ + mod-deflate.t \ mod-extforward.conf \ mod-extforward.t \ mod-fastcgi.t \ diff --git a/tests/SConscript b/tests/SConscript index 4bf33579..7a03839f 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -17,8 +17,8 @@ extra_dist = Split('fastcgi-10.conf \ mod-auth.conf \ mod-auth.t \ mod-cgi.t \ - mod-compress.t \ - mod-compress.conf \ + mod-deflate.t \ + mod-deflate.conf \ mod-fastcgi.t \ request.t \ mod-ssi.t \ diff --git a/tests/meson.build b/tests/meson.build index a90064e4..f6c501ac 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -32,7 +32,7 @@ tests = [ 'lowercase.t', 'mod-auth.t', 'mod-cgi.t', - 'mod-compress.t', + 'mod-deflate.t', 'mod-extforward.t', 'mod-fastcgi.t', 'mod-proxy.t', diff --git a/tests/mod-compress.conf b/tests/mod-compress.conf deleted file mode 100644 index 8303e750..00000000 --- a/tests/mod-compress.conf +++ /dev/null @@ -1,38 +0,0 @@ -debug.log-request-handling = "enable" -debug.log-response-header = "disable" -debug.log-request-header = "disable" - -server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" -server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" - -## bind to port (default: 80) -server.port = 2048 - -## bind to localhost (default: all interfaces) -server.bind = "localhost" -server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" -server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log" -server.name = "www.example.org" - -server.modules = ( - "mod_deflate", -) - -mimetype.assign = ( - ".html" => "text/html", - ".txt" => "text/plain; charset=utf-8", -) - -$HTTP["host"] == "cache.example.org" { - deflate.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/" -} - -deflate.mimetypes = ( - "text/plain", - "text/html", -) - -deflate.allowed-encodings = ( - "gzip", - "deflate", -) diff --git a/tests/mod-compress.t b/tests/mod-compress.t deleted file mode 100755 index bbcabfee..00000000 --- a/tests/mod-compress.t +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env perl -BEGIN { - # add current source dir to the include-path - # we need this for make distcheck - (my $srcdir = $0) =~ s,/[^/]+$,/,; - unshift @INC, $srcdir; -} - -use strict; -use IO::Socket; -use Test::More tests => 11; -use LightyTest; - -my $tf = LightyTest->new(); -my $t; - -$tf->{CONFIGFILE} = 'mod-compress.conf'; - -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '' } ]; -ok($tf->handle_http($t) == 0, 'Vary is set'); - -$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } ]; -ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set'); - -$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } ]; -ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set'); - -$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1306', '+Content-Encoding' => '' } ]; -ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set'); - -$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1306', '+Content-Encoding' => '' } ]; -ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set'); - - -$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '' } ]; -ok($tf->handle_http($t) == 0, 'gzip, deflate - Content-Length and Content-Encoding is set'); - -$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '', 'Content-Type' => "text/plain; charset=utf-8" } ]; -ok($tf->handle_http($t) == 0, 'Content-Type is from the original file'); - -$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-Content-Encoding' => '', 'Content-Type' => "text/plain; charset=utf-8" } ]; -ok($tf->handle_http($t) == 0, 'Empty Accept-Encoding'); - -$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Encoding' => 'gzip', 'Content-Type' => "text/plain; charset=utf-8" } ]; -ok($tf->handle_http($t) == 0, 'bzip2 requested but disabled'); - - -ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-deflate.conf b/tests/mod-deflate.conf new file mode 100644 index 00000000..8303e750 --- /dev/null +++ b/tests/mod-deflate.conf @@ -0,0 +1,38 @@ +debug.log-request-handling = "enable" +debug.log-response-header = "disable" +debug.log-request-header = "disable" + +server.document-root = env.SRCDIR + "/tmp/lighttpd/servers/www.example.org/pages/" +server.pid-file = env.SRCDIR + "/tmp/lighttpd/lighttpd.pid" + +## bind to port (default: 80) +server.port = 2048 + +## bind to localhost (default: all interfaces) +server.bind = "localhost" +server.errorlog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.error.log" +server.breakagelog = env.SRCDIR + "/tmp/lighttpd/logs/lighttpd.breakage.log" +server.name = "www.example.org" + +server.modules = ( + "mod_deflate", +) + +mimetype.assign = ( + ".html" => "text/html", + ".txt" => "text/plain; charset=utf-8", +) + +$HTTP["host"] == "cache.example.org" { + deflate.cache-dir = env.SRCDIR + "/tmp/lighttpd/cache/compress/" +} + +deflate.mimetypes = ( + "text/plain", + "text/html", +) + +deflate.allowed-encodings = ( + "gzip", + "deflate", +) diff --git a/tests/mod-deflate.t b/tests/mod-deflate.t new file mode 100755 index 00000000..7cabcb9f --- /dev/null +++ b/tests/mod-deflate.t @@ -0,0 +1,103 @@ +#!/usr/bin/env perl +BEGIN { + # add current source dir to the include-path + # we need this for make distcheck + (my $srcdir = $0) =~ s,/[^/]+$,/,; + unshift @INC, $srcdir; +} + +use strict; +use IO::Socket; +use Test::More tests => 11; +use LightyTest; + +my $tf = LightyTest->new(); +my $t; + +$tf->{CONFIGFILE} = 'mod-deflate.conf'; + +ok($tf->start_proc == 0, "Starting lighttpd") or die(); + +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '' } ]; +ok($tf->handle_http($t) == 0, 'Vary is set'); + +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } ]; +ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set'); + +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } ]; +ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set'); + +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1306', '+Content-Encoding' => '' } ]; +ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set'); + +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1306', '+Content-Encoding' => '' } ]; +ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set'); + + +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '' } ]; +ok($tf->handle_http($t) == 0, 'gzip, deflate - Content-Length and Content-Encoding is set'); + +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '', 'Content-Type' => "text/plain; charset=utf-8" } ]; +ok($tf->handle_http($t) == 0, 'Content-Type is from the original file'); + +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-Content-Encoding' => '', 'Content-Type' => "text/plain; charset=utf-8" } ]; +ok($tf->handle_http($t) == 0, 'Empty Accept-Encoding'); + +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Encoding' => 'gzip', 'Content-Type' => "text/plain; charset=utf-8" } ]; +ok($tf->handle_http($t) == 0, 'bzip2 requested but disabled'); + + +ok($tf->stop_proc == 0, "Stopping lighttpd"); -- cgit v1.2.1