~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/mod_spdy/src/mod_spdy/common/http_string_builder.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2012 Google Inc.
2
 
//
3
 
// Licensed under the Apache License, Version 2.0 (the "License");
4
 
// you may not use this file except in compliance with the License.
5
 
// You may obtain a copy of the License at
6
 
//
7
 
//      http://www.apache.org/licenses/LICENSE-2.0
8
 
//
9
 
// Unless required by applicable law or agreed to in writing, software
10
 
// distributed under the License is distributed on an "AS IS" BASIS,
11
 
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 
// See the License for the specific language governing permissions and
13
 
// limitations under the License.
14
 
 
15
 
#ifndef MOD_SPDY_COMMON_HTTP_STRING_BUILDER_H_
16
 
#define MOD_SPDY_COMMON_HTTP_STRING_BUILDER_H_
17
 
 
18
 
#include <string>
19
 
 
20
 
#include "base/basictypes.h"
21
 
#include "mod_spdy/common/http_request_visitor_interface.h"
22
 
 
23
 
namespace mod_spdy {
24
 
 
25
 
// An HttpRequestVisitorInterface class that appends to a std::string.
26
 
class HttpStringBuilder : public HttpRequestVisitorInterface {
27
 
 public:
28
 
  explicit HttpStringBuilder(std::string* str);
29
 
  virtual ~HttpStringBuilder();
30
 
 
31
 
  bool is_complete() const { return state_ == COMPLETE; }
32
 
 
33
 
  // HttpRequestVisitorInterface methods:
34
 
  virtual void OnRequestLine(const base::StringPiece& method,
35
 
                             const base::StringPiece& path,
36
 
                             const base::StringPiece& version);
37
 
  virtual void OnLeadingHeader(const base::StringPiece& key,
38
 
                            const base::StringPiece& value);
39
 
  virtual void OnLeadingHeadersComplete();
40
 
  virtual void OnRawData(const base::StringPiece& data);
41
 
  virtual void OnDataChunk(const base::StringPiece& data);
42
 
  virtual void OnDataChunksComplete();
43
 
  virtual void OnTrailingHeader(const base::StringPiece& key,
44
 
                                const base::StringPiece& value);
45
 
  virtual void OnTrailingHeadersComplete();
46
 
  virtual void OnComplete();
47
 
 
48
 
 private:
49
 
  enum State {
50
 
    REQUEST_LINE,
51
 
    LEADING_HEADERS,
52
 
    LEADING_HEADERS_COMPLETE,
53
 
    RAW_DATA,
54
 
    DATA_CHUNKS,
55
 
    DATA_CHUNKS_COMPLETE,
56
 
    TRAILING_HEADERS,
57
 
    TRAILING_HEADERS_COMPLETE,
58
 
    COMPLETE
59
 
  };
60
 
 
61
 
  std::string* const string_;
62
 
  State state_;
63
 
 
64
 
  DISALLOW_COPY_AND_ASSIGN(HttpStringBuilder);
65
 
};
66
 
 
67
 
}  // namespace mod_spdy
68
 
 
69
 
#endif  // MOD_SPDY_COMMON_HTTP_STRING_BUILDER_H_