mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
Update web-platform-tests to revision a3a4442b04c37155f81c4ad4ae9c06339f76ce14
This commit is contained in:
parent
7b653cad7b
commit
ba0f5f096a
204 changed files with 4645 additions and 1001 deletions
|
@ -527,7 +527,7 @@ class ClientHandshakeProcessor(ClientHandshakeBase):
|
|||
# Validate
|
||||
try:
|
||||
binary_accept = base64.b64decode(accept)
|
||||
except TypeError, e:
|
||||
except TypeError:
|
||||
raise HandshakeError(
|
||||
'Illegal value for header %s: %r' %
|
||||
(common.SEC_WEBSOCKET_ACCEPT_HEADER, accept))
|
||||
|
@ -947,7 +947,7 @@ class EchoClient(object):
|
|||
|
||||
if self._options.verbose:
|
||||
print('Recv: %s' % received)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if self._options.verbose:
|
||||
print('Error: %s' % e)
|
||||
raise
|
||||
|
|
|
@ -201,7 +201,7 @@ def headerparserhandler(request):
|
|||
request.log_error(
|
||||
'mod_pywebsocket: Fallback to Apache', apache.APLOG_INFO)
|
||||
return apache.DECLINED
|
||||
except dispatch.DispatchException, e:
|
||||
except dispatch.DispatchException as e:
|
||||
request.log_error(
|
||||
'mod_pywebsocket: Dispatch failed for error: %s' % e,
|
||||
apache.APLOG_INFO)
|
||||
|
@ -217,14 +217,14 @@ def headerparserhandler(request):
|
|||
try:
|
||||
handshake.do_handshake(
|
||||
request, _dispatcher, allowDraft75=allow_draft75)
|
||||
except handshake.VersionException, e:
|
||||
except handshake.VersionException as e:
|
||||
request.log_error(
|
||||
'mod_pywebsocket: Handshake failed for version error: %s' % e,
|
||||
apache.APLOG_INFO)
|
||||
request.err_headers_out.add(common.SEC_WEBSOCKET_VERSION_HEADER,
|
||||
e.supported_versions)
|
||||
return apache.HTTP_BAD_REQUEST
|
||||
except handshake.HandshakeException, e:
|
||||
except handshake.HandshakeException as e:
|
||||
# Handshake for ws/wss failed.
|
||||
# Send http response with error status.
|
||||
request.log_error(
|
||||
|
@ -235,10 +235,10 @@ def headerparserhandler(request):
|
|||
handshake_is_done = True
|
||||
request._dispatcher = _dispatcher
|
||||
_dispatcher.transfer_data(request)
|
||||
except handshake.AbortedByUserException, e:
|
||||
except handshake.AbortedByUserException as e:
|
||||
request.log_error('mod_pywebsocket: Aborted: %s' % e,
|
||||
apache.APLOG_INFO)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
# DispatchException can also be thrown if something is wrong in
|
||||
# pywebsocket code. It's caught here, then.
|
||||
|
||||
|
|
|
@ -398,7 +398,7 @@ class WebSocketHandshake(object):
|
|||
# Validate
|
||||
try:
|
||||
decoded_accept = base64.b64decode(accept)
|
||||
except TypeError, e:
|
||||
except TypeError as e:
|
||||
raise HandshakeException(
|
||||
'Illegal value for header Sec-WebSocket-Accept: ' + accept)
|
||||
|
||||
|
@ -998,7 +998,7 @@ def connect_socket_with_retry(host, port, timeout, use_tls,
|
|||
if use_tls:
|
||||
return _TLSSocket(s)
|
||||
return s
|
||||
except socket.error, e:
|
||||
except socket.error as e:
|
||||
if e.errno != errno.ECONNREFUSED:
|
||||
raise
|
||||
else:
|
||||
|
@ -1063,7 +1063,7 @@ class Client(object):
|
|||
def assert_connection_closed(self):
|
||||
try:
|
||||
read_data = receive_bytes(self._socket, 1)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if str(e).find(
|
||||
'Connection closed before receiving requested length ') == 0:
|
||||
return
|
||||
|
|
|
@ -519,7 +519,7 @@ class MuxClient(object):
|
|||
|
||||
try:
|
||||
send_quota = self._channel_slots.popleft()
|
||||
except IndexError, e:
|
||||
except IndexError as e:
|
||||
raise Exception('No channel slots: %r' % e)
|
||||
|
||||
# Create AddChannel request
|
||||
|
@ -632,7 +632,7 @@ class MuxClient(object):
|
|||
try:
|
||||
inner_frame = self._logical_channels[channel_id].queue.get(
|
||||
timeout=self._timeout)
|
||||
except Queue.Empty, e:
|
||||
except Queue.Empty as e:
|
||||
raise Exception('Cannot receive message from channel id %d' %
|
||||
channel_id)
|
||||
|
||||
|
@ -666,7 +666,7 @@ class MuxClient(object):
|
|||
try:
|
||||
inner_frame = self._logical_channels[channel_id].queue.get(
|
||||
timeout=self._timeout)
|
||||
except Queue.Empty, e:
|
||||
except Queue.Empty as e:
|
||||
raise Exception('Cannot receive message from channel id %d' %
|
||||
channel_id)
|
||||
if inner_frame.opcode != client_for_testing.OPCODE_CLOSE:
|
||||
|
|
|
@ -155,9 +155,9 @@ class DispatcherTest(unittest.TestCase):
|
|||
try:
|
||||
dispatcher.do_extra_handshake(request)
|
||||
self.fail('Could not catch HandshakeException with 403 status')
|
||||
except handshake.HandshakeException, e:
|
||||
except handshake.HandshakeException as e:
|
||||
self.assertEquals(403, e.status)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.fail('Unexpected exception: %r' % e)
|
||||
|
||||
def test_abort_extra_handshake(self):
|
||||
|
@ -212,7 +212,7 @@ class DispatcherTest(unittest.TestCase):
|
|||
try:
|
||||
dispatcher.transfer_data(request)
|
||||
self.fail()
|
||||
except dispatch.DispatchException, e:
|
||||
except dispatch.DispatchException as e:
|
||||
self.failUnless(str(e).find('No handler') != -1)
|
||||
except Exception:
|
||||
self.fail()
|
||||
|
@ -225,7 +225,7 @@ class DispatcherTest(unittest.TestCase):
|
|||
try:
|
||||
dispatcher.transfer_data(request)
|
||||
self.fail()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.failUnless(str(e).find('Intentional') != -1,
|
||||
'Unexpected exception: %s' % e)
|
||||
|
||||
|
|
|
@ -304,9 +304,9 @@ class EndToEndHyBiTest(EndToEndTestBase):
|
|||
try:
|
||||
client.connect()
|
||||
self.fail('Could not catch HttpStatusException')
|
||||
except client_for_testing.HttpStatusException, e:
|
||||
except client_for_testing.HttpStatusException as e:
|
||||
self.assertEqual(status, e.status)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.fail('Catch unexpected exception')
|
||||
finally:
|
||||
client.close_socket()
|
||||
|
|
|
@ -507,10 +507,10 @@ class HandshakerTest(unittest.TestCase):
|
|||
try:
|
||||
handshaker.do_handshake()
|
||||
self.fail('No exception thrown for \'%s\' case' % case_name)
|
||||
except HandshakeException, e:
|
||||
except HandshakeException as e:
|
||||
self.assertTrue(expect_handshake_exception)
|
||||
self.assertEqual(expected_status, e.status)
|
||||
except VersionException, e:
|
||||
except VersionException as e:
|
||||
self.assertFalse(expect_handshake_exception)
|
||||
|
||||
|
||||
|
|
|
@ -258,9 +258,9 @@ class _MuxMockDispatcher(object):
|
|||
raise ValueError('Cannot handle path %r' % request.path)
|
||||
if not request.server_terminated:
|
||||
request.ws_stream.close_connection()
|
||||
except ConnectionTerminatedException, e:
|
||||
except ConnectionTerminatedException as e:
|
||||
self.channel_events[request.channel_id].exception = e
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.channel_events[request.channel_id].exception = e
|
||||
raise
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue