| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 builder.appendNumber(url.port()); | 99 builder.appendNumber(url.port()); |
| 100 } | 100 } |
| 101 return builder.toString(); | 101 return builder.toString(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 static const size_t maxInputSampleSize = 128; | 104 static const size_t maxInputSampleSize = 128; |
| 105 static String trimInputSample(const char* p, size_t len) | 105 static String trimInputSample(const char* p, size_t len) |
| 106 { | 106 { |
| 107 String s = String(p, std::min<size_t>(len, maxInputSampleSize)); | 107 String s = String(p, std::min<size_t>(len, maxInputSampleSize)); |
| 108 if (len > maxInputSampleSize) | 108 if (len > maxInputSampleSize) |
| 109 s.append(horizontalEllipsis); | 109 s = String(p, std::min<size_t>(len, maxInputSampleSize)) + horizontalEll
ipsis; |
| 110 return s; | 110 return s; |
| 111 } | 111 } |
| 112 | 112 |
| 113 static String generateSecWebSocketKey() | 113 static String generateSecWebSocketKey() |
| 114 { | 114 { |
| 115 static const size_t nonceSize = 16; | 115 static const size_t nonceSize = 16; |
| 116 unsigned char key[nonceSize]; | 116 unsigned char key[nonceSize]; |
| 117 cryptographicallyRandomValues(key, nonceSize); | 117 cryptographicallyRandomValues(key, nonceSize); |
| 118 return base64Encode(reinterpret_cast<char*>(key), nonceSize); | 118 return base64Encode(reinterpret_cast<char*>(key), nonceSize); |
| 119 } | 119 } |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 } | 581 } |
| 582 if (!match) { | 582 if (!match) { |
| 583 m_failureReason = formatHandshakeFailureReason("Sent non-empty 'Sec-
WebSocket-Protocol' header but no response was received"); | 583 m_failureReason = formatHandshakeFailureReason("Sent non-empty 'Sec-
WebSocket-Protocol' header but no response was received"); |
| 584 return false; | 584 return false; |
| 585 } | 585 } |
| 586 } | 586 } |
| 587 return true; | 587 return true; |
| 588 } | 588 } |
| 589 | 589 |
| 590 } // namespace WebCore | 590 } // namespace WebCore |
| OLD | NEW |