Skip to content

Commit 3562f27

Browse files
committed
Fixing bugs with HTTP Server implementation.
1 parent c356c16 commit 3562f27

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

boost/network/protocol/http/connection.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ namespace boost { namespace network { namespace http {
210210
void handle_read_body_contents(boost::system::error_code const & ec, size_t bytes_to_read, size_t bytes_transferred) {
211211
if (!ec) {
212212
size_t difference = bytes_to_read - bytes_transferred;
213-
request_.body.append(buffer_.begin(), buffer_.end());
213+
array<char,BOOST_HTTP_SERVER_BUFFER_SIZE>::iterator start = buffer_.begin(),
214+
past_end = start;
215+
std::advance(past_end, bytes_to_read);
216+
request_.body.append(buffer_.begin(), past_end);
214217
if (difference == 0) {
215218
handler_(request_, response_);
216219
boost::asio::async_write(
@@ -246,6 +249,7 @@ namespace boost { namespace network { namespace http {
246249
if (!ec) {
247250
boost::system::error_code ignored_ec;
248251
socket_.shutdown(tcp::socket::shutdown_both, ignored_ec);
252+
socket_.close(ignored_ec);
249253
}
250254
}
251255

boost/network/protocol/http/impl/request.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace boost { namespace network { namespace http {
3434
boost::network::uri::http::uri uri_;
3535

3636
public:
37+
typedef Tag tag;
3738
typedef typename string<Tag>::type string_type;
3839

3940
explicit basic_request(string_type const & uri_)
@@ -100,6 +101,7 @@ namespace boost { namespace network { namespace http {
100101
*/
101102
template <>
102103
struct basic_request<tags::http_server> {
104+
typedef tags::http_server tag;
103105
typedef string<tags::http_server>::type string_type;
104106
typedef vector<tags::http_server>::apply<request_header>::type vector_type;
105107
string_type method;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy