diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:54:23 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:54:44 +0000 |
commit | 836b47cb7e99a977c5a23b059ca1d0b5065d310e (patch) | |
tree | 1604da8f482d02effa033c94a84be42bc0c848c3 /web/server/h2o/libh2o/t/50mruby-htpasswd.t | |
parent | Releasing debian version 1.44.3-2. (diff) | |
download | netdata-836b47cb7e99a977c5a23b059ca1d0b5065d310e.tar.xz netdata-836b47cb7e99a977c5a23b059ca1d0b5065d310e.zip |
Merging upstream version 1.46.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/server/h2o/libh2o/t/50mruby-htpasswd.t')
-rw-r--r-- | web/server/h2o/libh2o/t/50mruby-htpasswd.t | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/web/server/h2o/libh2o/t/50mruby-htpasswd.t b/web/server/h2o/libh2o/t/50mruby-htpasswd.t deleted file mode 100644 index 31cbf5961..000000000 --- a/web/server/h2o/libh2o/t/50mruby-htpasswd.t +++ /dev/null @@ -1,48 +0,0 @@ -use strict; -use warnings; -use Digest::MD5 qw(md5_hex); -use Test::More; -use t::Util; - -plan skip_all => 'mruby support is off' - unless server_features()->{mruby}; - -plan skip_all => 'curl not found' - unless prog_exists('curl'); - -subtest "basic" => sub { - my $server = spawn_h2o(<< 'EOT'); -hosts: - default: - paths: - /: - mruby.handler: | - require "share/h2o/mruby/htpasswd.rb" - Htpasswd.new("t/assets/.htpasswd", "protected space") - mruby.handler: - Proc.new do |env| - [200, {}, ["hello ", env["REMOTE_USER"], "\n"]] - end -EOT - subtest "no-auth" => sub { - my ($headers, $body) = run_prog("curl --silent --dump-header /dev/stderr http://127.0.0.1:$server->{port}/"); - like $headers, qr{^HTTP/1\.1 401 }s, "status"; - like $headers, qr{\r\nwww-authenticate: basic realm="protected space"\r}is, "www-authenticate header"; - unlike $body, qr/hello/; - }; - - subtest "fail" => sub { - my ($headers, $body) = run_prog("curl --silent --dump-header /dev/stderr http://aaa:aaa\@127.0.0.1:$server->{port}/"); - like $headers, qr{^HTTP/1\.1 401 }s, "status"; - like $headers, qr{\r\nwww-authenticate: basic realm="protected space"\r}is, "www-authenticate header"; - unlike $body, qr/hello/; - }; - - subtest "success" => sub { - my ($headers, $body) = run_prog("curl --silent --dump-header /dev/stderr http://dankogai:kogaidan\@127.0.0.1:$server->{port}/"); - like $headers, qr{^HTTP/1\.1 200 }s, "status"; - is $body, "hello dankogai\n", "content"; - }; -}; - -done_testing(); |