Changeset 55719 in webkit
- Timestamp:
- Mar 9, 2010 2:40:49 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 1 deleted
- 11 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r55711 r55719 1 2010-03-03 Fumitoshi Ukai <ukai@chromium.org> 2 3 Reviewed by Alexey Proskuryakov. 4 5 pywebsocket should support html and cgi in the same directory. 6 https://bugs.webkit.org/show_bug.cgi?id=34879 7 8 * websocket/tests/cookies: Removed. 9 * websocket/tests/cookies/echo-cookie_wsh.py: Removed. 10 * websocket/tests/cookies/httponly-cookie-expected.txt: Removed. 11 * websocket/tests/cookies/httponly-cookie.pl: Removed. 12 * websocket/tests/echo-cookie_wsh.py: Copied from LayoutTests/websocket/tests/cookies/echo-cookie_wsh.py. 13 * websocket/tests/httponly-cookie-expected.txt: Copied from LayoutTests/websocket/tests/cookies/httponly-cookie-expected.txt. 14 * websocket/tests/httponly-cookie.pl: Copied from LayoutTests/websocket/tests/cookies/httponly-cookie.pl. 15 1 16 2010-03-08 Kent Tamura <tkent@chromium.org> 2 17 -
trunk/LayoutTests/websocket/tests/httponly-cookie.pl
r55360 r55719 9 9 <html> 10 10 <head> 11 <script src="../../ ../fast/js/resources/js-test-pre.js"></script>12 <script src="../../ ../fast/js/resources/js-test-post-function.js"></script>11 <script src="../../fast/js/resources/js-test-pre.js"></script> 12 <script src="../../fast/js/resources/js-test-post-function.js"></script> 13 13 </head> 14 14 <body> … … 32 32 } 33 33 34 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/ cookies/echo-cookie");34 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/echo-cookie"); 35 35 ws.onopen = function() { 36 36 debug("WebSocket open"); -
trunk/WebKitTools/ChangeLog
r55715 r55719 1 2010-03-03 Fumitoshi Ukai <ukai@chromium.org> 2 3 Reviewed by Alexey Proskuryakov. 4 5 pywebsocket should support html and cgi in the same directory. 6 https://bugs.webkit.org/show_bug.cgi?id=34879 7 8 Import pywebsocket 0.4.9.2 9 Specify --server-host 127.0.0.1, so that it only binds listening socket 10 to 127.0.0.1 to prevent access from non-localhost. 11 Change --cgi-paths from /websocket/tests/cookies to /websocket/tests, 12 because pywebsocket 0.4.9.2 supports html and cgi in the same directory 13 and only executable (httponly-cookies.pl) will be handled as cgi 14 script. 15 16 * Scripts/run-webkit-tests: 17 * Scripts/run-webkit-websocketserver: 18 * Scripts/webkitpy/layout_tests/port/websocket_server.py: 19 * Scripts/webkitpy/thirdparty/pywebsocket/README.webkit: 20 * Scripts/webkitpy/thirdparty/pywebsocket/example/echo_client.py: 21 * Scripts/webkitpy/thirdparty/pywebsocket/example/handler_map.txt: Added. 22 * Scripts/webkitpy/thirdparty/pywebsocket/mod_pywebsocket/standalone.py: 23 * Scripts/webkitpy/thirdparty/pywebsocket/mod_pywebsocket/util.py: 24 * Scripts/webkitpy/thirdparty/pywebsocket/setup.py: 25 * Scripts/webkitpy/thirdparty/pywebsocket/test/test_util.py: 26 * Scripts/webkitpy/thirdparty/pywebsocket/test/testdata/README: Added. 27 * Scripts/webkitpy/thirdparty/pywebsocket/test/testdata/hello.pl: Added. 28 1 29 2010-03-09 Chris Jerdonek <cjerdonek@webkit.org> 2 30 -
trunk/WebKitTools/Scripts/run-webkit-tests
r55663 r55719 1427 1427 my @args = ( 1428 1428 "WebKitTools/Scripts/webkitpy/thirdparty/pywebsocket/mod_pywebsocket/standalone.py", 1429 "-p", "$webSocketPort", 1430 "-d", "$webSocketHandlerDir", 1431 "-s", "$webSocketHandlerScanDir", 1432 "-m", "$webSocketHandlerMapFile", 1433 "-x", "/websocket/tests/cookies", 1434 "-l", "$logFile", 1429 "--server-host", "127.0.0.1", 1430 "--port", "$webSocketPort", 1431 "--document-root", "$webSocketHandlerDir", 1432 "--scan-dir", "$webSocketHandlerScanDir", 1433 "--websock-handlers-map-file", "$webSocketHandlerMapFile", 1434 "--cgi-paths", "/websocket/tests", 1435 "--log-file", "$logFile", 1435 1436 "--strict", 1436 1437 ); -
trunk/WebKitTools/Scripts/run-webkit-websocketserver
r55286 r55719 72 72 my @args = ( 73 73 "$srcDir/WebKitTools/Scripts/webkitpy/thirdparty/pywebsocket/mod_pywebsocket/standalone.py", 74 "-p", "$webSocketPort", 75 "-d", "$webSocketHandlerDir", 76 "-s", "$webSocketHandlerScanDir", 77 "-m", "$webSocketHandlerMapFile", 78 "-x", "/websocket/tests/cookies", 74 "--server-host", "127.0.0.1", 75 "--port", "$webSocketPort", 76 "--document-root", "$webSocketHandlerDir", 77 "--scan-dir", "$webSocketHandlerScanDir", 78 "--websock-handlers-map-file", "$webSocketHandlerMapFile", 79 "--cgi-paths", "/websocket/tests/cookies", 79 80 ); 80 81 -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py
r55603 r55719 159 159 start_cmd = [ 160 160 python_interp, pywebsocket_script, 161 '-p', str(self._port), 162 '-d', self._layout_tests, 163 '-s', self._web_socket_tests, 164 '-x', '/websocket/tests/cookies', 165 '-l', error_log, 161 '--server-host', '127.0.0.1', 162 '--port', str(self._port), 163 '--document-root', self._layout_tests, 164 '--scan-dir', self._web_socket_tests, 165 '--cgi-paths', '/websocket/tests/cookies', 166 '--log-file', error_log, 166 167 ] 167 168 … … 170 171 if os.path.exists(handler_map_file): 171 172 _log.debug('Using handler_map_file: %s' % handler_map_file) 172 start_cmd.append('- m')173 start_cmd.append('--websock-handlers-map-file') 173 174 start_cmd.append(handler_map_file) 174 175 else: -
trunk/WebKitTools/Scripts/webkitpy/thirdparty/pywebsocket/README.webkit
r55286 r55719 5 5 6 6 This directory currently contains the following version: 7 FIXME: Fill in the current version here. 7 0.4.9.2 8 8 9 9 The following modifications have been made to this local version: 10 FIXME: Fill in local modifications. 10 minor updates in WebSocketRequestHandler.is_cgi 11 11 12 12 More information on these local modifications can be found here: -
trunk/WebKitTools/Scripts/webkitpy/thirdparty/pywebsocket/example/echo_client.py
r51406 r55719 164 164 165 165 parser = OptionParser() 166 parser.add_option('-s', '--server_host', dest='server_host', type='string', 166 parser.add_option('-s', '--server-host', '--server_host', 167 dest='server_host', type='string', 167 168 default='localhost', help='server host') 168 parser.add_option('-p', '--server_port', dest='server_port', type='int', 169 parser.add_option('-p', '--server-port', '--server_port', 170 dest='server_port', type='int', 169 171 default=_UNDEFINED_PORT, help='server port') 170 172 parser.add_option('-o', '--origin', dest='origin', type='string', … … 180 182 parser.add_option('-t', '--tls', dest='use_tls', action='store_true', 181 183 default=False, help='use TLS (wss://)') 182 parser.add_option('-k', '--socket _timeout', dest='socket_timeout',183 type='int', default=_TIMEOUT_SEC,184 parser.add_option('-k', '--socket-timeout', '--socket_timeout', 185 dest='socket_timeout', type='int', default=_TIMEOUT_SEC, 184 186 help='Timeout(sec) for sockets') 185 187 -
trunk/WebKitTools/Scripts/webkitpy/thirdparty/pywebsocket/mod_pywebsocket/standalone.py
r54707 r55719 273 273 """Test whether self.path corresponds to a CGI script. 274 274 275 Add extra check that self.path doesn't contains ..""" 275 Add extra check that self.path doesn't contains .. 276 Also check if the file is a executable file or not. 277 If the file is not executable, it is handled as static file or dir 278 rather than a CGI script. 279 """ 276 280 if CGIHTTPServer.CGIHTTPRequestHandler.is_cgi(self): 277 281 if '..' in self.path: 282 return False 283 # strip query parameter from request path 284 resource_name = self.path.split('?', 2)[0] 285 # convert resource_name into real path name in filesystem. 286 scriptfile = self.translate_path(resource_name) 287 if not os.path.isfile(scriptfile): 288 return False 289 if not self.is_executable(scriptfile): 278 290 return False 279 291 return True … … 322 334 def _main(): 323 335 parser = optparse.OptionParser() 336 parser.add_option('-H', '--server-host', '--server_host', 337 dest='server_host', 338 default='', 339 help='server hostname to listen to') 324 340 parser.add_option('-p', '--port', dest='port', type='int', 325 341 default=handshake._DEFAULT_WEB_SOCKET_PORT, 326 342 help='port to listen to') 327 parser.add_option('-w', '--websock_handlers', dest='websock_handlers', 343 parser.add_option('-w', '--websock-handlers', '--websock_handlers', 344 dest='websock_handlers', 328 345 default='.', 329 346 help='Web Socket handlers root directory.') 330 parser.add_option('-m', '--websock_handlers_map_file', 347 parser.add_option('-m', '--websock-handlers-map-file', 348 '--websock_handlers_map_file', 331 349 dest='websock_handlers_map_file', 332 350 default=None, … … 334 352 'Each line consists of alias_resource_path and ' 335 353 'existing_resource_path, separated by spaces.')) 336 parser.add_option('-s', '--scan _dir', dest='scan_dir',354 parser.add_option('-s', '--scan-dir', '--scan_dir', dest='scan_dir', 337 355 default=None, 338 356 help=('Web Socket handlers scan directory. ' 339 357 'Must be a directory under websock_handlers.')) 340 parser.add_option('-d', '--document _root', dest='document_root',341 de fault='.',358 parser.add_option('-d', '--document-root', '--document_root', 359 dest='document_root', default='.', 342 360 help='Document root directory.') 343 parser.add_option('-x', '--cgi _paths', dest='cgi_paths',361 parser.add_option('-x', '--cgi-paths', '--cgi_paths', dest='cgi_paths', 344 362 default=None, 345 363 help=('CGI paths relative to document_root.' … … 349 367 parser.add_option('-t', '--tls', dest='use_tls', action='store_true', 350 368 default=False, help='use TLS (wss://)') 351 parser.add_option('-k', '--private_key', dest='private_key', 369 parser.add_option('-k', '--private-key', '--private_key', 370 dest='private_key', 352 371 default='', help='TLS private key file.') 353 372 parser.add_option('-c', '--certificate', dest='certificate', 354 373 default='', help='TLS certificate file.') 355 parser.add_option('-l', '--log _file', dest='log_file',374 parser.add_option('-l', '--log-file', '--log_file', dest='log_file', 356 375 default='', help='Log file.') 357 parser.add_option('--log _level', type='choice', dest='log_level',358 de fault='warn',376 parser.add_option('--log-level', '--log_level', type='choice', 377 dest='log_level', default='warn', 359 378 choices=['debug', 'info', 'warn', 'error', 'critical'], 360 379 help='Log level.') 361 parser.add_option('--log _max', dest='log_max', type='int',380 parser.add_option('--log-max', '--log_max', dest='log_max', type='int', 362 381 default=_DEFAULT_LOG_MAX_BYTES, 363 382 help='Log maximum bytes') 364 parser.add_option('--log _count', dest='log_count', type='int',365 default=_DEFAULT_LOG_BACKUP_COUNT,383 parser.add_option('--log-count', '--log_count', dest='log_count', 384 type='int', default=_DEFAULT_LOG_BACKUP_COUNT, 366 385 help='Log backup count') 367 386 parser.add_option('--strict', dest='strict', action='store_true', … … 382 401 CGIHTTPServer.CGIHTTPRequestHandler.cgi_directories = \ 383 402 options.cgi_paths.split(',') 403 if sys.platform in ('cygwin', 'win32'): 404 cygwin_path = None 405 # For Win32 Python, it is expected that CYGWIN_PATH 406 # is set to a directory of cygwin binaries. 407 # For example, websocket_server.py in Chromium sets CYGWIN_PATH to 408 # full path of third_party/cygwin/bin. 409 if 'CYGWIN_PATH' in os.environ: 410 cygwin_path = os.environ['CYGWIN_PATH'] 411 util.wrap_popen3_for_win(cygwin_path) 412 def __check_script(scriptpath): 413 return util.get_script_interp(scriptpath, cygwin_path) 414 CGIHTTPServer.executable = __check_script 384 415 385 416 if options.use_tls: … … 408 439 WebSocketServer.options = options 409 440 410 server = WebSocketServer(('', options.port), WebSocketRequestHandler) 441 server = WebSocketServer((options.server_host, options.port), 442 WebSocketRequestHandler) 411 443 server.serve_forever() 412 444 except Exception, e: -
trunk/WebKitTools/Scripts/webkitpy/thirdparty/pywebsocket/mod_pywebsocket/util.py
r51661 r55719 34 34 35 35 import StringIO 36 import os 37 import re 36 38 import traceback 37 39 … … 57 59 58 60 61 def __translate_interp(interp, cygwin_path): 62 """Translate interp program path for Win32 python to run cygwin program 63 (e.g. perl). Note that it doesn't support path that contains space, 64 which is typically true for Unix, where #!-script is written. 65 For Win32 python, cygwin_path is a directory of cygwin binaries. 66 67 Args: 68 interp: interp command line 69 cygwin_path: directory name of cygwin binary, or None 70 Returns: 71 translated interp command line. 72 """ 73 if not cygwin_path: 74 return interp 75 m = re.match("^[^ ]*/([^ ]+)( .*)?", interp) 76 if m: 77 cmd = os.path.join(cygwin_path, m.group(1)) 78 return cmd + m.group(2) 79 return interp 80 81 82 def get_script_interp(script_path, cygwin_path=None): 83 """Gets #!-interpreter command line from the script. 84 85 It also fixes command path. When Cygwin Python is used, e.g. in WebKit, 86 it could run "/usr/bin/perl -wT hello.pl". 87 When Win32 Python is used, e.g. in Chromium, it couldn't. So, fix 88 "/usr/bin/perl" to "<cygwin_path>\perl.exe". 89 90 Args: 91 script_path: pathname of the script 92 cygwin_path: directory name of cygwin binary, or None 93 Returns: 94 #!-interpreter command line, or None if it is not #!-script. 95 """ 96 fp = open(script_path) 97 line = fp.readline() 98 fp.close() 99 m = re.match("^#!(.*)", line) 100 if m: 101 return __translate_interp(m.group(1), cygwin_path) 102 return None 103 104 def wrap_popen3_for_win(cygwin_path): 105 """Wrap popen3 to support #!-script on Windows. 106 107 Args: 108 cygwin_path: path for cygwin binary if command path is needed to be 109 translated. None if no translation required. 110 """ 111 __orig_popen3 = os.popen3 112 def __wrap_popen3(cmd, mode='t', bufsize=-1): 113 cmdline = cmd.split(' ') 114 interp = get_script_interp(cmdline[0], cygwin_path) 115 if interp: 116 cmd = interp + " " + cmd 117 return __orig_popen3(cmd, mode, bufsize) 118 os.popen3 = __wrap_popen3 119 120 59 121 # vi:sts=4 sw=4 et -
trunk/WebKitTools/Scripts/webkitpy/thirdparty/pywebsocket/setup.py
r54707 r55719 57 57 packages=[_PACKAGE_NAME], 58 58 url='http://code.google.com/p/pywebsocket/', 59 version='0.4. 8',59 version='0.4.9.2', 60 60 ) 61 61 -
trunk/WebKitTools/Scripts/webkitpy/thirdparty/pywebsocket/test/test_util.py
r51661 r55719 34 34 35 35 36 import os 37 import sys 36 38 import unittest 37 39 … … 39 41 from mod_pywebsocket import util 40 42 43 _TEST_DATA_DIR = os.path.join(os.path.split(__file__)[0], 'testdata') 41 44 42 45 class UtilTest(unittest.TestCase): … … 56 59 self.assertEqual('Hello World', str(exc)) 57 60 61 def test_get_script_interp(self): 62 cygwin_path = 'c:\\cygwin\\bin' 63 cygwin_perl = os.path.join(cygwin_path, 'perl') 64 self.assertEqual(None, util.get_script_interp( 65 os.path.join(_TEST_DATA_DIR, 'README'))) 66 self.assertEqual(None, util.get_script_interp( 67 os.path.join(_TEST_DATA_DIR, 'README'), cygwin_path)) 68 self.assertEqual('/usr/bin/perl -wT', util.get_script_interp( 69 os.path.join(_TEST_DATA_DIR, 'hello.pl'))) 70 self.assertEqual(cygwin_perl + ' -wT', util.get_script_interp( 71 os.path.join(_TEST_DATA_DIR, 'hello.pl'), cygwin_path)) 72 58 73 59 74 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.