-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhibachi-start.sh.in
191 lines (164 loc) · 4.97 KB
/
hibachi-start.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/bin/bash
#!/usr/bin/env -i /bin/sh
#!/bin/ksh
#!/bin/sh
#
# hibachi-start.sh
#
# Limited implementation of RFC 2616 and CGI/1.1.
#
# Public Domain 2002, 2004 by Anthony Howe. All rights released.
#
# usage:
#
# hibachi-start.sh &
#
#######################################################################
# Do NOT modify the following section if you are security conscious.
#######################################################################
#
# Reset internal field separator to space, tab, newline.
# Not 100% effective if the environment we inherited has
# already played silly buggers with IFS like "IFS='S'".
#
# Use #!/usr/bin/env -i /bin/sh on shells that support
# option passing and #! lines longer than 32 bytes to
# guarantee a clean environment.
#
IFS='
'
SED=$(which sed)
#
# Get a clean environment to work with. This works for all
# Bourne like shells under most Unix like environments.
#
# Cleaning out the environment on Cygwin prevents hibachi from
# starting and would appear there is some Windows/Cygwin specific
# information maintained and required here.
#
if ! expr `uname` : 'CYGWIN.*' >/dev/null; then
unset $(env | $SED -e '/!::/d' -e 's/^\([^=]*\).*/\1/')
fi
#
# Path of safe executables.
#
export PATH='/usr/local/bin:/usr/bin:/bin'
#
# Disable any environment file.
#
unset ENV
#
# Disable cd shortcuts.
#
unset CDPATH
#######################################################################
# Minimum required for serving static files.
#######################################################################
prefix=@prefix@
exec_prefix=@exec_prefix@
datadir=@datadir@
sysconfdir=@sysconfdir@
sharedstatedir=@sharedstatedir@
localstatedir=@localstatedir@
sbindir=@sbindir@
bindir=@bindir@
#
# The port to be used by the Hibachi web server.
#
# This is NOT normally a server parameter, but information about the
# client connection, but since Hibachi only listens on one port, we
# assume to know what the incoming port is and listen on that. Also
# for the purpose of demonstration, we can't bind to a privileged
# port.
#
export SERVER_PORT=@enable_port@
#
# The root of the Hibachi document tree. Virtual hosts
# are implemented as subdirectories from this location.
#
# For example, to setup virtual hosts by name or IP:
#
# /usr/local/share/hibachi/
# localhost/
# index.html
# ...
# 127.0.0.1 -> localhost/
#
# www.ioccc.org/
# index.html
# ...
# 64.81.251.233 -> www.ioccc.org/
#
#export DOCUMENT_ROOT=${datadir}/hibachi
export DOCUMENT_ROOT=$(pwd)
#
# The executable.
#
#hibachi=${sbindir}/@PACKAGE_NAME@
hibachi=`dirname $0`/@PACKAGE_NAME@
#######################################################################
# Required for most CGI scripts.
#######################################################################
#
# Your host name or IP address. Ideally this should be the server-name
# used in self-referencing URLs.
#
export SERVER_NAME=127.0.0.1
#
# My web server name and version
#
export SERVER_SOFTWARE='@PACKAGE_NAME@/@PACKAGE_VERSION@'
#
# Predefined environment space for the request method.
#
export REQUEST_METHOD='1234'
#
# Predefined environment space for remote address of a request.
#
export REMOTE_ADDR='123.123.123.123'
#
# Predefined environment space for upload Content-Length.
#
export CONTENT_LENGTH='123456789.123456789.'
#
# Predefined environment space for upload Content-Type.
# Look at the Apache mime.types file, there are some long ones.
#
export CONTENT_TYPE='123456789.123456789.123456789.123456789.123456789.123456789.'
#
# Predefined environment space for cookies. A single cookie can actually
# be a maximum of 4096 bytes in size, but here we only handle shorter ones.
#
export HTTP_COOKIE='123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.'
#
# Predefined environment space for the absolute path of the script
# to be processed. Required by PHP/CGI in order to find the script.
# This variable is not part of the CGI/1.1 Specification.
#
export SCRIPT_FILENAME='123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.'
#
# Hibachi does support the entire CGI/1.1 specification.
#
export GATEWAY_INTERFACE='CGI/0.0'
#
# We cannot support the following common CGI environment variables
# as specified in the draft 3 of a proposed Internet Standard
# due to space limitations, but since the draft has expired and
# on hold, there is a lot of lee way:
#
# AUTH_TYPE (MUST) HTTP_ACCEPT (MAY)
# HTTP_REFERER (MAY) PATH_INFO (MUST)
# PATH_TRANSLATED (SHOULD) REMOTE_HOST (SHOULD)
# REMOTE_IDENT (MAY) REMOTE_USER (SHOULD)
# SCRIPT_NAME (MUST) SERVER_PROTOCOL (MUST)
#
#######################################################################
# Nothing to configure below this point.
#######################################################################
#
# Start the web server.
#
exec ${hibachi}
#######################################################################
# Beyond here be dragons...
#######################################################################