Skip to content

Instantly share code, notes, and snippets.

@cho45
Last active April 5, 2016 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cho45/009bd45045a9e55dd5e55e8eaa3baa55 to your computer and use it in GitHub Desktop.
Save cho45/009bd45045a9e55dd5e55e8eaa3baa55 to your computer and use it in GitHub Desktop.
commit: e01f1ade2d55a5dcc33d04a89c757250c75a5831
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