Remove ostream from class StreamBuffer
This commit is contained in:
@@ -248,8 +248,7 @@ static void send_encoded_path(std::string_view path, const UrlParameters ¶ms
|
||||
static void send_host_and_port(std::string_view host, int port, StreamBuffer *sb) {
|
||||
sb->write_bytes(host);
|
||||
if (port != 0) {
|
||||
sb->write_char(':');
|
||||
sb->ostream() << port;
|
||||
sb->write_bytes(util::ss(":", port));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,9 +262,7 @@ static void send_protocol(bool http11, StreamBuffer *sb) {
|
||||
|
||||
static void send_content_length_header(bool http11, int size, StreamBuffer *sb) {
|
||||
if (http11) {
|
||||
sb->write_bytes("Content-length: ");
|
||||
sb->ostream() << size;
|
||||
sb->write_bytes("\r\n");
|
||||
sb->write_bytes(util::ss("Content-length: ", size, "\r\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +282,7 @@ static void send_cache_control_header(bool http11, int max_age, StreamBuffer *sb
|
||||
if (max_age == 0) {
|
||||
sb->write_bytes("Cache-control: no-cache\r\n");
|
||||
} else {
|
||||
sb->ostream() << "Cache-control: max-age=" << max_age << "\r\n";
|
||||
sb->write_bytes(util::ss("Cache-control: max-age=", max_age, "\r\n"));
|
||||
}
|
||||
} else {
|
||||
sb->write_bytes("Pragma: no-cache\r\n");
|
||||
@@ -305,7 +302,7 @@ static void send_connection_header(bool http11, bool keep_alive, StreamBuffer *s
|
||||
static void send_error_response(bool http11, int code, eng::string extrainfo, StreamBuffer *sb) {
|
||||
send_protocol(http11, sb);
|
||||
eng::string errstr = status_code_to_string(code);
|
||||
sb->ostream() << " " << code << " " << errstr;
|
||||
sb->write_bytes(util::ss(" ", code, " ", errstr));
|
||||
if ((!extrainfo.empty()) && (!contains_newline(extrainfo))) {
|
||||
sb->write_bytes(": ");
|
||||
sb->write_bytes(extrainfo);
|
||||
@@ -480,7 +477,7 @@ void HttpClientRequest::send_internal(StreamBuffer *sb, bool debug_string) const
|
||||
// Add the requester IDs (debug string only)
|
||||
if (debug_string && ((request_id_ != 0) || (place_id_ != 0) || (thread_id_ != 0))) {
|
||||
sb->write_bytes("X-requester-ids: ");
|
||||
sb->ostream() << "rid=" << request_id_ << "; pid=" << place_id_ << "; tid=" << thread_id_;
|
||||
sb->write_bytes(util::ss("rid=", request_id_, "; pid=", place_id_, "; tid=", thread_id_));
|
||||
sb->write_bytes("\r\n");
|
||||
}
|
||||
|
||||
@@ -899,7 +896,7 @@ void HttpServerResponse::send_internal(StreamBuffer *sb, bool debug_string) cons
|
||||
|
||||
// Send the status line.
|
||||
send_protocol(http11_, sb);
|
||||
sb->ostream() << " " << status_ << " " << statusmsg << "\r\n";
|
||||
sb->write_bytes(util::ss(" ", status_, " ", statusmsg, "\r\n"));
|
||||
|
||||
// Send the connection header.
|
||||
if (!errstatus()) {
|
||||
|
||||
Reference in New Issue
Block a user