Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(580)

Side by Side Diff: Source/modules/websockets/WebSocketHandshake.cpp

Issue 124943003: Remove 'String::append' from some of the blink source. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698