Last active
April 5, 2016 09:34
-
-
Save cho45/009bd45045a9e55dd5e55e8eaa3baa55 to your computer and use it in GitHub Desktop.
commit: e01f1ade2d55a5dcc33d04a89c757250c75a5831
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subtest "reproxy and server-push" => sub { | |
plan skip_all => 'nghttp not found' | |
unless prog_exists('nghttp'); | |
my $server = spawn_h2o(<< "EOT"); | |
hosts: | |
default: | |
paths: | |
/: | |
reproxy: ON | |
mruby.handler: | | |
Proc.new do |env| | |
case env["PATH_INFO"] | |
when "/reproxy" | |
[307, {"x-reproxy-url" => "/index.txt"}, ["should never see this"]] | |
when "/index.txt" | |
push_paths = [] | |
push_paths << "/index.js" | |
[399, push_paths.empty? ? {} : {"link" => push_paths.map{|p| "<#{p}>; rel=preload"}.join()}, []] | |
end | |
end | |
file.dir: t/assets/doc_root | |
EOT | |
my $resp = `nghttp -n --stat https://127.0.0.1:$server->{tls_port}/reproxy`; | |
like $resp, qr{\nid\s*responseEnd\s.*\s/index\.js\n.*\s/reproxy}is, "receives index.js then /reproxy"; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment