Changeset 112377 in webkit


Ignore:
Timestamp:
Mar 28, 2012 2:12:00 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[WebSocket]The Sec-WebSocket-Protocol must not appear more than once in an HTTP response
https://bugs.webkit.org/show_bug.cgi?id=82432

Patch by Li Yin <li.yin@intel.com> on 2012-03-28
Reviewed by Kent Tamura.

Source/WebCore:

From RFC6455: http://tools.ietf.org/html/rfc6455#section-11.3.4
The |Sec-WebSocket-Protocol| header field must not appear
more than once in an HTTP response.

Test: http/tests/websocket/tests/hybi/handshake-fail-by-more-protocol-header.html

  • Modules/websockets/WebSocketHandshake.cpp:

(WebCore::WebSocketHandshake::readHTTPHeaders):

LayoutTests:

From RFC6455: http://tools.ietf.org/html/rfc6455#section-11.3.4
The |Sec-WebSocket-Protocol| header field must not appear
more than once in an HTTP response.

  • http/tests/websocket/tests/hybi/handshake-fail-by-more-protocol-header-expected.txt: Added.
  • http/tests/websocket/tests/hybi/handshake-fail-by-more-protocol-header.html: Added.
  • http/tests/websocket/tests/hybi/handshake-fail-by-more-protocol-header_wsh.py: Added.

(web_socket_do_extra_handshake):
(web_socket_transfer_data):

Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r112374 r112377  
     12012-03-28  Li Yin  <li.yin@intel.com>
     2
     3        [WebSocket]The Sec-WebSocket-Protocol must not appear more than once in an HTTP response
     4        https://bugs.webkit.org/show_bug.cgi?id=82432
     5
     6        Reviewed by Kent Tamura.
     7
     8        From RFC6455: http://tools.ietf.org/html/rfc6455#section-11.3.4
     9        The |Sec-WebSocket-Protocol| header field must not appear
     10        more than once in an HTTP response.
     11
     12        * http/tests/websocket/tests/hybi/handshake-fail-by-more-protocol-header-expected.txt: Added.
     13        * http/tests/websocket/tests/hybi/handshake-fail-by-more-protocol-header.html: Added.
     14        * http/tests/websocket/tests/hybi/handshake-fail-by-more-protocol-header_wsh.py: Added.
     15        (web_socket_do_extra_handshake):
     16        (web_socket_transfer_data):
     17
    1182012-03-28  Philippe Normand  <pnormand@igalia.com>
    219
  • trunk/Source/WebCore/ChangeLog

    r112364 r112377  
     12012-03-28  Li Yin  <li.yin@intel.com>
     2
     3        [WebSocket]The Sec-WebSocket-Protocol must not appear more than once in an HTTP response
     4        https://bugs.webkit.org/show_bug.cgi?id=82432
     5
     6        Reviewed by Kent Tamura.
     7
     8        From RFC6455: http://tools.ietf.org/html/rfc6455#section-11.3.4
     9        The |Sec-WebSocket-Protocol| header field must not appear
     10        more than once in an HTTP response.
     11
     12        Test: http/tests/websocket/tests/hybi/handshake-fail-by-more-protocol-header.html
     13
     14        * Modules/websockets/WebSocketHandshake.cpp:
     15        (WebCore::WebSocketHandshake::readHTTPHeaders):
     16
    1172012-03-27  James Robinson  <jamesr@chromium.org>
    218
  • trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp

    r111554 r112377  
    577577    Vector<char> value;
    578578    bool sawSecWebSocketAcceptHeaderField = false;
     579    bool sawSecWebSocketProtocolHeaderField = false;
    579580    for (const char* p = start; p < end; p++) {
    580581        name.clear();
     
    653654            m_response.addHeaderField(nameStr, valueStr);
    654655            sawSecWebSocketAcceptHeaderField = true;
     656        } else if (equalIgnoringCase("Sec-WebSocket-Protocol", nameStr)) {
     657            if (sawSecWebSocketProtocolHeaderField) {
     658                m_failureReason = "The Sec-WebSocket-Protocol header MUST NOT appear more than once in an HTTP response";
     659                return 0;
     660            }
     661            m_response.addHeaderField(nameStr, valueStr);
     662            sawSecWebSocketProtocolHeaderField = true;
    655663        } else
    656664            m_response.addHeaderField(nameStr, valueStr);
Note: See TracChangeset for help on using the changeset viewer.