| Index: net/tools/balsa/balsa_frame.h
|
| diff --git a/net/tools/balsa/balsa_frame.h b/net/tools/balsa/balsa_frame.h
|
| index 8e1240c86e95873681b612313f934139556c6a9a..12f208a3ef05c60164d416fab2c0ef778e0833dd 100644
|
| --- a/net/tools/balsa/balsa_frame.h
|
| +++ b/net/tools/balsa/balsa_frame.h
|
| @@ -37,16 +37,10 @@ class BalsaFrame {
|
| // TODO(fenix): get rid of the 'kValidTerm*' stuff by using the 'since last
|
| // index' strategy. Note that this implies getting rid of the HeaderFramed()
|
|
|
| - static const uint32 kValidTerm1 = '\n' << 16 |
|
| - '\r' << 8 |
|
| - '\n';
|
| - static const uint32 kValidTerm1Mask = 0xFF << 16 |
|
| - 0xFF << 8 |
|
| - 0xFF;
|
| - static const uint32 kValidTerm2 = '\n' << 8 |
|
| - '\n';
|
| - static const uint32 kValidTerm2Mask = 0xFF << 8 |
|
| - 0xFF;
|
| + static const uint32 kValidTerm1 = '\n' << 16 | '\r' << 8 | '\n';
|
| + static const uint32 kValidTerm1Mask = 0xFF << 16 | 0xFF << 8 | 0xFF;
|
| + static const uint32 kValidTerm2 = '\n' << 8 | '\n';
|
| + static const uint32 kValidTerm2Mask = 0xFF << 8 | 0xFF;
|
| BalsaFrame();
|
| ~BalsaFrame();
|
|
|
| @@ -80,34 +74,25 @@ class BalsaFrame {
|
|
|
| void set_is_request(bool is_request) { is_request_ = is_request; }
|
|
|
| - bool is_request() const {
|
| - return is_request_;
|
| - }
|
| + bool is_request() const { return is_request_; }
|
|
|
| void set_request_was_head(bool request_was_head) {
|
| request_was_head_ = request_was_head;
|
| }
|
|
|
| - bool request_was_head() const {
|
| - return request_was_head_;
|
| - }
|
| + bool request_was_head() const { return request_was_head_; }
|
|
|
| void set_max_header_length(size_t max_header_length) {
|
| max_header_length_ = max_header_length;
|
| }
|
|
|
| - size_t max_header_length() const {
|
| - return max_header_length_;
|
| - }
|
| + size_t max_header_length() const { return max_header_length_; }
|
|
|
| void set_max_request_uri_length(size_t max_request_uri_length) {
|
| max_request_uri_length_ = max_request_uri_length;
|
| }
|
|
|
| - size_t max_request_uri_length() const {
|
| - return max_request_uri_length_;
|
| - }
|
| -
|
| + size_t max_request_uri_length() const { return max_request_uri_length_; }
|
|
|
| bool MessageFullyRead() {
|
| return parse_state_ == BalsaFrameEnums::MESSAGE_FULLY_READ;
|
| @@ -115,10 +100,7 @@ class BalsaFrame {
|
|
|
| BalsaFrameEnums::ParseState ParseState() const { return parse_state_; }
|
|
|
| -
|
| - bool Error() {
|
| - return parse_state_ == BalsaFrameEnums::PARSE_ERROR;
|
| - }
|
| + bool Error() { return parse_state_ == BalsaFrameEnums::PARSE_ERROR; }
|
|
|
| BalsaFrameEnums::ErrorCode ErrorCode() const { return last_error_; }
|
|
|
| @@ -132,7 +114,8 @@ class BalsaFrame {
|
|
|
| // Parses input and puts the key, value chunk extensions into extensions.
|
| // TODO(phython): Find a better data structure to put the extensions into.
|
| - static void ProcessChunkExtensions(const char* input, size_t size,
|
| + static void ProcessChunkExtensions(const char* input,
|
| + size_t size,
|
| BalsaHeaders* extensions);
|
|
|
| protected:
|
| @@ -147,15 +130,13 @@ class BalsaFrame {
|
|
|
| inline void ProcessTransferEncodingLine(size_t line_idx);
|
|
|
| - void ProcessFirstLine(const char* begin,
|
| - const char* end);
|
| + void ProcessFirstLine(const char* begin, const char* end);
|
|
|
| - void CleanUpKeyValueWhitespace(
|
| - const char* stream_begin,
|
| - const char* line_begin,
|
| - const char* current,
|
| - const char* line_end,
|
| - HeaderLineDescription* current_header_line);
|
| + void CleanUpKeyValueWhitespace(const char* stream_begin,
|
| + const char* line_begin,
|
| + const char* current,
|
| + const char* line_end,
|
| + HeaderLineDescription* current_header_line);
|
|
|
| void FindColonsAndParseIntoKeyValue();
|
|
|
| @@ -197,16 +178,14 @@ class BalsaFrame {
|
| return false;
|
| }
|
|
|
| - inline bool HeaderFramingMayBeFound() const {
|
| - return term_chars_ != 0;
|
| - }
|
| + inline bool HeaderFramingMayBeFound() const { return term_chars_ != 0; }
|
|
|
| private:
|
| class DoNothingBalsaVisitor : public BalsaVisitorInterface {
|
| - virtual void ProcessBodyInput(const char *input, size_t size) OVERRIDE {}
|
| - virtual void ProcessBodyData(const char *input, size_t size) OVERRIDE {}
|
| - virtual void ProcessHeaderInput(const char *input, size_t size) OVERRIDE {}
|
| - virtual void ProcessTrailerInput(const char *input, size_t size) OVERRIDE {}
|
| + virtual void ProcessBodyInput(const char* input, size_t size) OVERRIDE {}
|
| + virtual void ProcessBodyData(const char* input, size_t size) OVERRIDE {}
|
| + virtual void ProcessHeaderInput(const char* input, size_t size) OVERRIDE {}
|
| + virtual void ProcessTrailerInput(const char* input, size_t size) OVERRIDE {}
|
| virtual void ProcessHeaders(const BalsaHeaders& headers) OVERRIDE {}
|
| virtual void ProcessRequestFirstLine(const char* line_input,
|
| size_t line_length,
|
| @@ -216,16 +195,16 @@ class BalsaFrame {
|
| size_t request_uri_length,
|
| const char* version_input,
|
| size_t version_length) OVERRIDE {}
|
| - virtual void ProcessResponseFirstLine(const char *line_input,
|
| + virtual void ProcessResponseFirstLine(const char* line_input,
|
| size_t line_length,
|
| - const char *version_input,
|
| + const char* version_input,
|
| size_t version_length,
|
| - const char *status_input,
|
| + const char* status_input,
|
| size_t status_length,
|
| - const char *reason_input,
|
| + const char* reason_input,
|
| size_t reason_length) OVERRIDE {}
|
| virtual void ProcessChunkLength(size_t chunk_length) OVERRIDE {}
|
| - virtual void ProcessChunkExtensions(const char *input,
|
| + virtual void ProcessChunkExtensions(const char* input,
|
| size_t size) OVERRIDE {}
|
| virtual void HeaderDone() OVERRIDE {}
|
| virtual void MessageDone() OVERRIDE {}
|
| @@ -262,4 +241,3 @@ class BalsaFrame {
|
| } // namespace net
|
|
|
| #endif // NET_TOOLS_BALSA_BALSA_FRAME_H_
|
| -
|
|
|