NCBI C++ ToolKit
ncbi_http2_session.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef CONNECT__NCBI_HTTP2_SESSION__HPP
2 #define CONNECT__NCBI_HTTP2_SESSION__HPP
3 
4 /* $Id: ncbi_http2_session.hpp 98424 2022-11-10 20:03:42Z sadyrovr $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Rafael Sadyrov
30  *
31  */
32 
33 #include "ncbi_http_session.hpp"
34 
35 
37 
38 
39 /// @sa CHttpSession_Base
41 {
42 public:
43  CHttp2Session();
44 
45  /// Get an API lock.
46  /// Holding this API lock is essential if numerous short-lived session instances are used.
47  /// It prevents an internal I/O implementation (TCP connections, HTTP sessions, etc)
48  /// from being destroyed (on destroying last remaining session instance)
49  /// and then re-created (with new session instance).
50  using TApiLock = shared_ptr<void>;
51  static TApiLock GetApiLock();
52 
53 private:
54  void x_StartRequest(CHttpSession_Base::EProtocol protocol, CHttpRequest& req, bool use_form_data) override;
55  bool x_Downgrade(CHttpResponse& resp, CHttpSession_Base::EProtocol& protocol) const override;
56 
57  static void UpdateResponse(CHttpRequest& req, CHttpHeaders::THeaders headers);
58 
60 };
61 
62 
63 
64 
66 
67 
68 #endif
shared_ptr< void > TApiLock
Get an API lock.
HTTP request.
HTTP response.
HTTP session class, holding common data for multiple requests.
virtual bool x_Downgrade(CHttpResponse &resp, EProtocol &protocol) const =0
virtual void x_StartRequest(EProtocol protocol, CHttpRequest &req, bool use_form_data)=0
EProtocol
HTTP protocol version.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_XXCONNECT2_EXPORT
Definition: ncbi_export.h:1530
Modified on Thu Jul 18 16:05:49 2024 by modify_doxy.py rev. 669887