| Index: net/websockets/websocket_extension_parser.h
|
| diff --git a/net/websockets/websocket_extension_parser.h b/net/websockets/websocket_extension_parser.h
|
| index ef7fe0366575c696f039008d4989246f6b5b43a2..6b2e4dc629873b50348d221283fe49d2afca5cc8 100644
|
| --- a/net/websockets/websocket_extension_parser.h
|
| +++ b/net/websockets/websocket_extension_parser.h
|
| @@ -6,6 +6,7 @@
|
| #define NET_WEBSOCKETS_WEBSOCKET_EXTENSION_PARSER_H_
|
|
|
| #include <string>
|
| +#include <vector>
|
|
|
| #include "base/strings/string_piece.h"
|
| #include "net/base/net_export.h"
|
| @@ -18,21 +19,24 @@ class NET_EXPORT_PRIVATE WebSocketExtensionParser {
|
| WebSocketExtensionParser();
|
| ~WebSocketExtensionParser();
|
|
|
| - // Parses the given string as a WebSocket extension header value.
|
| - // This parser assumes some preprocesses are made.
|
| - // - The parser parses single extension at a time. This means that
|
| - // the parser parses |extension| in RFC6455 9.1, not |extension-list|.
|
| - // - There is no newline characters in the input. LWS-concatenation must
|
| - // have already been done.
|
| + // Parses the given string as a Sec-WebSocket-Extensions header value.
|
| + //
|
| + // There must be no newline characters in the input. LWS-concatenation must
|
| + // have already been done before calling this method.
|
| void Parse(const char* data, size_t size);
|
| void Parse(const std::string& data) {
|
| Parse(data.data(), data.size());
|
| }
|
|
|
| + // Returns true if the last Parse() method call encountered any syntax error.
|
| bool has_error() const { return has_error_; }
|
| - const WebSocketExtension& extension() const { return extension_; }
|
| + // Returns the result of the last Parse() method call.
|
| + const std::vector<WebSocketExtension>& extensions() const {
|
| + return extensions_;
|
| + }
|
|
|
| private:
|
| + // TODO(tyoshino): Make the following methods return success/fail.
|
| void Consume(char c);
|
| void ConsumeExtension(WebSocketExtension* extension);
|
| void ConsumeExtensionParameter(WebSocketExtension::Parameter* parameter);
|
| @@ -46,10 +50,12 @@ class NET_EXPORT_PRIVATE WebSocketExtensionParser {
|
| static bool IsControl(char c);
|
| static bool IsSeparator(char c);
|
|
|
| + // The current position in the input string.
|
| const char* current_;
|
| + // The pointer of the end of the input string.
|
| const char* end_;
|
| bool has_error_;
|
| - WebSocketExtension extension_;
|
| + std::vector<WebSocketExtension> extensions_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(WebSocketExtensionParser);
|
| };
|
|
|