diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-06-03 23:36:10 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-06-06 23:51:49 +0200 |
commit | bf05606ef1f7a982c821396c3ef9fddeb4a1b011 (patch) | |
tree | eb5233fa49fe486ad759d8ce2b0467705ae27afc /tests/http2-server.pl | |
parent | c53d8a0b41a661251fc08ef696040a77842e2049 (diff) | |
download | curl-bf05606ef1f7a982c821396c3ef9fddeb4a1b011.tar.gz |
http2-tests: test1700 is the first real HTTP/2 test
It requires that 'nghttpx' is in the PATH, and it will run the tests
using nghttpx as a front-end proxy in front of the standard HTTP/1 test
server. This uses HTTP/2 over plain TCP.
If you like me have nghttpx installed in a custom path, you can run test 1700
like this:
$ PATH=$PATH:$HOME/build-nghttp2/bin/ ./runtests.pl 1700
Diffstat (limited to 'tests/http2-server.pl')
-rwxr-xr-x | tests/http2-server.pl | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/http2-server.pl b/tests/http2-server.pl new file mode 100755 index 000000000..56b7ccec8 --- /dev/null +++ b/tests/http2-server.pl @@ -0,0 +1,75 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2016, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +#*************************************************************************** + +# This script invokes nghttpx properly to have it serve HTTP/2 for us. +# nghttpx runs as a proxy in front of our "actual" HTTP/1 server. + +my $pidfile = "log/nghttpx.pid"; +my $logfile = "log/http2.log"; +my $nghttpx = "nghttpx"; +my $listenport = 9015; + +#*************************************************************************** +# Process command line options +# +while(@ARGV) { + if($ARGV[0] eq '--verbose') { + $verbose = 1; + } + elsif($ARGV[0] eq '--pidfile') { + if($ARGV[1]) { + $pidfile = $ARGV[1]; + shift @ARGV; + } + } + elsif($ARGV[0] eq '--nghttpx') { + if($ARGV[1]) { + $nghttpx = $ARGV[1]; + shift @ARGV; + } + } + elsif($ARGV[0] eq '--port') { + if($ARGV[1]) { + $listenport = $ARGV[1]; + shift @ARGV; + } + } + elsif($ARGV[0] eq '--logfile') { + if($ARGV[1]) { + $logfile = $ARGV[1]; + shift @ARGV; + } + } + else { + print STDERR "\nWarning: http2-server.pl unknown parameter: $ARGV[0]\n"; + } + shift @ARGV; +} + +my $cmdline="$nghttpx --backend=127.0.0.1,8990 ". + "--frontend=\"*,$listenport;no-tls\" ". + "--log-level=INFO ". + "--pid-file=$pidfile ". + "--errorlog-file=$logfile"; +print "RUN: $cmdline\n" if($verbose); +system("$cmdline"); |