Adding WebSocket per-frame DEFLATE extension
authorbashi@chromium.org <bashi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2012 06:29:33 +0000 (06:29 +0000)
committerbashi@chromium.org <bashi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Feb 2012 06:29:33 +0000 (06:29 +0000)
commit76ce65d4d5df806956403de7e0bd543dde0ecb9b
tree0db9f2cb45d715f28d66666f12d9e02800e11bb8
parente034b592d0274d4fac4554255f85bae79c5749a0
Adding WebSocket per-frame DEFLATE extension
https://bugs.webkit.org/show_bug.cgi?id=77522

Source/JavaScriptCore:

Added USE(ZLIB) flag.

Reviewed by Kent Tamura.

* wtf/Platform.h:

Source/WebCore:

Add WebSocketDeflateFramer class which handles deflate-frame extension.
This class encapsulates WebSocketDeflater and WebSocketInflater classes,
which depend on zlib, so that WebSocketChannel is not necessary to aware
zlib dependency.

This is the second patch to land. The previous patch broke Chromium Win
release build. r108600 should fix the build failure. I also added
zlib entry to |export_dependent_settings| of |webcore_prerequisites|
target.

Reviewed by Kent Tamura.

Tests: http/tests/websocket/tests/hybi/compressed-control-frame.html
       http/tests/websocket/tests/hybi/deflate-frame-comp-bit-onoff.html
       http/tests/websocket/tests/hybi/deflate-frame-invalid-parameter.html
       http/tests/websocket/tests/hybi/deflate-frame-parameter.html

* CMakeLists.txt: Added WebSocketDeflateFramer.(cpp|h)
* GNUmakefile.list.am: Ditto.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.
* WebCore.gyp/WebCore.gyp: Added zlib dependency.
* WebCore.vcproj/WebCore.vcproj: Added WebSocketDeflateFramer.(cpp|h)
* WebCore.xcodeproj/project.pbxproj: Ditto.
* websockets/WebSocket.cpp:
(WebCore::WebSocket::didConnect): Set m_extensions.
* websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::connect): Add deflate-frame extension processor to WebSocketHanshake if deflate can use.
(WebCore::WebSocketChannel::fail): Call m_deflateFramer.didFail().
(WebCore::WebSocketChannel::processFrame): Decompress frames if needed.
(WebCore::WebSocketChannel::sendFrame): Compress frames if possible.
* websockets/WebSocketChannel.h:
* websockets/WebSocketDeflateFramer.cpp: Added.
(WebCore):
(WebSocketExtensionDeflateFrame):
(WebCore::WebSocketExtensionDeflateFrame::create):
(WebCore::WebSocketExtensionDeflateFrame::~WebSocketExtensionDeflateFrame):
(WebCore::WebSocketExtensionDeflateFrame::WebSocketExtensionDeflateFrame):
(WebCore::WebSocketExtensionDeflateFrame::handshakeString):
(WebCore::WebSocketExtensionDeflateFrame::processResponse):
(WebCore::DeflateResultHolder::DeflateResultHolder):
(WebCore::DeflateResultHolder::~DeflateResultHolder):
(WebCore::DeflateResultHolder::fail):
(WebCore::InflateResultHolder::InflateResultHolder):
(WebCore::InflateResultHolder::~InflateResultHolder):
(WebCore::InflateResultHolder::fail):
(WebCore::WebSocketDeflateFramer::WebSocketDeflateFramer):
(WebCore::WebSocketDeflateFramer::createExtensionProcessor):
(WebCore::WebSocketDeflateFramer::canDeflate):
(WebCore::WebSocketDeflateFramer::enableDeflate):
(WebCore::WebSocketDeflateFramer::deflate):
(WebCore::WebSocketDeflateFramer::resetDeflateContext):
(WebCore::WebSocketDeflateFramer::inflate):
(WebCore::WebSocketDeflateFramer::resetInflateContext):
(WebCore::WebSocketDeflateFramer::didFail):
* websockets/WebSocketDeflateFramer.h: Added.
(WebCore):
(DeflateResultHolder):
(WebCore::DeflateResultHolder::succeeded):
(WebCore::DeflateResultHolder::failureReason):
(InflateResultHolder):
(WebCore::InflateResultHolder::succeeded):
(WebCore::InflateResultHolder::failureReason):
(WebSocketDeflateFramer):
(WebCore::WebSocketDeflateFramer::enabled):

LayoutTests:

Added tests for WebSocket deflate-frame extension. Also updated some
tests to follow the change.

Reviewed by Kent Tamura.

* http/tests/websocket/tests/hybi/compressed-control-frame-expected.txt: Added.
* http/tests/websocket/tests/hybi/compressed-control-frame.html: Added.
* http/tests/websocket/tests/hybi/compressed-control-frame_wsh.py: Added.
(web_socket_do_extra_handshake):
(web_socket_transfer_data):
* http/tests/websocket/tests/hybi/deflate-frame-comp-bit-onoff-expected.txt: Added.
* http/tests/websocket/tests/hybi/deflate-frame-comp-bit-onoff.html: Added.
* http/tests/websocket/tests/hybi/deflate-frame-invalid-parameter-expected.txt: Added.
* http/tests/websocket/tests/hybi/deflate-frame-invalid-parameter.html: Added.
* http/tests/websocket/tests/hybi/deflate-frame-invalid-parameter_wsh.py: Added.
(web_socket_do_extra_handshake):
(web_socket_transfer_data):
* http/tests/websocket/tests/hybi/deflate-frame-parameter-expected.txt: Added.
* http/tests/websocket/tests/hybi/deflate-frame-parameter.html: Added.
* http/tests/websocket/tests/hybi/deflate-frame_wsh.py: Added.
(_get_deflate_frame_extension_processor):
(web_socket_do_extra_handshake):
(web_socket_transfer_data):
* http/tests/websocket/tests/hybi/handshake-fail-by-extensions-header-expected.txt:
* http/tests/websocket/tests/hybi/send-file-blob_wsh.py:
(_retrieve_frame):
(web_socket_transfer_data):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/websocket/tests/hybi/compressed-control-frame-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/compressed-control-frame.html [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/compressed-control-frame_wsh.py [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/deflate-frame-comp-bit-onoff-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/deflate-frame-comp-bit-onoff.html [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/deflate-frame-invalid-parameter-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/deflate-frame-invalid-parameter.html [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/deflate-frame-invalid-parameter_wsh.py [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/deflate-frame-parameter-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/deflate-frame-parameter.html [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/deflate-frame_wsh.py [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/handshake-fail-by-extensions-header-expected.txt
LayoutTests/http/tests/websocket/tests/hybi/send-file-blob_wsh.py
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wtf/Platform.h
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gyp/WebCore.gyp
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/websockets/WebSocket.cpp
Source/WebCore/websockets/WebSocketChannel.cpp
Source/WebCore/websockets/WebSocketChannel.h
Source/WebCore/websockets/WebSocketDeflateFramer.cpp [new file with mode: 0644]
Source/WebCore/websockets/WebSocketDeflateFramer.h [new file with mode: 0644]