https://bugs.webkit.org/show_bug.cgi?id=82100
Patch by Li Yin <li.yin@intel.com> on 2012-04-01
Reviewed by Kent Tamura.
Source/WebCore:
When it had no negotiated deflate-frame extension, if browser received the frame with
setting compressed bit, it should fail the connection, and it should cover both
enabling ZLIB port and disabling ZLIB port.
Test: http/tests/websocket/tests/hybi/reserved-bits.html
* Modules/websockets/WebSocketDeflateFramer.cpp:
(WebCore::WebSocketDeflateFramer::inflate):
LayoutTests:
Solve the problem that Qt Webkit failed when runing the reserved-bits.html
Support both enabled ZLIB and disabled ZLIB scenarios.
* http/tests/websocket/tests/hybi/reserved-bits-expected.txt:
* http/tests/websocket/tests/hybi/reserved-bits_wsh.py:
(_get_deflate_frame_extension_processor):
(web_socket_do_extra_handshake):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@112826
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-01 Li Yin <li.yin@intel.com>
+
+ [WebSocket]Reserved bits test case should cover both extension and no-extension scenarios
+ https://bugs.webkit.org/show_bug.cgi?id=82100
+
+ Reviewed by Kent Tamura.
+
+ Solve the problem that Qt Webkit failed when runing the reserved-bits.html
+ Support both enabled ZLIB and disabled ZLIB scenarios.
+
+ * http/tests/websocket/tests/hybi/reserved-bits-expected.txt:
+ * http/tests/websocket/tests/hybi/reserved-bits_wsh.py:
+ (_get_deflate_frame_extension_processor):
+ (web_socket_do_extra_handshake):
+
2012-04-01 Adam Barth <abarth@webkit.org>
Clean up Document::canNavigate
-CONSOLE MESSAGE: Received unexpected compressed frame
+CONSOLE MESSAGE: Compressed bit must be 0 if no negotiated deflate-frame extension
CONSOLE MESSAGE: One or more reserved bits are on: reserved2 = 1, reserved3 = 0
CONSOLE MESSAGE: One or more reserved bits are on: reserved2 = 0, reserved3 = 1
CONSOLE MESSAGE: One or more reserved bits are on: reserved2 = 1, reserved3 = 0
import re
from mod_pywebsocket import common
from mod_pywebsocket import stream
-
+from mod_pywebsocket.extensions import DeflateFrameExtensionProcessor
bit = 0
+def _get_deflate_frame_extension_processor(request):
+ for extension_processor in request.ws_extension_processors:
+ if isinstance(extension_processor, DeflateFrameExtensionProcessor):
+ return extension_processor
+ return None
+
+
def web_socket_do_extra_handshake(request):
match = re.search(r'\?compressed=(true|false)&bitNumber=(\d)$', request.ws_resource)
if match is None:
bit = int(match.group(2))
if compressed == "false":
request.ws_extension_processors = [] # using no extension response
+ else:
+ processor = _get_deflate_frame_extension_processor(request)
+ if not processor:
+ request.ws_extension_processors = [] # using no extension response
def web_socket_transfer_data(request):
+2012-04-01 Li Yin <li.yin@intel.com>
+
+ [WebSocket]Reserved bits test case should cover both extension and no-extension scenarios
+ https://bugs.webkit.org/show_bug.cgi?id=82100
+
+ Reviewed by Kent Tamura.
+
+ When it had no negotiated deflate-frame extension, if browser received the frame with
+ setting compressed bit, it should fail the connection, and it should cover both
+ enabling ZLIB port and disabling ZLIB port.
+
+ Test: http/tests/websocket/tests/hybi/reserved-bits.html
+
+ * Modules/websockets/WebSocketDeflateFramer.cpp:
+ (WebCore::WebSocketDeflateFramer::inflate):
+
2012-04-01 Adam Barth <abarth@webkit.org>
Clean up Document::canNavigate
PassOwnPtr<InflateResultHolder> WebSocketDeflateFramer::inflate(WebSocketFrame& frame)
{
-#if USE(ZLIB)
OwnPtr<InflateResultHolder> result = InflateResultHolder::create(this);
+ if (!enabled() && frame.compress) {
+ result->fail("Compressed bit must be 0 if no negotiated deflate-frame extension");
+ return result.release();
+ }
+#if USE(ZLIB)
if (!frame.compress)
return result.release();
- if (!enabled() || !WebSocketFrame::isNonControlOpCode(frame.opCode)) {
+ if (!WebSocketFrame::isNonControlOpCode(frame.opCode)) {
result->fail("Received unexpected compressed frame");
return result.release();
}
frame.payloadLength = m_inflater->size();
return result.release();
#else
- return InflateResultHolder::create(this);
+ return result.release();
#endif
}