• 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 #include "nghttp2_config.h"
26 
27 #include <nghttp2/asio_http2_server.h>
28 
29 #include "asio_server_response_impl.h"
30 
31 #include "template.h"
32 
33 namespace nghttp2 {
34 namespace asio_http2 {
35 namespace server {
36 
response()37 response::response() : impl_(std::make_unique<response_impl>()) {}
38 
~response()39 response::~response() {}
40 
write_head(unsigned int status_code,header_map h) const41 void response::write_head(unsigned int status_code, header_map h) const {
42   impl_->write_head(status_code, std::move(h));
43 }
44 
end(std::string data) const45 void response::end(std::string data) const { impl_->end(std::move(data)); }
46 
end(generator_cb cb) const47 void response::end(generator_cb cb) const { impl_->end(std::move(cb)); }
48 
write_trailer(header_map h) const49 void response::write_trailer(header_map h) const {
50   impl_->write_trailer(std::move(h));
51 }
52 
on_close(close_cb cb) const53 void response::on_close(close_cb cb) const { impl_->on_close(std::move(cb)); }
54 
cancel(uint32_t error_code) const55 void response::cancel(uint32_t error_code) const { impl_->cancel(error_code); }
56 
push(boost::system::error_code & ec,std::string method,std::string path,header_map h) const57 const response *response::push(boost::system::error_code &ec,
58                                std::string method, std::string path,
59                                header_map h) const {
60   return impl_->push(ec, std::move(method), std::move(path), std::move(h));
61 }
62 
resume() const63 void response::resume() const { impl_->resume(); }
64 
status_code() const65 unsigned int response::status_code() const { return impl_->status_code(); }
66 
io_service() const67 boost::asio::io_service &response::io_service() const {
68   return impl_->io_service();
69 }
70 
impl() const71 response_impl &response::impl() const { return *impl_; }
72 
73 } // namespace server
74 } // namespace asio_http2
75 } // namespace nghttp2
76