~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/apache/filters/http_to_spdy_filter.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 2010 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_APACHE_FILTERS_HTTP_TO_SPDY_FILTER_H_
16
 
#define MOD_SPDY_APACHE_FILTERS_HTTP_TO_SPDY_FILTER_H_
17
 
 
18
 
#include <string>
19
 
 
20
 
#include "apr_buckets.h"
21
 
#include "util_filter.h"
22
 
 
23
 
#include "base/basictypes.h"
24
 
#include "mod_spdy/common/http_to_spdy_converter.h"
25
 
 
26
 
namespace mod_spdy {
27
 
 
28
 
class SpdyStream;
29
 
 
30
 
// An Apache filter for converting HTTP data into SPDY frames and sending them
31
 
// to the output queue of a SpdyStream object.  This is intended to be the
32
 
// outermost filter in the output chain of one of our slave connections,
33
 
// essentially taking the place of the network socket.
34
 
//
35
 
// In a previous implementation of this filter, we made this a TRANSCODE-level
36
 
// filter rather than a NETWORK-level filter; this had the advantage that we
37
 
// could pull HTTP header data directly from the Apache request object, rather
38
 
// than having to parse the headers.  However, it had the disadvantage of being
39
 
// fragile -- for example, we had an additional output filter whose sole job
40
 
// was to deceive Apache into not chunking the response body, and several
41
 
// different hooks to try to make sure our output filters stayed in place even
42
 
// in the face of Apache's weird error-handling paths.  Also, using a
43
 
// NETWORK-level filter decreases the likelihood that we'll break other modules
44
 
// that try to use connection-level filters.
45
 
class HttpToSpdyFilter {
46
 
 public:
47
 
  explicit HttpToSpdyFilter(SpdyStream* stream);
48
 
  ~HttpToSpdyFilter();
49
 
 
50
 
  // Read data from the given brigade and write the result through the given
51
 
  // filter. This method is responsible for driving the HTTP to SPDY conversion
52
 
  // process.
53
 
  apr_status_t Write(ap_filter_t* filter, apr_bucket_brigade* input_brigade);
54
 
 
55
 
 private:
56
 
  class ReceiverImpl : public HttpToSpdyConverter::SpdyReceiver {
57
 
   public:
58
 
    explicit ReceiverImpl(SpdyStream* stream);
59
 
    virtual ~ReceiverImpl();
60
 
    virtual void ReceiveSynReply(net::SpdyHeaderBlock* headers, bool flag_fin);
61
 
    virtual void ReceiveData(base::StringPiece data, bool flag_fin);
62
 
 
63
 
   private:
64
 
    friend class HttpToSpdyFilter;
65
 
    SpdyStream* const stream_;
66
 
 
67
 
    DISALLOW_COPY_AND_ASSIGN(ReceiverImpl);
68
 
  };
69
 
 
70
 
  ReceiverImpl receiver_;
71
 
  HttpToSpdyConverter converter_;
72
 
  bool eos_bucket_received_;
73
 
 
74
 
  DISALLOW_COPY_AND_ASSIGN(HttpToSpdyFilter);
75
 
};
76
 
 
77
 
}  // namespace mod_spdy
78
 
 
79
 
#endif  // MOD_SPDY_APACHE_FILTERS_HTTP_TO_SPDY_FILTER_H_