Diff
Modified: trunk/LayoutTests/ChangeLog (94056 => 94057)
--- trunk/LayoutTests/ChangeLog 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/ChangeLog 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,40 @@
+2011-08-30 Takashi Toyoshima <[email protected]>
+
+ [WebSocket] Prevent unnecessary pywebsocket warnings on layout tests.
+ https://bugs.webkit.org/show_bug.cgi?id=67182
+
+ Reviewed by Kent Tamura.
+
+ Some layout tests for WebSocket raised Exception to prevent unnecessary
+ pywebsocket warning. But it doesn't work any more on pywebsocket 0.6b4.
+ Now pywebsocket support AbortedByUserException to prevent warning.
+ This change make raise AbortedByUserException instead of Exception.
+
+ handshake-fail-by-prepended-null_wsh.py didn't use Exception, but
+ expected abnormal closure on sending response could raise unexpected
+ Exception by chance. This change also takes care of it.
+
+ * http/tests/websocket/tests/hixie76/bad-handshake-crash_wsh.py:
+ * http/tests/websocket/tests/hixie76/frame-length-longer-than-buffer_wsh.py:
+ * http/tests/websocket/tests/hixie76/frame-length-overflow_wsh.py:
+ * http/tests/websocket/tests/hixie76/handshake-fail-by-maxlength_wsh.py:
+ * http/tests/websocket/tests/hixie76/handshake-fail-by-no-connection-header_wsh.py:
+ * http/tests/websocket/tests/hixie76/handshake-fail-by-no-cr_wsh.py:
+ * http/tests/websocket/tests/hixie76/handshake-fail-by-no-upgrade-header_wsh.py:
+ * http/tests/websocket/tests/hixie76/handshake-fail-by-prepended-null_wsh.py:
+ * http/tests/websocket/tests/hixie76/long-invalid-header_wsh.py:
+ * http/tests/websocket/tests/hybi/bad-handshake-crash_wsh.py:
+ * http/tests/websocket/tests/hybi/handshake-fail-by-extensions-header_wsh.py:
+ * http/tests/websocket/tests/hybi/handshake-fail-by-maxlength_wsh.py:
+ * http/tests/websocket/tests/hybi/handshake-fail-by-no-accept-header_wsh.py:
+ * http/tests/websocket/tests/hybi/handshake-fail-by-no-connection-header_wsh.py:
+ * http/tests/websocket/tests/hybi/handshake-fail-by-no-cr_wsh.py:
+ * http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header_wsh.py:
+ * http/tests/websocket/tests/hybi/handshake-fail-by-wrong-accept-header_wsh.py:
+ * http/tests/websocket/tests/hybi/long-invalid-header_wsh.py:
+ * http/tests/websocket/tests/hybi/masked-frames_wsh.py:
+ Use AbortedByUserException instead of Exception.
+
2011-08-29 Takashi Toyoshima <[email protected]>
Fix two layout tests which fails on Qt port with latest pywebsocket.
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/bad-handshake-crash_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/bad-handshake-crash_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/bad-handshake-crash_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,6 @@
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
msg = "HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
msg += "Upgrade: WebSocket\r\n"
@@ -9,7 +12,7 @@
msg += request.ws_challenge_md5
request.connection.write(msg)
print msg
- raise Exception("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/frame-length-longer-than-buffer_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/frame-length-longer-than-buffer_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/frame-length-longer-than-buffer_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,6 @@
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
pass
@@ -8,4 +11,4 @@
msg += "\x01\xff"
msg += "\0should be skipped\xff"
request.connection.write(msg)
- raise Exception("Abort the connection") # Prevents pywebsocket from starting closing handshake.
+ raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from starting closing handshake.
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/frame-length-overflow_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/frame-length-overflow_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/frame-length-overflow_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,6 @@
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
pass
@@ -5,4 +8,4 @@
def web_socket_transfer_data(request):
msg = 16 * '\xff'
request.connection.write(msg)
- raise Exception('Abort the connection') # Prevents pywebsocket from starting closing handshake.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from starting closing handshake.
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-maxlength_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-maxlength_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-maxlength_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -20,6 +20,9 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
# This will cause the handshake to fail because it pushes the length of the
# status line past 1024 characters
@@ -32,7 +35,7 @@
msg += '\r\n'
msg += request.ws_challenge_md5
request.connection.write(msg)
- raise Exception('abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-connection-header_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-connection-header_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-connection-header_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,6 @@
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
msg = 'HTTP/1.1 101 WebSocket Protocol Handshake\r\n'
msg += 'Upgrade: WebSocket\r\n'
@@ -8,7 +11,7 @@
msg += request.ws_challenge_md5
request.connection.write(msg)
print msg
- raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-cr_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-cr_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-cr_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,6 @@
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
msg = 'HTTP/1.1 101 WebSocket Protocol Handshake\n' # Does not end with "\r\n".
msg += 'Upgrade: WebSocket\r\n'
@@ -8,7 +11,7 @@
msg += request.ws_challenge_md5
request.connection.write(msg)
print msg
- raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-upgrade-header_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-upgrade-header_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-no-upgrade-header_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,6 @@
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
msg = 'HTTP/1.1 101 WebSocket Protocol Handshake\r\n'
# Missing 'Upgrade: WebSocket\r\n'
@@ -8,7 +11,7 @@
msg += request.ws_challenge_md5
request.connection.write(msg)
print msg
- raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-prepended-null_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-prepended-null_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/handshake-fail-by-prepended-null_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -20,6 +20,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time
+from mod_pywebsocket import handshake
def web_socket_do_extra_handshake(request):
@@ -44,7 +45,10 @@
time.sleep(1)
numFrames = 1024 / len(frame) # write over 1024 bytes including the above handshake
for i in range(0, numFrames):
- request.connection.write(frame)
+ try:
+ request.connection.write(frame)
+ except Exception, e:
+ raise handshake.AbortedByUserException(e)
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/long-invalid-header_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/long-invalid-header_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/long-invalid-header_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,6 @@
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
msg = "HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
msg += ("p" * 1024) + "\r\n"
@@ -4,7 +7,7 @@
msg += "\r\n"
msg += request.ws_challenge_md5
request.connection.write(msg)
- raise Exception("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/bad-handshake-crash_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/bad-handshake-crash_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/bad-handshake-crash_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,4 @@
+from mod_pywebsocket import handshake
from mod_pywebsocket.handshake.hybi import compute_accept
@@ -10,7 +11,7 @@
msg += "\r\n"
request.connection.write(msg)
print msg
- raise Exception("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-extensions-header_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-extensions-header_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-extensions-header_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,4 @@
+from mod_pywebsocket import handshake
from mod_pywebsocket.handshake.hybi import compute_accept
@@ -9,7 +10,7 @@
message += 'Sec-WebSocket-Extensions: x-foo\r\n'
message += '\r\n'
request.connection.write(message)
- raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-maxlength_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-maxlength_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-maxlength_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -20,6 +20,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from mod_pywebsocket import handshake
from mod_pywebsocket.handshake.hybi import compute_accept
@@ -33,7 +34,7 @@
msg += 'Sec-WebSocket-Accept: %s\r\n' % compute_accept(request.headers_in['Sec-WebSocket-Key'])[0]
msg += '\r\n'
request.connection.write(msg)
- raise Exception('abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-accept-header_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-accept-header_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-accept-header_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,6 @@
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
message = 'HTTP/1.1 101 Switching Protocols\r\n'
message += 'Upgrade: websocket\r\n'
@@ -4,7 +7,7 @@
message += 'Connection: Upgrade\r\n'
message += '\r\n'
request.connection.write(message)
- raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-connection-header_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-connection-header_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-connection-header_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,4 @@
+from mod_pywebsocket import handshake
from mod_pywebsocket.handshake.hybi import compute_accept
@@ -9,7 +10,7 @@
msg += '\r\n'
request.connection.write(msg)
print msg
- raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-cr_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-cr_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-cr_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,4 @@
+from mod_pywebsocket import handshake
from mod_pywebsocket.handshake.hybi import compute_accept
@@ -9,7 +10,7 @@
msg += '\r\n'
request.connection.write(msg)
print msg
- raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-no-upgrade-header_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,4 @@
+from mod_pywebsocket import handshake
from mod_pywebsocket.handshake.hybi import compute_accept
@@ -9,7 +10,7 @@
msg += '\r\n'
request.connection.write(msg)
print msg
- raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-wrong-accept-header_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-wrong-accept-header_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-wrong-accept-header_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,6 @@
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
message = 'HTTP/1.1 101 Switching Protocols\r\n'
message += 'Upgrade: websocket\r\n'
@@ -5,7 +8,7 @@
message += 'Sec-WebSocket-Accept: XXXXthisiswrongXXXX\r\n'
message += '\r\n'
request.connection.write(message)
- raise Exception('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from sending its own handshake message.
def web_socket_transfer_data(request):
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/long-invalid-header_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/long-invalid-header_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/long-invalid-header_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,3 +1,6 @@
+from mod_pywebsocket import handshake
+
+
def web_socket_do_extra_handshake(request):
msg = "HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
msg += ("p" * 1024) + "\r\n"
@@ -3,5 +6,5 @@
msg += "\r\n"
request.connection.write(msg)
- raise Exception("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
+ raise handshake.AbortedByUserException("Abort the connection") # Prevents pywebsocket from sending its own handshake message.
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/masked-frames_wsh.py (94056 => 94057)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/masked-frames_wsh.py 2011-08-30 07:54:30 UTC (rev 94056)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/masked-frames_wsh.py 2011-08-30 08:02:59 UTC (rev 94057)
@@ -1,4 +1,5 @@
from mod_pywebsocket import common
+from mod_pywebsocket import handshake
from mod_pywebsocket import stream
from mod_pywebsocket import msgutil
@@ -31,4 +32,4 @@
# the WebSocket object should be closed cleanly.
request.connection.write(stream.create_close_frame('', mask=True))
- raise Exception('Abort the connection') # Prevents pywebsocket from starting its own closing handshake.
+ raise handshake.AbortedByUserException('Abort the connection') # Prevents pywebsocket from starting its own closing handshake.