xref: /aosp_15_r20/external/cronet/net/spdy/multiplexed_http_stream.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2016 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_SPDY_MULTIPLEXED_HTTP_STREAM_H_
6 #define NET_SPDY_MULTIPLEXED_HTTP_STREAM_H_
7 
8 #include <memory>
9 #include <vector>
10 
11 #include "net/http/http_stream.h"
12 #include "net/spdy/multiplexed_session.h"
13 #include "net/third_party/quiche/src/quiche/spdy/core/http2_header_block.h"
14 
15 namespace net {
16 
17 // Base class for SPDY and QUIC HttpStream subclasses.
18 class NET_EXPORT_PRIVATE MultiplexedHttpStream : public HttpStream {
19  public:
20   explicit MultiplexedHttpStream(
21       std::unique_ptr<MultiplexedSessionHandle> session);
22   ~MultiplexedHttpStream() override;
23 
24   int GetRemoteEndpoint(IPEndPoint* endpoint) override;
25   void GetSSLInfo(SSLInfo* ssl_info) override;
26   void Drain(HttpNetworkSession* session) override;
27   std::unique_ptr<HttpStream> RenewStreamForAuth() override;
28   void SetConnectionReused() override;
29   bool CanReuseConnection() const override;
30 
31   // Caches SSL info from the underlying session.
32   void SaveSSLInfo();
33   void SetRequestHeadersCallback(RequestHeadersCallback callback) override;
34 
35  protected:
36   void DispatchRequestHeadersCallback(
37       const spdy::Http2HeaderBlock& spdy_headers);
38 
session()39   MultiplexedSessionHandle* session() { return session_.get(); }
session()40   const MultiplexedSessionHandle* session() const { return session_.get(); }
41 
42  private:
43   const std::unique_ptr<MultiplexedSessionHandle> session_;
44   RequestHeadersCallback request_headers_callback_;
45 };
46 
47 }  // namespace net
48 
49 #endif  // NET_SPDY_MULTIPLEXED_HTTP_STREAM_H_
50