2010-01-14 Yuzo Fujishima <yuzo@google.com>
authorukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jan 2010 04:56:47 +0000 (04:56 +0000)
committerukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jan 2010 04:56:47 +0000 (04:56 +0000)
        Reviewed by Alexey Proskuryakov.

        Update pywebsocket to 0.4.6
        https://bugs.webkit.org/show_bug.cgi?id=32299
        The newer pywebsocket can handle more simultaneous connections.

        * pywebsocket/mod_pywebsocket/handshake.py:
        * pywebsocket/mod_pywebsocket/standalone.py:
        * pywebsocket/setup.py:
        * pywebsocket/test/test_handshake.py:

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

WebKitTools/ChangeLog
WebKitTools/pywebsocket/mod_pywebsocket/handshake.py
WebKitTools/pywebsocket/mod_pywebsocket/standalone.py
WebKitTools/pywebsocket/setup.py
WebKitTools/pywebsocket/test/test_handshake.py

index ce81239..d0dd55c 100644 (file)
@@ -1,3 +1,16 @@
+2010-01-14  Yuzo Fujishima  <yuzo@google.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Update pywebsocket to 0.4.6
+        https://bugs.webkit.org/show_bug.cgi?id=32299
+        The newer pywebsocket can handle more simultaneous connections.
+
+        * pywebsocket/mod_pywebsocket/handshake.py:
+        * pywebsocket/mod_pywebsocket/standalone.py:
+        * pywebsocket/setup.py:
+        * pywebsocket/test/test_handshake.py:
+
 2010-01-14  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Adam Barth.
index 14d5afc..50d8c80 100644 (file)
@@ -63,17 +63,15 @@ _FIRST_FIVE_LINES = map(re.compile, [
     r'^Origin: [\S]+\r\n$',
 ])
 
-# FIXME: Cookie headers also being in restricted WebSocket syntax.
 _SIXTH_AND_LATER = re.compile(
     r'^'
     r'(WebSocket-Protocol: [\x20-\x7e]+\r\n)?'
-    r'([Cc][Oo][Oo][Kk][Ii][Ee]:[^\r]*\r\n)*'
-    r'([Cc][Oo][Oo][Kk][Ii][Ee]2:[^\r]*\r\n)?'
-    r'([Cc][Oo][Oo][Kk][Ii][Ee]:[^\r]*\r\n)*'
+    r'(Cookie: [^\r]*\r\n)*'
+    r'(Cookie2: [^\r]*\r\n)?'
+    r'(Cookie: [^\r]*\r\n)*'
     r'\r\n')
 
 
-
 def _default_port(is_secure):
     if is_secure:
         return _DEFAULT_WEB_SOCKET_SECURE_PORT
index 0a1736e..9822a75 100644 (file)
@@ -89,6 +89,8 @@ _LOG_LEVELS = {
 _DEFAULT_LOG_MAX_BYTES = 1024 * 256
 _DEFAULT_LOG_BACKUP_COUNT = 5
 
+_DEFAULT_REQUEST_QUEUE_SIZE = 128
+
 # 1024 is practically large enough to contain WebSocket handshake lines.
 _MAX_MEMORIZED_LINES = 1024
 
@@ -314,12 +316,17 @@ def _main():
                       help='Log backup count')
     parser.add_option('--strict', dest='strict', action='store_true',
                       default=False, help='Strictly check handshake request')
+    parser.add_option('-q', '--queue', dest='request_queue_size', type='int',
+                      default=_DEFAULT_REQUEST_QUEUE_SIZE,
+                      help='request queue size')
     options = parser.parse_args()[0]
 
     os.chdir(options.document_root)
 
     _configure_logging(options)
 
+    SocketServer.TCPServer.request_queue_size = options.request_queue_size
+
     if options.use_tls:
         if not _HAS_OPEN_SSL:
             logging.critical('To use TLS, install pyOpenSSL.')
index d552d91..6f6acc6 100644 (file)
@@ -56,7 +56,7 @@ setup(author='Yuzo Fujishima',
       name=_PACKAGE_NAME,
       packages=[_PACKAGE_NAME],
       url='http://code.google.com/p/pywebsocket/',
-      version='0.4.5',
+      version='0.4.6',
       )
 
 
index c4c4590..1d69b2d 100644 (file)
@@ -348,6 +348,24 @@ _NOT_STRICTLY_GOOD_REQUESTS = (
         ' defg\r\n',
         '\r\n',
     ),
+    (  # Wrong-case cookie
+        'GET /demo HTTP/1.1\r\n',
+        'Upgrade: WebSocket\r\n',
+        'Connection: Upgrade\r\n',
+        'Host: example.com\r\n',
+        'Origin: http://example.com\r\n',
+        'cookie: abc/xyz\r\n'
+        '\r\n',
+    ),
+    (  # Cookie, no space after colon
+        'GET /demo HTTP/1.1\r\n',
+        'Upgrade: WebSocket\r\n',
+        'Connection: Upgrade\r\n',
+        'Host: example.com\r\n',
+        'Origin: http://example.com\r\n',
+        'Cookie:abc/xyz\r\n'
+        '\r\n',
+    ),
 )