Chromium Code Reviews| Index: net/websockets/websocket_extension.cc |
| diff --git a/net/websockets/websocket_extension.cc b/net/websockets/websocket_extension.cc |
| index bf7a54bdbf3e17b79f4da23476525ea19d11a39e..fdb607849b86cd753037c59ee352fd62301c796c 100644 |
| --- a/net/websockets/websocket_extension.cc |
| +++ b/net/websockets/websocket_extension.cc |
| @@ -8,6 +8,7 @@ |
| #include <string> |
| #include "base/logging.h" |
| +#include "net/http/http_util.h" |
| namespace net { |
| @@ -45,4 +46,23 @@ 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; |
| + |
| + // |extension-param| must be a token and we don't need to quote it. |
| + DCHECK(HttpUtil::IsToken(param.value())); |
|
tyoshino (SeeGerritForStatus)
2015/09/17 02:24:37
the parser is ok. it's checking if the unquoted da
yhirano
2015/09/17 03:32:15
Done.
|
| + result += "=" + param.value(); |
| + } |
| + return result; |
| +} |
| + |
| } // namespace net |