Skip to content
This repository was archived by the owner on Jun 12, 2018. It is now read-only.

Commit 600fbe3

Browse files
committed
Possible implementation for fixing #106
1 parent 91d01fb commit 600fbe3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

server_http.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ namespace SimpleWeb {
7474
size_t size() {
7575
return streambuf.size();
7676
}
77+
78+
/// A resource-handler can set this to true in its Response-object
79+
/// to have the server connection being close by the server after data has been sent.
80+
///
81+
/// This is useful when implementing a HTTP/1.0-server which usually closes the connection
82+
/// after the response has been sent out, without using Content-Length:-header.
83+
bool close_connection_after_send = false;
7784
};
7885

7986
class Content : public std::istream {
@@ -394,6 +401,9 @@ namespace SimpleWeb {
394401
return;
395402
}
396403

404+
if (response->close_connection_after_send)
405+
return;
406+
397407
auto range=request->header.equal_range("Connection");
398408
for(auto it=range.first;it!=range.second;it++) {
399409
if(boost::iequals(it->second, "close"))

0 commit comments

Comments
 (0)