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

Side by Side Diff: net/server/web_socket.cc

Issue 1099453002: base: Simplify the construction of MD5Digest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 5 years, 8 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/http/http_auth_handler_ntlm_portable.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/server/web_socket.h" 5 #include "net/server/web_socket.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/md5.h" 9 #include "base/md5.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 connection_->id(), 74 connection_->id(),
75 base::StringPrintf("HTTP/1.1 101 WebSocket Protocol Handshake\r\n" 75 base::StringPrintf("HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
76 "Upgrade: WebSocket\r\n" 76 "Upgrade: WebSocket\r\n"
77 "Connection: Upgrade\r\n" 77 "Connection: Upgrade\r\n"
78 "Sec-WebSocket-Origin: %s\r\n" 78 "Sec-WebSocket-Origin: %s\r\n"
79 "Sec-WebSocket-Location: %s\r\n" 79 "Sec-WebSocket-Location: %s\r\n"
80 "\r\n", 80 "\r\n",
81 origin.c_str(), 81 origin.c_str(),
82 location.c_str())); 82 location.c_str()));
83 server_->SendRaw(connection_->id(), 83 server_->SendRaw(connection_->id(),
84 std::string(reinterpret_cast<char*>(digest.a), 16)); 84 std::string(reinterpret_cast<char*>(digest), 16));
85 } 85 }
86 86
87 ParseResult Read(std::string* message) override { 87 ParseResult Read(std::string* message) override {
88 DCHECK(message); 88 DCHECK(message);
89 HttpConnection::ReadIOBuffer* read_buf = connection_->read_buf(); 89 HttpConnection::ReadIOBuffer* read_buf = connection_->read_buf();
90 if (read_buf->StartOfBuffer()[0]) 90 if (read_buf->StartOfBuffer()[0])
91 return FRAME_ERROR; 91 return FRAME_ERROR;
92 92
93 base::StringPiece data(read_buf->StartOfBuffer(), read_buf->GetSize()); 93 base::StringPiece data(read_buf->StartOfBuffer(), read_buf->GetSize());
94 size_t pos = data.find('\377', 1); 94 size_t pos = data.find('\377', 1);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 WebSocket::WebSocket(HttpServer* server, HttpConnection* connection) 251 WebSocket::WebSocket(HttpServer* server, HttpConnection* connection)
252 : server_(server), 252 : server_(server),
253 connection_(connection) { 253 connection_(connection) {
254 } 254 }
255 255
256 WebSocket::~WebSocket() { 256 WebSocket::~WebSocket() {
257 } 257 }
258 258
259 } // namespace net 259 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_ntlm_portable.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698