blob: 1bb9a0be7cc4c67ccbe6b81fa568b1583cca3d65 [file] [log] [blame]
[email protected]5f9205f2012-06-14 19:55:231// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]8d5a34e2009-06-11 21:21:362// 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
sclittlebe1ccf62015-09-02 19:40:3612#include <stdint.h>
13
[email protected]0877e3d2009-10-17 22:29:5714#include <string>
15
Avi Drissman13fc8932015-12-20 04:40:4616#include "base/macros.h"
[email protected]f7c21732013-10-27 09:38:5817#include "net/http/http_basic_state.h"
[email protected]8d5a34e2009-06-11 21:21:3618#include "net/http/http_stream.h"
[email protected]8d5a34e2009-06-11 21:21:3619
20namespace net {
21
[email protected]9e743cd2010-03-16 07:03:5322class BoundNetLog;
[email protected]0877e3d2009-10-17 22:29:5723class ClientSocketHandle;
[email protected]0877e3d2009-10-17 22:29:5724class HttpResponseInfo;
[email protected]277d5942010-08-11 21:02:3525struct HttpRequestInfo;
[email protected]b94f92d2010-10-27 16:45:2026class HttpRequestHeaders;
[email protected]277d5942010-08-11 21:02:3527class HttpStreamParser;
28class IOBuffer;
[email protected]0877e3d2009-10-17 22:29:5729
[email protected]8d5a34e2009-06-11 21:21:3630class HttpBasicStream : public HttpStream {
31 public:
[email protected]ca14da52013-10-25 04:16:2432 // Constructs a new HttpBasicStream. InitializeStream must be called to
33 // initialize it correctly.
[email protected]f7c21732013-10-27 09:38:5834 HttpBasicStream(ClientSocketHandle* connection, bool using_proxy);
dchengb03027d2014-10-21 12:00:2035 ~HttpBasicStream() override;
[email protected]8d5a34e2009-06-11 21:21:3636
37 // HttpStream methods:
dchengb03027d2014-10-21 12:00:2038 int InitializeStream(const HttpRequestInfo* request_info,
39 RequestPriority priority,
40 const BoundNetLog& net_log,
41 const CompletionCallback& callback) override;
[email protected]c638a85a2010-07-29 18:41:4042
dchengb03027d2014-10-21 12:00:2043 int SendRequest(const HttpRequestHeaders& headers,
44 HttpResponseInfo* response,
45 const CompletionCallback& callback) override;
[email protected]8d5a34e2009-06-11 21:21:3646
dchengb03027d2014-10-21 12:00:2047 UploadProgress GetUploadProgress() const override;
[email protected]0877e3d2009-10-17 22:29:5748
dchengb03027d2014-10-21 12:00:2049 int ReadResponseHeaders(const CompletionCallback& callback) override;
[email protected]0877e3d2009-10-17 22:29:5750
dchengb03027d2014-10-21 12:00:2051 int ReadResponseBody(IOBuffer* buf,
52 int buf_len,
53 const CompletionCallback& callback) override;
[email protected]0877e3d2009-10-17 22:29:5754
dchengb03027d2014-10-21 12:00:2055 void Close(bool not_reusable) override;
[email protected]8e6441ca2010-08-19 05:56:3856
dchengb03027d2014-10-21 12:00:2057 HttpStream* RenewStreamForAuth() override;
[email protected]697ef4c2010-10-14 16:38:5858
dchengb03027d2014-10-21 12:00:2059 bool IsResponseBodyComplete() const override;
[email protected]0877e3d2009-10-17 22:29:5760
dchengb03027d2014-10-21 12:00:2061 bool IsConnectionReused() const override;
[email protected]8e6441ca2010-08-19 05:56:3862
dchengb03027d2014-10-21 12:00:2063 void SetConnectionReused() override;
[email protected]8e6441ca2010-08-19 05:56:3864
mmenkebd84c392015-09-02 14:12:3465 bool CanReuseConnection() const override;
[email protected]8e6441ca2010-08-19 05:56:3866
sclittle4de1bab92015-09-22 21:28:2467 int64_t GetTotalReceivedBytes() const override;
[email protected]bc92bc972013-12-13 08:32:5968
sclittlebe1ccf62015-09-02 19:40:3669 int64_t GetTotalSentBytes() const override;
70
dchengb03027d2014-10-21 12:00:2071 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
[email protected]b258e0792013-01-12 07:11:5972
dchengb03027d2014-10-21 12:00:2073 void GetSSLInfo(SSLInfo* ssl_info) override;
[email protected]8e6441ca2010-08-19 05:56:3874
dchengb03027d2014-10-21 12:00:2075 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override;
[email protected]2d0a4f92011-05-05 16:38:4676
ttuttled9dbc652015-09-29 20:00:5977 bool GetRemoteEndpoint(IPEndPoint* endpoint) override;
78
nharperb7441ef2016-01-25 23:54:1479 Error GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key,
80 std::vector<uint8_t>* out) override;
81
dchengb03027d2014-10-21 12:00:2082 void Drain(HttpNetworkSession* session) override;
[email protected]5a60c8b2011-10-19 20:14:2983
zhongyica364fbb2015-12-12 03:39:1284 void PopulateNetErrorDetails(NetErrorDetails* details) override;
85
dchengb03027d2014-10-21 12:00:2086 void SetPriority(RequestPriority priority) override;
[email protected]e86839fd2013-08-14 18:29:0387
[email protected]8d5a34e2009-06-11 21:21:3688 private:
[email protected]f7c21732013-10-27 09:38:5889 HttpStreamParser* parser() const { return state_.parser(); }
[email protected]0877e3d2009-10-17 22:29:5790
[email protected]f7c21732013-10-27 09:38:5891 HttpBasicState state_;
[email protected]b94f92d2010-10-27 16:45:2092
[email protected]8d5a34e2009-06-11 21:21:3693 DISALLOW_COPY_AND_ASSIGN(HttpBasicStream);
94};
95
96} // namespace net
97
98#endif // NET_HTTP_HTTP_BASIC_STREAM_H_