2014-09-21 11:28:06 +02:00
|
|
|
/*
|
|
|
|
* nghttp2 - HTTP/2 C Library
|
|
|
|
*
|
2015-03-05 13:42:48 +01:00
|
|
|
* Copyright (c) 2015 Tatsuhiro Tsujikawa
|
2014-09-21 11:28:06 +02:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
2015-03-05 13:42:48 +01:00
|
|
|
#include "asio_server_request_impl.h"
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
namespace nghttp2 {
|
|
|
|
namespace asio_http2 {
|
|
|
|
namespace server {
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2016-02-04 15:05:05 +01:00
|
|
|
request_impl::request_impl() : strm_(nullptr), header_buffer_size_(0) {}
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
const header_map &request_impl::header() const { return header_; }
|
2015-03-04 17:52:12 +01:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
const std::string &request_impl::method() const { return method_; }
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
const uri_ref &request_impl::uri() const { return uri_; }
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
uri_ref &request_impl::uri() { return uri_; }
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
void request_impl::header(header_map h) { header_ = std::move(h); }
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
header_map &request_impl::header() { return header_; }
|
2014-11-27 15:39:04 +01:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
void request_impl::method(std::string arg) { method_ = std::move(arg); }
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
void request_impl::on_data(data_cb cb) { on_data_cb_ = std::move(cb); }
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
void request_impl::stream(class stream *s) { strm_ = s; }
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
void request_impl::call_on_data(const uint8_t *data, std::size_t len) {
|
|
|
|
if (on_data_cb_) {
|
|
|
|
on_data_cb_(data, len);
|
|
|
|
}
|
|
|
|
}
|
2014-09-21 11:28:06 +02:00
|
|
|
|
2015-12-19 14:08:15 +01:00
|
|
|
const boost::asio::ip::tcp::endpoint &request_impl::remote_endpoint() const {
|
2015-12-16 18:38:21 +01:00
|
|
|
return remote_ep_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void request_impl::remote_endpoint(boost::asio::ip::tcp::endpoint ep) {
|
2015-12-20 06:00:58 +01:00
|
|
|
remote_ep_ = std::move(ep);
|
2015-12-16 18:38:21 +01:00
|
|
|
}
|
|
|
|
|
2016-02-04 15:05:05 +01:00
|
|
|
size_t request_impl::header_buffer_size() const { return header_buffer_size_; }
|
|
|
|
|
|
|
|
void request_impl::update_header_buffer_size(size_t len) {
|
|
|
|
header_buffer_size_ += len;
|
|
|
|
}
|
|
|
|
|
2015-03-05 13:42:48 +01:00
|
|
|
} // namespace server
|
|
|
|
} // namespace asio_http2
|
|
|
|
} // namespace nghttp2
|