Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
external_url_fetcher.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 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 
19 
20 #ifndef NET_INSTAWEB_HTTP_PUBLIC_EXTERNAL_URL_FETCHER_H_
21 #define NET_INSTAWEB_HTTP_PUBLIC_EXTERNAL_URL_FETCHER_H_
22 
27 
28 namespace net_instaweb {
29 
30 class AsyncFetch;
31 class MessageHandler;
32 class RequestHeaders;
33 
36 
40  public:
42  virtual ~ExternalUrlFetcher() {}
43 
46  virtual void Fetch(const GoogleString& url,
47  MessageHandler* message_handler,
48  AsyncFetch* fetch);
49 
51  static const char kDefaultUserAgent[];
52 
54  void set_binary(const GoogleString& binary);
55 
56 
57  protected:
60  virtual void AppendHeaders(const RequestHeaders& request_headers,
61  StringVector* escaped_headers);
62 
63  GoogleString binary_;
64 
65  private:
66  virtual const char* GetFetchLabel() = 0;
67 
73  virtual GoogleString ConstructFetchCommand(
74  const GoogleString& escaped_url,
75  const char* user_agent,
76  const StringVector& escaped_headers) = 0;
77 
78 
79 };
80 
81 }
82 
83 #endif
Read/write API for HTTP request (RequestHeaders is a misnomer).
Definition: request_headers.h:32
static const char kDefaultUserAgent[]
Default user agent to use.
Definition: external_url_fetcher.h:51
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: async_fetch.h:53
void set_binary(const GoogleString &binary)
Sets the path to "binary" when fetching using "how".
Definition: external_url_fetcher.h:39
Definition: message_handler.h:39
virtual void Fetch(const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)
virtual void AppendHeaders(const RequestHeaders &request_headers, StringVector *escaped_headers)
Definition: url_async_fetcher.h:33