2 #***************************************************************************
4 # Project ___| | | | _ \| |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
9 # Copyright (C) 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at https://curl.haxx.se/docs/copyright.html.
15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 # copies of the Software, and permit persons to whom the Software is
17 # furnished to do so, under the terms of the COPYING file.
19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 # KIND, either express or implied.
22 #***************************************************************************
24 # This script invokes nghttpx properly to have it serve HTTP/2 for us.
25 # nghttpx runs as a proxy in front of our "actual" HTTP/1 server.
27 my $pidfile = "log/nghttpx.pid";
28 my $logfile = "log/http2.log";
29 my $nghttpx = "nghttpx";
30 my $listenport = 9015;
31 my $connect = "127.0.0.1,8990";
33 #***************************************************************************
34 # Process command line options
37 if($ARGV[0] eq '--verbose') {
40 elsif($ARGV[0] eq '--pidfile') {
46 elsif($ARGV[0] eq '--nghttpx') {
52 elsif($ARGV[0] eq '--port') {
54 $listenport = $ARGV[1];
58 elsif($ARGV[0] eq '--connect') {
65 elsif($ARGV[0] eq '--logfile') {
72 print STDERR "\nWarning: http2-server.pl unknown parameter: $ARGV[0]\n";
77 my $cmdline="$nghttpx --backend=$connect ".
78 "--frontend=\"*,$listenport;no-tls\" ".
80 "--pid-file=$pidfile ".
81 "--errorlog-file=$logfile";
82 print "RUN: $cmdline\n" if($verbose);
83 system("$cmdline 2>/dev/null");