OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 if (serverWebSocketAccept != m_expectedAccept) { | 526 if (serverWebSocketAccept != m_expectedAccept) { |
527 m_failureReason = formatHandshakeFailureReason("Incorrect 'Sec-WebSocket
-Accept' header value"); | 527 m_failureReason = formatHandshakeFailureReason("Incorrect 'Sec-WebSocket
-Accept' header value"); |
528 return false; | 528 return false; |
529 } | 529 } |
530 if (!serverWebSocketProtocol.isNull()) { | 530 if (!serverWebSocketProtocol.isNull()) { |
531 if (m_clientProtocol.isEmpty()) { | 531 if (m_clientProtocol.isEmpty()) { |
532 m_failureReason = formatHandshakeFailureReason("Response must not in
clude 'Sec-WebSocket-Protocol' header if not present in request: " + serverWebSo
cketProtocol); | 532 m_failureReason = formatHandshakeFailureReason("Response must not in
clude 'Sec-WebSocket-Protocol' header if not present in request: " + serverWebSo
cketProtocol); |
533 return false; | 533 return false; |
534 } | 534 } |
535 Vector<String> result; | 535 Vector<String> result; |
536 m_clientProtocol.split(String(WebSocket::subProtocolSeperator()), result
); | 536 m_clientProtocol.split(String(WebSocket::subprotocolSeperator()), result
); |
537 if (!result.contains(serverWebSocketProtocol)) { | 537 if (!result.contains(serverWebSocketProtocol)) { |
538 m_failureReason = formatHandshakeFailureReason("'Sec-WebSocket-Proto
col' header value '" + serverWebSocketProtocol + "' in response does not match a
ny of sent values"); | 538 m_failureReason = formatHandshakeFailureReason("'Sec-WebSocket-Proto
col' header value '" + serverWebSocketProtocol + "' in response does not match a
ny of sent values"); |
539 return false; | 539 return false; |
540 } | 540 } |
541 } else if (!m_clientProtocol.isEmpty()) { | 541 } else if (!m_clientProtocol.isEmpty()) { |
542 m_failureReason = formatHandshakeFailureReason("Sent non-empty 'Sec-WebS
ocket-Protocol' header but no response was received"); | 542 m_failureReason = formatHandshakeFailureReason("Sent non-empty 'Sec-WebS
ocket-Protocol' header but no response was received"); |
543 return false; | 543 return false; |
544 } | 544 } |
545 return true; | 545 return true; |
546 } | 546 } |
547 | 547 |
548 } // namespace WebCore | 548 } // namespace WebCore |
OLD | NEW |