| Index: net/websockets/websocket_extension.cc
|
| diff --git a/net/websockets/websocket_extension.cc b/net/websockets/websocket_extension.cc
|
| index bf7a54bdbf3e17b79f4da23476525ea19d11a39e..f1e6a24090ccf8831125ba916f043ec7780365f5 100644
|
| --- a/net/websockets/websocket_extension.cc
|
| +++ b/net/websockets/websocket_extension.cc
|
| @@ -45,4 +45,35 @@ bool WebSocketExtension::Equals(const WebSocketExtension& other) const {
|
| return this_parameters == other_parameters;
|
| }
|
|
|
| +std::string WebSocketExtension::ToString() const {
|
| + if (name_.empty()) {
|
| + return std::string();
|
| + }
|
| +
|
| + std::string result = name_;
|
| +
|
| + for (const auto& param : parameters_) {
|
| + result += "; " + param.name();
|
| + if (!param.HasValue())
|
| + continue;
|
| +
|
| + result += "=";
|
| + const auto& value = param.value();
|
| + if (value.find('"') == std::string::npos) {
|
| + result += value;
|
| + } else {
|
| + result += '"';
|
| + for (const auto& c : value) {
|
| + if (c == '"') {
|
| + result += "\\\"";
|
| + } else {
|
| + result += c;
|
| + }
|
| + }
|
| + result += '"';
|
| + }
|
| + }
|
| + return result;
|
| +}
|
| +
|
| } // namespace net
|
|
|