• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * nghttp2 - HTTP/2 C Library
3  *
4  * Copyright (c) 2015 Tatsuhiro Tsujikawa
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be
15  * included in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 #ifndef ASIO_SERVER_REQUEST_IMPL_H
26 #define ASIO_SERVER_REQUEST_IMPL_H
27 
28 #include "nghttp2_config.h"
29 
30 #include <nghttp2/asio_http2_server.h>
31 #include <boost/asio/ip/tcp.hpp>
32 
33 namespace nghttp2 {
34 namespace asio_http2 {
35 namespace server {
36 
37 class stream;
38 
39 class request_impl {
40 public:
41   request_impl();
42 
43   void header(header_map h);
44   const header_map &header() const;
45   header_map &header();
46 
47   void method(std::string method);
48   const std::string &method() const;
49 
50   const uri_ref &uri() const;
51   uri_ref &uri();
52 
53   void on_data(data_cb cb);
54 
55   void stream(class stream *s);
56   void call_on_data(const uint8_t *data, std::size_t len);
57 
58   const boost::asio::ip::tcp::endpoint &remote_endpoint() const;
59   void remote_endpoint(boost::asio::ip::tcp::endpoint ep);
60 
61   size_t header_buffer_size() const;
62   void update_header_buffer_size(size_t len);
63 
64 private:
65   class stream *strm_;
66   header_map header_;
67   std::string method_;
68   uri_ref uri_;
69   data_cb on_data_cb_;
70   boost::asio::ip::tcp::endpoint remote_ep_;
71   size_t header_buffer_size_;
72 };
73 
74 } // namespace server
75 } // namespace asio_http2
76 } // namespace nghttp2
77 
78 #endif // ASIO_SERVER_REQUEST_IMPL_H
79