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

Side by Side Diff: net/websockets/websocket_basic_handshake_stream.cc

Issue 2229393003: net: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
« no previous file with comments | « net/url_request/url_request_job_factory_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/websockets/websocket_basic_handshake_stream.h" 5 #include "net/websockets/websocket_basic_handshake_stream.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <iterator> 9 #include <iterator>
10 #include <set> 10 #include <set>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 std::string MultipleHeaderValuesMessage(const std::string& header_name) { 78 std::string MultipleHeaderValuesMessage(const std::string& header_name) {
79 return 79 return
80 std::string("'") + 80 std::string("'") +
81 header_name + 81 header_name +
82 "' header must not appear more than once in a response"; 82 "' header must not appear more than once in a response";
83 } 83 }
84 84
85 std::string GenerateHandshakeChallenge() { 85 std::string GenerateHandshakeChallenge() {
86 std::string raw_challenge(websockets::kRawChallengeLength, '\0'); 86 std::string raw_challenge(websockets::kRawChallengeLength, '\0');
87 crypto::RandBytes(string_as_array(&raw_challenge), raw_challenge.length()); 87 crypto::RandBytes(base::string_as_array(&raw_challenge),
88 raw_challenge.length());
88 std::string encoded_challenge; 89 std::string encoded_challenge;
89 base::Base64Encode(raw_challenge, &encoded_challenge); 90 base::Base64Encode(raw_challenge, &encoded_challenge);
90 return encoded_challenge; 91 return encoded_challenge;
91 } 92 }
92 93
93 void AddVectorHeaderIfNonEmpty(const char* name, 94 void AddVectorHeaderIfNonEmpty(const char* name,
94 const std::vector<std::string>& value, 95 const std::vector<std::string>& value,
95 HttpRequestHeaders* headers) { 96 HttpRequestHeaders* headers) {
96 if (value.empty()) 97 if (value.empty())
97 return; 98 return;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 593 }
593 OnFailure("Error during WebSocket handshake: " + failure_message); 594 OnFailure("Error during WebSocket handshake: " + failure_message);
594 return ERR_INVALID_RESPONSE; 595 return ERR_INVALID_RESPONSE;
595 } 596 }
596 597
597 void WebSocketBasicHandshakeStream::OnFailure(const std::string& message) { 598 void WebSocketBasicHandshakeStream::OnFailure(const std::string& message) {
598 stream_request_->OnFailure(message); 599 stream_request_->OnFailure(message);
599 } 600 }
600 601
601 } // namespace net 602 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_job_factory_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698