| 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 445 |
| 446 const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* e
nd) | 446 const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* e
nd) |
| 447 { | 447 { |
| 448 m_response.clearHeaderFields(); | 448 m_response.clearHeaderFields(); |
| 449 | 449 |
| 450 AtomicString name; | 450 AtomicString name; |
| 451 AtomicString value; | 451 AtomicString value; |
| 452 bool sawSecWebSocketAcceptHeaderField = false; | 452 bool sawSecWebSocketAcceptHeaderField = false; |
| 453 bool sawSecWebSocketProtocolHeaderField = false; | 453 bool sawSecWebSocketProtocolHeaderField = false; |
| 454 const char* p = start; | 454 const char* p = start; |
| 455 for (; p < end; p++) { | 455 while (p < end) { |
| 456 size_t consumedLength = parseHTTPHeader(p, end - p, m_failureReason, nam
e, value); | 456 size_t consumedLength = parseHTTPHeader(p, end - p, m_failureReason, nam
e, value); |
| 457 if (!consumedLength) | 457 if (!consumedLength) |
| 458 return 0; | 458 return 0; |
| 459 p += consumedLength; | 459 p += consumedLength; |
| 460 | 460 |
| 461 // Stop once we consumed an empty line. | 461 // Stop once we consumed an empty line. |
| 462 if (name.isEmpty()) | 462 if (name.isEmpty()) |
| 463 break; | 463 break; |
| 464 | 464 |
| 465 // Sec-WebSocket-Extensions may be split. We parse and check the | 465 // Sec-WebSocket-Extensions may be split. We parse and check the |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |