| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 // | |
| 5 // HttpBasicStream is a simple implementation of HttpStream. It assumes it is | |
| 6 // not sharing a sharing with any other HttpStreams, therefore it just reads and | |
| 7 // writes directly to the Http Stream. | |
| 8 | |
| 9 #ifndef NET_HTTP_HTTP_BASIC_STREAM_H_ | |
| 10 #define NET_HTTP_HTTP_BASIC_STREAM_H_ | |
| 11 | |
| 12 #include <string> | |
| 13 | |
| 14 #include "base/basictypes.h" | |
| 15 #include "net/http/http_basic_state.h" | |
| 16 #include "net/http/http_stream.h" | |
| 17 | |
| 18 namespace net { | |
| 19 | |
| 20 class BoundNetLog; | |
| 21 class ClientSocketHandle; | |
| 22 class HttpResponseInfo; | |
| 23 struct HttpRequestInfo; | |
| 24 class HttpRequestHeaders; | |
| 25 class HttpStreamParser; | |
| 26 class IOBuffer; | |
| 27 | |
| 28 class HttpBasicStream : public HttpStream { | |
| 29 public: | |
| 30 // Constructs a new HttpBasicStream. InitializeStream must be called to | |
| 31 // initialize it correctly. | |
| 32 HttpBasicStream(ClientSocketHandle* connection, bool using_proxy); | |
| 33 ~HttpBasicStream() override; | |
| 34 | |
| 35 // HttpStream methods: | |
| 36 int InitializeStream(const HttpRequestInfo* request_info, | |
| 37 RequestPriority priority, | |
| 38 const BoundNetLog& net_log, | |
| 39 const CompletionCallback& callback) override; | |
| 40 | |
| 41 int SendRequest(const HttpRequestHeaders& headers, | |
| 42 HttpResponseInfo* response, | |
| 43 const CompletionCallback& callback) override; | |
| 44 | |
| 45 UploadProgress GetUploadProgress() const override; | |
| 46 | |
| 47 int ReadResponseHeaders(const CompletionCallback& callback) override; | |
| 48 | |
| 49 int ReadResponseBody(IOBuffer* buf, | |
| 50 int buf_len, | |
| 51 const CompletionCallback& callback) override; | |
| 52 | |
| 53 void Close(bool not_reusable) override; | |
| 54 | |
| 55 HttpStream* RenewStreamForAuth() override; | |
| 56 | |
| 57 bool IsResponseBodyComplete() const override; | |
| 58 | |
| 59 bool CanFindEndOfResponse() const override; | |
| 60 | |
| 61 bool IsConnectionReused() const override; | |
| 62 | |
| 63 void SetConnectionReused() override; | |
| 64 | |
| 65 bool IsConnectionReusable() const override; | |
| 66 | |
| 67 int64 GetTotalReceivedBytes() const override; | |
| 68 | |
| 69 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; | |
| 70 | |
| 71 void GetSSLInfo(SSLInfo* ssl_info) override; | |
| 72 | |
| 73 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; | |
| 74 | |
| 75 bool IsSpdyHttpStream() const override; | |
| 76 | |
| 77 void Drain(HttpNetworkSession* session) override; | |
| 78 | |
| 79 void SetPriority(RequestPriority priority) override; | |
| 80 | |
| 81 private: | |
| 82 HttpStreamParser* parser() const { return state_.parser(); } | |
| 83 | |
| 84 HttpBasicState state_; | |
| 85 | |
| 86 DISALLOW_COPY_AND_ASSIGN(HttpBasicStream); | |
| 87 }; | |
| 88 | |
| 89 } // namespace net | |
| 90 | |
| 91 #endif // NET_HTTP_HTTP_BASIC_STREAM_H_ | |
| OLD | NEW |