Page Speed Optimization Libraries  1.9.32.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
inflating_fetch.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 #ifndef NET_INSTAWEB_HTTP_PUBLIC_INFLATING_FETCH_H_
20 #define NET_INSTAWEB_HTTP_PUBLIC_INFLATING_FETCH_H_
21 
24 #include "net/instaweb/util/public/gzip_inflater.h"
27 
28 namespace net_instaweb {
29 
30 class MessageHandler;
31 
43  public:
44  explicit InflatingFetch(AsyncFetch* fetch);
45  virtual ~InflatingFetch();
46 
50  void EnableGzipFromBackend();
51 
52  protected:
55  virtual bool HandleWrite(const StringPiece& sp, MessageHandler* handler);
56 
59  virtual void HandleHeadersComplete();
60  virtual void HandleDone(bool success);
61  virtual void Reset();
62 
63  private:
64  void InitInflater(GzipInflater::InflateType, const StringPiece& value);
65 
68  bool IsCompressionAllowedInRequest();
69 
70  scoped_ptr<GzipInflater> inflater_;
71 
73  bool request_checked_for_accept_encoding_;
74 
76  bool compression_desired_;
77 
80  bool inflate_failure_;
81 
82  DISALLOW_COPY_AND_ASSIGN(InflatingFetch);
83 };
84 
85 }
86 
87 #endif
virtual bool HandleWrite(const StringPiece &sp, MessageHandler *handler)
virtual void HandleHeadersComplete()
Definition: async_fetch.h:267
Definition: async_fetch.h:53
Definition: inflating_fetch.h:42