Correction of Server::Response::write
This commit is contained in:
parent
6b7fd993cf
commit
337ee19cef
1 changed files with 2 additions and 1 deletions
|
|
@ -94,10 +94,11 @@ namespace SimpleWeb {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience function for writing status line, header fields, and content
|
/// Convenience function for writing status line, header fields, and content
|
||||||
void write(StatusCode status_code, std::ostream &content, const CaseInsensitiveMultimap &header=CaseInsensitiveMultimap()) {
|
void write(StatusCode status_code, std::iostream &content, const CaseInsensitiveMultimap &header=CaseInsensitiveMultimap()) {
|
||||||
*this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n";
|
*this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n";
|
||||||
content.seekp(0, std::ios::end);
|
content.seekp(0, std::ios::end);
|
||||||
auto size=content.tellp();
|
auto size=content.tellp();
|
||||||
|
content.seekp(0, std::ios::beg);
|
||||||
write_header(header, size);
|
write_header(header, size);
|
||||||
if(size)
|
if(size)
|
||||||
*this << content.rdbuf();
|
*this << content.rdbuf();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue