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

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

Issue 1050013002: [WebSocketExtensionParser] Have Consume.* methods return bool instead of using has_error() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary variable 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_encoder.h" 5 #include "net/server/web_socket_encoder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 *has_client_window_bits = false; 244 *has_client_window_bits = false;
245 *client_window_bits = 15; 245 *client_window_bits = 15;
246 *server_window_bits = 15; 246 *server_window_bits = 15;
247 *client_no_context_takeover = false; 247 *client_no_context_takeover = false;
248 *server_no_context_takeover = false; 248 *server_no_context_takeover = false;
249 249
250 if (header_value.empty()) 250 if (header_value.empty())
251 return; 251 return;
252 252
253 WebSocketExtensionParser parser; 253 WebSocketExtensionParser parser;
254 parser.Parse(header_value); 254 if (!parser.Parse(header_value))
255 if (parser.has_error())
256 return; 255 return;
257 const std::vector<WebSocketExtension>& extensions = parser.extensions(); 256 const std::vector<WebSocketExtension>& extensions = parser.extensions();
258 // TODO(tyoshino): Fail if this method is used for parsing a response and 257 // TODO(tyoshino): Fail if this method is used for parsing a response and
259 // there are multiple permessage-deflate extensions or there are any unknown 258 // there are multiple permessage-deflate extensions or there are any unknown
260 // extensions. 259 // extensions.
261 for (const auto& extension : extensions) { 260 for (const auto& extension : extensions) {
262 if (extension.name() != "permessage-deflate") { 261 if (extension.name() != "permessage-deflate") {
263 continue; 262 continue;
264 } 263 }
265 264
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 return false; 376 return false;
378 scoped_refptr<IOBufferWithSize> buffer = 377 scoped_refptr<IOBufferWithSize> buffer =
379 deflater_->GetOutput(deflater_->CurrentOutputSize()); 378 deflater_->GetOutput(deflater_->CurrentOutputSize());
380 if (!buffer.get()) 379 if (!buffer.get())
381 return false; 380 return false;
382 *output = std::string(buffer->data(), buffer->size()); 381 *output = std::string(buffer->data(), buffer->size());
383 return true; 382 return true;
384 } 383 }
385 384
386 } // namespace net 385 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/websockets/websocket_basic_handshake_stream.cc » ('j') | net/websockets/websocket_extension_parser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698