summaryrefslogtreecommitdiffstats
path: root/net/websockets
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-10-21 18:08:46 +0100
committerKristian Monsen <kristianm@google.com>2010-10-22 15:03:20 +0100
commitd97e634a4bf554d921477cdbb73fc56f6cc053d4 (patch)
treef71819897ee48b26cdacb729991260a46d896c12 /net/websockets
parent28d70d1c88bc8a94e9a6608d68678895e6ea483b (diff)
downloadexternal_chromium-d97e634a4bf554d921477cdbb73fc56f6cc053d4.zip
external_chromium-d97e634a4bf554d921477cdbb73fc56f6cc053d4.tar.gz
external_chromium-d97e634a4bf554d921477cdbb73fc56f6cc053d4.tar.bz2
Syncing external/chromium with chromium release 61029, part 1
This is our current version, all the deleted files do not exist upstream, and are not used by us. Deleting files that are not code from net/. Also removing the flip directory since the whole folder is removed upstream and we are not using it. Change-Id: I5758ea8d8b3daa25c9182500c2f581de28ac7984
Diffstat (limited to 'net/websockets')
-rw-r--r--net/websockets/websocket_net_log_params.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/net/websockets/websocket_net_log_params.h b/net/websockets/websocket_net_log_params.h
new file mode 100644
index 0000000..a504186
--- /dev/null
+++ b/net/websockets/websocket_net_log_params.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_WEBSOCKETS_WEBSOCKET_NET_LOG_PARAMS_H_
+#define NET_WEBSOCKETS_WEBSOCKET_NET_LOG_PARAMS_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/ref_counted.h"
+#include "base/string_split.h"
+#include "base/string_util.h"
+#include "base/stringprintf.h"
+#include "base/values.h"
+#include "net/base/net_log.h"
+
+namespace net {
+
+class NetLogWebSocketHandshakeParameter : public NetLog::EventParameters {
+ public:
+ explicit NetLogWebSocketHandshakeParameter(const std::string& headers)
+ : headers_(headers) {
+ }
+
+ Value* ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ ListValue* headers = new ListValue();
+ std::vector<std::string> lines;
+ base::SplitStringDontTrim(headers_, '\n', &lines);
+ for (size_t i = 0; i < lines.size(); ++i) {
+ if (lines[i] == "\r") {
+ headers->Append(new StringValue(""));
+ // Dump WebSocket key3
+ std::string key;
+ i = i + 1;
+ for (; i < lines.size(); ++i) {
+ for (size_t j = 0; j < lines[i].length(); ++j) {
+ key += base::StringPrintf("\\x%02x", lines[i][j] & 0xff);
+ }
+ key += "\\x0a";
+ }
+ headers->Append(new StringValue(key));
+ break;
+ }
+ std::string line = lines[i];
+ if (line.length() > 0 && line[line.length() - 1] == '\r')
+ line = line.substr(0, line.length() - 1);
+ headers->Append(new StringValue(line));
+ }
+ dict->Set("headers", headers);
+ return dict;
+ }
+
+ private:
+ ~NetLogWebSocketHandshakeParameter() {}
+
+ const std::string headers_;
+
+ DISALLOW_COPY_AND_ASSIGN(NetLogWebSocketHandshakeParameter);
+};
+
+} // namespace net
+
+#endif // NET_WEBSOCKETS_WEBSOCKET_NET_LOG_PARAMS_H_