Skip to content

Commit c3f0cad

Browse files
committed
Merge branch 'wl/insta-mongoose'
* wl/insta-mongoose: Add support for the Mongoose web server.
2 parents e7c693a + 0ded475 commit c3f0cad

File tree

2 files changed

+53
-6
lines changed

2 files changed

+53
-6
lines changed

Documentation/git-instaweb.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ OPTIONS
2929
The HTTP daemon command-line that will be executed.
3030
Command-line options may be specified here, and the
3131
configuration file will be added at the end of the command-line.
32-
Currently lighttpd, apache2 and webrick are supported.
32+
Currently apache2, lighttpd, mongoose and webrick are supported.
3333
(Default: lighttpd)
3434

3535
-m::

git-instaweb.sh

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,30 @@ start_httpd () {
7777
resolve_full_httpd
7878

7979
# don't quote $full_httpd, there can be arguments to it (-f)
80-
$full_httpd "$fqgitdir/gitweb/httpd.conf"
81-
if test $? != 0; then
82-
echo "Could not execute http daemon $httpd."
83-
exit 1
84-
fi
80+
case "$httpd" in
81+
*mongoose*)
82+
#The mongoose server doesn't have a daemon mode so we'll have to fork it
83+
$full_httpd "$fqgitdir/gitweb/httpd.conf" &
84+
#Save the pid before doing anything else (we'll print it later)
85+
pid=$!
86+
87+
if test $? != 0; then
88+
echo "Could not execute http daemon $httpd."
89+
exit 1
90+
fi
91+
92+
cat > "$fqgitdir/pid" <<EOF
93+
$pid
94+
EOF
95+
;;
96+
*)
97+
$full_httpd "$fqgitdir/gitweb/httpd.conf"
98+
if test $? != 0; then
99+
echo "Could not execute http daemon $httpd."
100+
exit 1
101+
fi
102+
;;
103+
esac
85104
}
86105

87106
stop_httpd () {
@@ -308,6 +327,31 @@ EOF
308327
fi
309328
}
310329

330+
mongoose_conf() {
331+
cat > "$conf" <<EOF
332+
# Mongoose web server configuration file.
333+
# Lines starting with '#' and empty lines are ignored.
334+
# For detailed description of every option, visit
335+
# http://code.google.com/p/mongoose/wiki/MongooseManual
336+
337+
root $fqgitdir/gitweb
338+
ports $port
339+
index_files gitweb.cgi
340+
#ssl_cert $fqgitdir/gitweb/ssl_cert.pem
341+
error_log $fqgitdir/gitweb/error.log
342+
access_log $fqgitdir/gitweb/access.log
343+
344+
#cgi setup
345+
cgi_env PATH=/usr/local/bin:/usr/bin:/bin,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH
346+
cgi_interp $PERL
347+
cgi_ext cgi,pl
348+
349+
# mimetype mapping
350+
mime_types .gz=application/x-gzip,.tar.gz=application/x-tgz,.tgz=application/x-tgz,.tar=application/x-tar,.zip=application/zip,.gif=image/gif,.jpg=image/jpeg,.jpeg=image/jpeg,.png=image/png,.css=text/css,.html=text/html,.htm=text/html,.js=text/javascript,.c=text/plain,.cpp=text/plain,.log=text/plain,.conf=text/plain,.text=text/plain,.txt=text/plain,.dtd=text/xml,.bz2=application/x-bzip,.tbz=application/x-bzip-compressed-tar,.tar.bz2=application/x-bzip-compressed-tar
351+
EOF
352+
}
353+
354+
311355
script='
312356
s#^(my|our) \$projectroot =.*#$1 \$projectroot = "'$(dirname "$fqgitdir")'";#;
313357
s#(my|our) \$gitbin =.*#$1 \$gitbin = "'$GIT_EXEC_PATH'";#;
@@ -344,6 +388,9 @@ case "$httpd" in
344388
webrick)
345389
webrick_conf
346390
;;
391+
*mongoose*)
392+
mongoose_conf
393+
;;
347394
*)
348395
echo "Unknown httpd specified: $httpd"
349396
exit 1

0 commit comments

Comments
 (0)