00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00018
00019 #ifndef NET_INSTAWEB_HTTP_PUBLIC_HTTP_DUMP_URL_ASYNC_WRITER_H_
00020 #define NET_INSTAWEB_HTTP_PUBLIC_HTTP_DUMP_URL_ASYNC_WRITER_H_
00021
00022 #include "net/instaweb/http/public/url_async_fetcher.h"
00023 #include "net/instaweb/http/public/http_dump_url_fetcher.h"
00024 #include "net/instaweb/util/public/basictypes.h"
00025 #include "net/instaweb/util/public/string.h"
00026 #include "net/instaweb/util/public/string_util.h"
00027
00028 namespace net_instaweb {
00029
00030 class FileSystem;
00031 class MessageHandler;
00032 class RequestHeaders;
00033 class ResponseHeaders;
00034 class Timer;
00035 class Writer;
00036
00041 class HttpDumpUrlAsyncWriter : public UrlAsyncFetcher {
00042 public:
00043 HttpDumpUrlAsyncWriter(const StringPiece& root_dir,
00044 UrlAsyncFetcher* base_fetcher,
00045 FileSystem* file_system,
00046 Timer* timer)
00047 : dump_fetcher_(root_dir, file_system, timer),
00048 base_fetcher_(base_fetcher),
00049 file_system_(file_system),
00050 accept_gzip_(true) {
00051 root_dir.CopyToString(&root_dir_);
00052 }
00053 virtual ~HttpDumpUrlAsyncWriter();
00054
00055 virtual bool SupportsHttps() const { return base_fetcher_->SupportsHttps(); }
00056
00058 virtual bool StreamingFetch(const GoogleString& url,
00059 const RequestHeaders& request_headers,
00060 ResponseHeaders* response_headers,
00061 Writer* response_writer,
00062 MessageHandler* message_handler,
00063 Callback* callback);
00064
00068 void set_accept_gzip(bool x) { accept_gzip_ = x; }
00069
00070 private:
00072 class Fetch;
00073
00074 HttpDumpUrlFetcher dump_fetcher_;
00076 UrlAsyncFetcher* base_fetcher_;
00077 GoogleString root_dir_;
00078 FileSystem* file_system_;
00079 bool accept_gzip_;
00080
00081 DISALLOW_COPY_AND_ASSIGN(HttpDumpUrlAsyncWriter);
00082 };
00083
00084 }
00085
00086 #endif ///< NET_INSTAWEB_HTTP_PUBLIC_HTTP_DUMP_URL_ASYNC_WRITER_H_