3 # Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
6 if test -z "$GIT_TEST_HTTPD"
8 say
"skipping test, network testing disabled by default"
9 say
"(define GIT_TEST_HTTPD to enable)"
14 LIB_HTTPD_PATH
=${LIB_HTTPD_PATH-'/usr/sbin/apache2'}
15 LIB_HTTPD_PORT
=${LIB_HTTPD_PORT-'8111'}
17 TEST_PATH
="$PWD"/..
/lib-httpd
18 HTTPD_ROOT_PATH
="$PWD"/httpd
19 HTTPD_DOCUMENT_ROOT_PATH
=$HTTPD_ROOT_PATH/www
21 if ! test -x "$LIB_HTTPD_PATH"
23 say
"skipping test, no web server found at '$LIB_HTTPD_PATH'"
28 HTTPD_VERSION
=`$LIB_HTTPD_PATH -v | \
29 sed -n 's/^Server version: Apache\/\([0-9]*\)\..*$/\1/p; q'`
31 if test -n "$HTTPD_VERSION"
33 if test -z "$LIB_HTTPD_MODULE_PATH"
35 if ! test $HTTPD_VERSION -ge 2
37 say
"skipping test, at least Apache version 2 is required"
42 LIB_HTTPD_MODULE_PATH
='/usr/lib/apache2/modules'
45 error
"Could not identify web server at '$LIB_HTTPD_PATH'"
48 HTTPD_PARA
="-d $HTTPD_ROOT_PATH -f $TEST_PATH/apache.conf"
51 mkdir
-p $HTTPD_DOCUMENT_ROOT_PATH
53 ln -s $LIB_HTTPD_MODULE_PATH $HTTPD_ROOT_PATH/modules
55 if test -n "$LIB_HTTPD_SSL"
57 HTTPD_URL
=https
://127.0.0.1:$LIB_HTTPD_PORT
59 RANDFILE_PATH
="$HTTPD_ROOT_PATH"/.rnd openssl req \
60 -config $TEST_PATH/ssl.cnf \
62 -out $HTTPD_ROOT_PATH/httpd.pem \
63 -keyout $HTTPD_ROOT_PATH/httpd.pem
65 export GIT_SSL_NO_VERIFY
66 HTTPD_PARA
="$HTTPD_PARA -DSSL"
68 HTTPD_URL
=http
://127.0.0.1:$LIB_HTTPD_PORT
71 if test -n "$LIB_HTTPD_DAV" -o -n "$LIB_HTTPD_SVN"
73 HTTPD_PARA
="$HTTPD_PARA -DDAV"
75 if test -n "$LIB_HTTPD_SVN"
77 HTTPD_PARA
="$HTTPD_PARA -DSVN"
78 rawsvnrepo
="$HTTPD_ROOT_PATH/svnrepo"
79 svnrepo
="http://127.0.0.1:$LIB_HTTPD_PORT/svn"
87 trap 'stop_httpd; die' exit
89 "$LIB_HTTPD_PATH" $HTTPD_PARA \
90 -c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start
96 "$LIB_HTTPD_PATH" $HTTPD_PARA -k stop