Index: net/quic/quic_utils.cc |
diff --git a/net/quic/quic_utils.cc b/net/quic/quic_utils.cc |
index d786a959d77ae8bf76a4105b70b66e7519589712..f1446512e86e63a06225dc0dd304eac394756535 100644 |
--- a/net/quic/quic_utils.cc |
+++ b/net/quic/quic_utils.cc |
@@ -7,12 +7,15 @@ |
#include <ctype.h> |
#include <algorithm> |
+#include <vector> |
#include "base/basictypes.h" |
+#include "base/containers/adapters.h" |
#include "base/logging.h" |
#include "base/port.h" |
#include "base/strings/stringprintf.h" |
#include "base/strings/string_number_conversions.h" |
+#include "base/strings/string_split.h" |
#include "net/quic/quic_write_blocked_list.h" |
using base::StringPiece; |
@@ -280,6 +283,25 @@ string QuicUtils::TagToString(QuicTag tag) { |
} |
// static |
+QuicTagVector QuicUtils::ParseQuicConnectionOptions( |
+ const std::string& connection_options) { |
+ QuicTagVector options; |
+ std::vector<std::string> tokens; |
+ base::SplitString(connection_options, ',', &tokens); |
+ // Tokens are expected to be no more than 4 characters long, but we |
+ // handle overflow gracefully. |
+ for (const std::string& token : tokens) { |
+ uint32 option = 0; |
+ for (char token_char : base::Reversed(token)) { |
+ option <<= 8; |
+ option |= static_cast<unsigned char>(token_char); |
+ } |
+ options.push_back(option); |
+ } |
+ return options; |
+} |
+ |
+// static |
string QuicUtils::StringToHexASCIIDump(StringPiece in_buffer) { |
int offset = 0; |
const int kBytesPerLine = 16; // Max bytes dumped per line |