new-run-webkit-websocketserver must handle TLS related arguments
authortoyoshim@chromium.org <toyoshim@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Jun 2012 18:06:39 +0000 (18:06 +0000)
committertoyoshim@chromium.org <toyoshim@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Jun 2012 18:06:39 +0000 (18:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89079

Reviewed by Dirk Pranke.

PyWebSocket class must accept private_key, certificate, and
ca_certificate arguments and pass them to launching pywebsocket.
Also add ca_certificate handling to new-run-webkit-websocketserver.

* Scripts/new-run-webkit-websocketserver:
(main):
* Scripts/webkitpy/layout_tests/servers/websocket_server.py:
(PyWebSocket.__init__):
(PyWebSocket._prepare_config):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120342 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/new-run-webkit-websocketserver
Tools/Scripts/webkitpy/layout_tests/servers/websocket_server.py

index 01bf757..0cf8fd9 100644 (file)
@@ -1,3 +1,20 @@
+2012-06-14  Takashi Toyoshima  <toyoshim@chromium.org>
+
+        new-run-webkit-websocketserver must handle TLS related arguments
+        https://bugs.webkit.org/show_bug.cgi?id=89079
+
+        Reviewed by Dirk Pranke.
+
+        PyWebSocket class must accept private_key, certificate, and
+        ca_certificate arguments and pass them to launching pywebsocket.
+        Also add ca_certificate handling to new-run-webkit-websocketserver.
+
+        * Scripts/new-run-webkit-websocketserver:
+        (main):
+        * Scripts/webkitpy/layout_tests/servers/websocket_server.py:
+        (PyWebSocket.__init__):
+        (PyWebSocket._prepare_config):
+
 2012-06-14  Qi Zhang  <qi.2.zhang@nokia.com>
 
         Unreviewed. Update my email.
 2012-06-14  Qi Zhang  <qi.2.zhang@nokia.com>
 
         Unreviewed. Update my email.
index b888004..15ed1f9 100755 (executable)
@@ -55,6 +55,9 @@ def main():
                              default='', help='TLS private key file.')
     option_parser.add_option('-c', '--certificate', dest='certificate',
                              default='', help='TLS certificate file.')
                              default='', help='TLS private key file.')
     option_parser.add_option('-c', '--certificate', dest='certificate',
                              default='', help='TLS certificate file.')
+    option_parser.add_option('--ca-certificate', dest='ca_certificate',
+                             default='', help='TLS CA certificate file for '
+                                              'client authentication.')
     option_parser.add_option('--chromium', action='store_true',
                              dest='chromium',
                              default=False,
     option_parser.add_option('--chromium', action='store_true',
                              dest='chromium',
                              default=False,
@@ -88,6 +91,8 @@ def main():
         kwds['private_key'] = options.private_key
     if options.certificate:
         kwds['certificate'] = options.certificate
         kwds['private_key'] = options.private_key
     if options.certificate:
         kwds['certificate'] = options.certificate
+    if options.ca_certificate:
+        kwds['ca_certificate'] = options.ca_certificate
     if options.pidfile:
         kwds['pidfile'] = options.pidfile
 
     if options.pidfile:
         kwds['pidfile'] = options.pidfile
 
index 296ab98..93747f6 100644 (file)
@@ -51,6 +51,7 @@ _DEFAULT_WSS_PORT = 9323
 class PyWebSocket(http_server.Lighttpd):
     def __init__(self, port_obj, output_dir, port=_DEFAULT_WS_PORT,
                  root=None, use_tls=False,
 class PyWebSocket(http_server.Lighttpd):
     def __init__(self, port_obj, output_dir, port=_DEFAULT_WS_PORT,
                  root=None, use_tls=False,
+                 private_key=None, certificate=None, ca_certificate=None,
                  pidfile=None):
         """Args:
           output_dir: the absolute path to the layout test result directory
                  pidfile=None):
         """Args:
           output_dir: the absolute path to the layout test result directory
@@ -70,8 +71,15 @@ class PyWebSocket(http_server.Lighttpd):
         if self._use_tls:
             self._name = 'pywebsocket_secure'
 
         if self._use_tls:
             self._name = 'pywebsocket_secure'
 
-        self._private_key = self._pem_file
-        self._certificate = self._pem_file
+        if private_key:
+            self._private_key = private_key
+        else:
+            self._private_key = self._pem_file
+        if certificate:
+            self._certificate = certificate
+        else:
+            self._certificate = self._pem_file
+        self._ca_certificate = ca_certificate
         if self._port:
             self._port = int(self._port)
         self._wsin = None
         if self._port:
             self._port = int(self._port)
         self._wsin = None
@@ -137,6 +145,9 @@ class PyWebSocket(http_server.Lighttpd):
         if self._use_tls:
             start_cmd.extend(['-t', '-k', self._private_key,
                               '-c', self._certificate])
         if self._use_tls:
             start_cmd.extend(['-t', '-k', self._private_key,
                               '-c', self._certificate])
+            if self._ca_certificate:
+                start_cmd.append('--ca-certificate')
+                start_cmd.append(self._ca_certificate)
 
         self._start_cmd = start_cmd
         server_name = self._filesystem.basename(pywebsocket_script)
 
         self._start_cmd = start_cmd
         server_name = self._filesystem.basename(pywebsocket_script)