summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsca-cpp/trunk/components/cache/server-test2
-rwxr-xr-xsca-cpp/trunk/components/chat/server-test2
-rwxr-xr-xsca-cpp/trunk/components/queue/server-test2
-rwxr-xr-xsca-cpp/trunk/components/webservice/server-test2
-rwxr-xr-xsca-cpp/trunk/modules/http/http-test2
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-ca-conf5
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-cert-conf3
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-conf6
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-ssl-conf19
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-test2
-rwxr-xr-xsca-cpp/trunk/modules/java/server-test2
-rwxr-xr-xsca-cpp/trunk/modules/java/wiring-test2
-rwxr-xr-xsca-cpp/trunk/modules/python/server-test2
-rwxr-xr-xsca-cpp/trunk/modules/python/wiring-test2
-rwxr-xr-xsca-cpp/trunk/modules/server/httpd-test2
-rwxr-xr-xsca-cpp/trunk/modules/server/server-test2
-rwxr-xr-xsca-cpp/trunk/modules/server/wiring-test2
-rw-r--r--sca-cpp/trunk/modules/wsgi/httputil.py32
-rwxr-xr-xsca-cpp/trunk/test/store-cpp/ssl-start8
-rwxr-xr-xsca-cpp/trunk/test/store-cpp/start2
-rwxr-xr-xsca-cpp/trunk/test/store-java/ssl-start8
-rwxr-xr-xsca-cpp/trunk/test/store-java/start2
-rwxr-xr-xsca-cpp/trunk/test/store-python/ssl-start8
-rwxr-xr-xsca-cpp/trunk/test/store-python/start2
-rwxr-xr-xsca-cpp/trunk/test/store-scheme/ssl-start8
-rwxr-xr-xsca-cpp/trunk/test/store-scheme/start2
-rw-r--r--sca-cpp/trunk/test/store-wsgi/htpasswd.py21
27 files changed, 90 insertions, 62 deletions
diff --git a/sca-cpp/trunk/components/cache/server-test b/sca-cpp/trunk/components/cache/server-test
index a77736f33c..5c86b75ebc 100755
--- a/sca-cpp/trunk/components/cache/server-test
+++ b/sca-cpp/trunk/components/cache/server-test
@@ -18,7 +18,7 @@
# under the License.
# Setup
-../../modules/http/httpd-conf tmp 8090 ../../modules/http/htdocs
+../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/components/chat/server-test b/sca-cpp/trunk/components/chat/server-test
index 919a798fa5..dd1dc6faa7 100755
--- a/sca-cpp/trunk/components/chat/server-test
+++ b/sca-cpp/trunk/components/chat/server-test
@@ -18,7 +18,7 @@
# under the License.
# Setup
-../../modules/http/httpd-conf tmp 8090 ../../modules/http/htdocs
+../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/components/queue/server-test b/sca-cpp/trunk/components/queue/server-test
index 3fc94e6f35..571b09082c 100755
--- a/sca-cpp/trunk/components/queue/server-test
+++ b/sca-cpp/trunk/components/queue/server-test
@@ -18,7 +18,7 @@
# under the License.
# Setup
-../../modules/http/httpd-conf tmp 8090 ../../modules/http/htdocs
+../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/components/webservice/server-test b/sca-cpp/trunk/components/webservice/server-test
index 8311b94220..34fdb7266a 100755
--- a/sca-cpp/trunk/components/webservice/server-test
+++ b/sca-cpp/trunk/components/webservice/server-test
@@ -18,7 +18,7 @@
# under the License.
# Setup
-../../modules/http/httpd-conf tmp 8090 ../../modules/http/htdocs
+../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
./axis2-conf tmp
diff --git a/sca-cpp/trunk/modules/http/http-test b/sca-cpp/trunk/modules/http/http-test
index 9f65b37eec..0db47fe189 100755
--- a/sca-cpp/trunk/modules/http/http-test
+++ b/sca-cpp/trunk/modules/http/http-test
@@ -18,7 +18,7 @@
# under the License.
# Setup
-./httpd-conf tmp 8090 htdocs
+./httpd-conf tmp localhost 8090 htdocs
./httpd-start tmp
sleep 2
diff --git a/sca-cpp/trunk/modules/http/httpd-ca-conf b/sca-cpp/trunk/modules/http/httpd-ca-conf
index 20efb441b5..f59ff71d46 100755
--- a/sca-cpp/trunk/modules/http/httpd-ca-conf
+++ b/sca-cpp/trunk/modules/http/httpd-ca-conf
@@ -21,11 +21,8 @@
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
host=$2
-if [ "$host" = "" ]; then
- host=`hostname -f`
-fi
-# Don't regenerate the certificate if it already exists
+# Don't override existing certificate
if [ -f $root/conf/ca.crt ]; then
return 0
fi
diff --git a/sca-cpp/trunk/modules/http/httpd-cert-conf b/sca-cpp/trunk/modules/http/httpd-cert-conf
index be357554fb..7bf22d4668 100755
--- a/sca-cpp/trunk/modules/http/httpd-cert-conf
+++ b/sca-cpp/trunk/modules/http/httpd-cert-conf
@@ -21,9 +21,6 @@
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
host=$2
-if [ "$host" = "" ]; then
- host=`hostname -f`
-fi
# Don't regenerate the certificate if it already exists
if [ -f $root/conf/server.crt ]; then
diff --git a/sca-cpp/trunk/modules/http/httpd-conf b/sca-cpp/trunk/modules/http/httpd-conf
index 3ed27c6680..fa3ce09fc9 100755
--- a/sca-cpp/trunk/modules/http/httpd-conf
+++ b/sca-cpp/trunk/modules/http/httpd-conf
@@ -20,9 +20,9 @@
# Generate a minimal HTTPD configuration
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
-port=$2
-htdocs=`readlink -f $3`
-host=`hostname -f`
+host=$2
+port=$3
+htdocs=`readlink -f $4`
user=`id -un`
group=`id -gn`
diff --git a/sca-cpp/trunk/modules/http/httpd-ssl-conf b/sca-cpp/trunk/modules/http/httpd-ssl-conf
index 6660ad9792..b064dc02dc 100755
--- a/sca-cpp/trunk/modules/http/httpd-ssl-conf
+++ b/sca-cpp/trunk/modules/http/httpd-ssl-conf
@@ -20,13 +20,9 @@
# Generate a minimal HTTPD SSL configuration
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
-port=$2
-if [ "$port" != "80" ]; then
- sslport=`echo "$port + 443" | bc`
-else
- sslport="443"
-fi
-host=`hostname -f`
+host=$2
+sslport=$3
+htdocs=`readlink -f $4`
# Extract organization name from our CA certificate
org=`openssl x509 -noout -subject -nameopt multiline -in $root/conf/ca.crt | grep organizationName | awk -F "= " '{ print $2 }'`
@@ -61,7 +57,12 @@ SSLCACertificateFile "$root/conf/ca.crt"
SSLCertificateFile "$root/conf/server.crt"
SSLCertificateKeyFile "$root/conf/server.key"
BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
+
+# Logging
CustomLog "$root/logs/ssl_request_log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
+LogFormat "%h %l %u %t %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" sslcombined
+CustomLog $root/logs/ssl_access_log sslcombined
+LogLevel warn
# Require clients to present either:
# a certificate signed with our CA certificate of authority
@@ -91,9 +92,7 @@ SCASSLCertificateKeyFile "$root/conf/server.key"
EOF
# Create test users for HTTP basic authentication
-htpasswd -bc $root/conf/httpd.passwd admin admin 2>/dev/null
-htpasswd -b $root/conf/httpd.passwd user password 2>/dev/null
-htpasswd -b $root/conf/httpd.passwd test test 2>/dev/null
+htpasswd -bc $root/conf/httpd.passwd test test 2>/dev/null
htpasswd -b $root/conf/httpd.passwd foo foo 2>/dev/null
htpasswd -b $root/conf/httpd.passwd bar bar 2>/dev/null
diff --git a/sca-cpp/trunk/modules/http/httpd-test b/sca-cpp/trunk/modules/http/httpd-test
index 952a58937a..ca6b3e19a1 100755
--- a/sca-cpp/trunk/modules/http/httpd-test
+++ b/sca-cpp/trunk/modules/http/httpd-test
@@ -20,7 +20,7 @@
echo "Testing..."
# Setup
-./httpd-conf tmp 8090 htdocs
+./httpd-conf tmp localhost 8090 htdocs
./httpd-start tmp
sleep 2
diff --git a/sca-cpp/trunk/modules/java/server-test b/sca-cpp/trunk/modules/java/server-test
index fbd12e5542..dba63a9525 100755
--- a/sca-cpp/trunk/modules/java/server-test
+++ b/sca-cpp/trunk/modules/java/server-test
@@ -18,7 +18,7 @@
# under the License.
# Setup
-../http/httpd-conf tmp 8090 ../server/htdocs
+../http/httpd-conf tmp localhost 8090 ../server/htdocs
../server/server-conf tmp
./java-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/modules/java/wiring-test b/sca-cpp/trunk/modules/java/wiring-test
index c0b6cbfd62..1300f56ffb 100755
--- a/sca-cpp/trunk/modules/java/wiring-test
+++ b/sca-cpp/trunk/modules/java/wiring-test
@@ -20,7 +20,7 @@
echo "Testing..."
# Setup
-../http/httpd-conf tmp 8090 ../server/htdocs
+../http/httpd-conf tmp localhost 8090 ../server/htdocs
../server/server-conf tmp
./java-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/modules/python/server-test b/sca-cpp/trunk/modules/python/server-test
index fe1ff7a486..b01f5f501d 100755
--- a/sca-cpp/trunk/modules/python/server-test
+++ b/sca-cpp/trunk/modules/python/server-test
@@ -18,7 +18,7 @@
# under the License.
# Setup
-../http/httpd-conf tmp 8090 ../server/htdocs
+../http/httpd-conf tmp localhost 8090 ../server/htdocs
../server/server-conf tmp
./python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/modules/python/wiring-test b/sca-cpp/trunk/modules/python/wiring-test
index a3c85838fd..9f2aae342d 100755
--- a/sca-cpp/trunk/modules/python/wiring-test
+++ b/sca-cpp/trunk/modules/python/wiring-test
@@ -20,7 +20,7 @@
echo "Testing..."
# Setup
-../http/httpd-conf tmp 8090 ../server/htdocs
+../http/httpd-conf tmp localhost 8090 ../server/htdocs
../server/server-conf tmp
./python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/modules/server/httpd-test b/sca-cpp/trunk/modules/server/httpd-test
index 86718f96c5..8ab3000f2a 100755
--- a/sca-cpp/trunk/modules/server/httpd-test
+++ b/sca-cpp/trunk/modules/server/httpd-test
@@ -20,7 +20,7 @@
echo "Testing..."
# Setup
-../http/httpd-conf tmp 8090 htdocs
+../http/httpd-conf tmp localhost 8090 htdocs
./server-conf tmp
./scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/modules/server/server-test b/sca-cpp/trunk/modules/server/server-test
index e1d9932a5d..e53c7f5ef1 100755
--- a/sca-cpp/trunk/modules/server/server-test
+++ b/sca-cpp/trunk/modules/server/server-test
@@ -18,7 +18,7 @@
# under the License.
# Setup
-../http/httpd-conf tmp 8090 htdocs
+../http/httpd-conf tmp localhost 8090 htdocs
./server-conf tmp
./scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/modules/server/wiring-test b/sca-cpp/trunk/modules/server/wiring-test
index 0deab33d68..ae4dce51e4 100755
--- a/sca-cpp/trunk/modules/server/wiring-test
+++ b/sca-cpp/trunk/modules/server/wiring-test
@@ -20,7 +20,7 @@
echo "Testing..."
# Setup
-../http/httpd-conf tmp 8090 htdocs
+../http/httpd-conf tmp localhost 8090 htdocs
./server-conf tmp
./scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/modules/wsgi/httputil.py b/sca-cpp/trunk/modules/wsgi/httputil.py
index 92da7ec09c..77d19eabe2 100644
--- a/sca-cpp/trunk/modules/wsgi/httputil.py
+++ b/sca-cpp/trunk/modules/wsgi/httputil.py
@@ -22,6 +22,9 @@ from httplib import HTTPConnection, HTTPSConnection
from urlparse import urlparse
from StringIO import StringIO
import os.path
+from string import strip
+from base64 import b64encode
+from sys import stderr
from util import *
from atomutil import *
from jsonutil import *
@@ -34,24 +37,35 @@ class client:
self.uri = urlparse(uri)
def __call__(self, func, *args):
- global id
- req = StringIO()
- writeStrings(jsonRequest(id, func, args), req)
- id = id + 1
- print "HTTP connect:", self.uri.hostname
+
+ # Connect to the configured URI
+ print >> stderr, "Client POST", self.uri.geturl()
c = None
+ headers = {"Content-type": "application/json-rpc"}
if self.uri.scheme == "https":
+
+ # With HTTPS, use a cerficate or HTTP basic authentication
if os.path.exists("server.key"):
c = HTTPSConnection(self.uri.hostname, 443 if self.uri.port == None else self.uri.port, "server.key", "server.crt")
else:
c = HTTPSConnection(self.uri.hostname, 443 if self.uri.port == None else self.uri.port)
+
+ # For HTTP basic authentication the user and password are
+ # provided by htpasswd.py
+ import htpasswd
+ auth = 'Basic ' + b64encode(htpasswd.user + ':' + htpasswd.passwd)
+ headers["Authorization"] = auth
else:
c = HTTPConnection(self.uri.hostname, 80 if self.uri.port == None else self.uri.port)
- print "HTTP connection:", c
- c.request("POST", self.uri.path, req.getvalue(), {"Content-type": "application/json-rpc"})
+
+ # POST the JSON-RPC request
+ global id
+ req = StringIO()
+ writeStrings(jsonRequest(id, func, args), req)
+ id = id + 1
+ c.request("POST", self.uri.path, req.getvalue(), headers)
res = c.getresponse()
- print "HTTP response:", res
- print "HTTP status:", res.status
+ print >> stderr, "Client status", res.status
if res.status != 200:
return None
return jsonResultValue((res.read(),))
diff --git a/sca-cpp/trunk/test/store-cpp/ssl-start b/sca-cpp/trunk/test/store-cpp/ssl-start
index 7ce9e86680..9cb5b88974 100755
--- a/sca-cpp/trunk/test/store-cpp/ssl-start
+++ b/sca-cpp/trunk/test/store-cpp/ssl-start
@@ -17,10 +17,10 @@
# specific language governing permissions and limitations
# under the License.
-../../modules/http/httpd-ca-conf tmp
-../../modules/http/httpd-cert-conf tmp
-../../modules/http/httpd-conf tmp 8090 htdocs
-../../modules/http/httpd-ssl-conf tmp 8090
+../../modules/http/httpd-ca-conf tmp localhost
+../../modules/http/httpd-cert-conf tmp localhost
+../../modules/http/httpd-conf tmp localhost 8090 htdocs
+../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
../../modules/server/server-conf tmp
../../modules/server/cpp-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/test/store-cpp/start b/sca-cpp/trunk/test/store-cpp/start
index 4760dccbc3..7b9c0d6379 100755
--- a/sca-cpp/trunk/test/store-cpp/start
+++ b/sca-cpp/trunk/test/store-cpp/start
@@ -17,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
-../../modules/http/httpd-conf tmp 8090 htdocs
+../../modules/http/httpd-conf tmp localhost 8090 htdocs
../../modules/server/server-conf tmp
../../modules/server/cpp-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/test/store-java/ssl-start b/sca-cpp/trunk/test/store-java/ssl-start
index 314210359c..ec44ba1ac0 100755
--- a/sca-cpp/trunk/test/store-java/ssl-start
+++ b/sca-cpp/trunk/test/store-java/ssl-start
@@ -17,10 +17,10 @@
# specific language governing permissions and limitations
# under the License.
-../../modules/http/httpd-ca-conf tmp
-../../modules/http/httpd-cert-conf tmp
-../../modules/http/httpd-conf tmp 8090 htdocs
-../../modules/http/httpd-ssl-conf tmp 8090
+../../modules/http/httpd-ca-conf tmp localhost
+../../modules/http/httpd-cert-conf tmp localhost
+../../modules/http/httpd-conf tmp localhost 8090 htdocs
+../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
../../modules/server/server-conf tmp
../../modules/java/java-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/test/store-java/start b/sca-cpp/trunk/test/store-java/start
index 7f5823ed66..c8146e9e46 100755
--- a/sca-cpp/trunk/test/store-java/start
+++ b/sca-cpp/trunk/test/store-java/start
@@ -17,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
-../../modules/http/httpd-conf tmp 8090 htdocs
+../../modules/http/httpd-conf tmp localhost 8090 htdocs
../../modules/server/server-conf tmp
../../modules/java/java-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/test/store-python/ssl-start b/sca-cpp/trunk/test/store-python/ssl-start
index c240e58d09..1e70d6edfb 100755
--- a/sca-cpp/trunk/test/store-python/ssl-start
+++ b/sca-cpp/trunk/test/store-python/ssl-start
@@ -17,10 +17,10 @@
# specific language governing permissions and limitations
# under the License.
-../../modules/http/httpd-ca-conf tmp
-../../modules/http/httpd-cert-conf tmp
-../../modules/http/httpd-conf tmp 8090 htdocs
-../../modules/http/httpd-ssl-conf tmp 8090
+../../modules/http/httpd-ca-conf tmp localhost
+../../modules/http/httpd-cert-conf tmp localhost
+../../modules/http/httpd-conf tmp localhost 8090 htdocs
+../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/test/store-python/start b/sca-cpp/trunk/test/store-python/start
index 2874d5c3e6..8df7875634 100755
--- a/sca-cpp/trunk/test/store-python/start
+++ b/sca-cpp/trunk/test/store-python/start
@@ -17,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
-../../modules/http/httpd-conf tmp 8090 htdocs
+../../modules/http/httpd-conf tmp localhost 8090 htdocs
../../modules/server/server-conf tmp
../../modules/python/python-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/test/store-scheme/ssl-start b/sca-cpp/trunk/test/store-scheme/ssl-start
index 3d96c3b257..14b85f5342 100755
--- a/sca-cpp/trunk/test/store-scheme/ssl-start
+++ b/sca-cpp/trunk/test/store-scheme/ssl-start
@@ -17,10 +17,10 @@
# specific language governing permissions and limitations
# under the License.
-../../modules/http/httpd-ca-conf tmp
-../../modules/http/httpd-cert-conf tmp
-../../modules/http/httpd-conf tmp 8090 htdocs
-../../modules/http/httpd-ssl-conf tmp 8090
+../../modules/http/httpd-ca-conf tmp localhost
+../../modules/http/httpd-cert-conf tmp localhost
+../../modules/http/httpd-conf tmp localhost 8090 htdocs
+../../modules/http/httpd-ssl-conf tmp localhost 8453 htdocs
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/test/store-scheme/start b/sca-cpp/trunk/test/store-scheme/start
index 51c74fbea3..ffd7173ee2 100755
--- a/sca-cpp/trunk/test/store-scheme/start
+++ b/sca-cpp/trunk/test/store-scheme/start
@@ -17,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
-../../modules/http/httpd-conf tmp 8090 htdocs
+../../modules/http/httpd-conf tmp localhost 8090 htdocs
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
diff --git a/sca-cpp/trunk/test/store-wsgi/htpasswd.py b/sca-cpp/trunk/test/store-wsgi/htpasswd.py
new file mode 100644
index 0000000000..75d94f58b6
--- /dev/null
+++ b/sca-cpp/trunk/test/store-wsgi/htpasswd.py
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Configure the user and password used for HTTP basic authentication
+user = "foo"
+passwd = "foo"
+