From 60589fcd0c7afc4f4cf0d832fd603ae75bc9c71a Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 13 Aug 2013 06:50:21 +0200 Subject: Cleaning up the Handle API a bit. --- src/HttpServer.cc | 6 +++--- src/SimpleMustache.cc | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 140fe78..53e3da0 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -213,7 +213,7 @@ void Balau::HttpWorker::sendError(int error, const char * msg, const char * deta for (String & str : extraHeaders) headers += str + "\r\n"; headers += "\r\n"; - m_socket->forceWrite(headers); + m_socket->writeString(headers); if (m_socket->isClosed()) return; tpl->render(m_socket, &ctx); } else { @@ -231,7 +231,7 @@ void Balau::HttpWorker::sendError(int error, const char * msg, const char * deta for (String & str : extraHeaders) headers += str + "\r\n"; headers += "\r\n"; - m_socket->forceWrite(headers); + m_socket->writeString(headers); if (m_socket->isClosed()) return; m_socket->forceWrite(errorText->getBuffer(), length); } @@ -676,7 +676,7 @@ void Balau::HttpServer::Response::Flush() { String response(m_responseCode); headers->writeString(response); headers->writeString(" "); - headers->writeString(Http::getStatusMsg(m_responseCode), -1); + headers->writeString(Http::getStatusMsg(m_responseCode)); headers->writeString("\r\nContent-Type: "); headers->writeString(m_type); headers->writeString("\r\nContent-Length: "); diff --git a/src/SimpleMustache.cc b/src/SimpleMustache.cc index eef4b01..557a183 100644 --- a/src/SimpleMustache.cc +++ b/src/SimpleMustache.cc @@ -376,7 +376,7 @@ Balau::SimpleMustache::Fragments::const_iterator Balau::SimpleMustache::render_r for (cur = begin; cur != end; cur++) { Fragment * fr = *cur; if(fr->type == Fragment::STRING) - h->write(fr->str); + h->writeString(fr->str); } return end; } @@ -395,16 +395,16 @@ Balau::SimpleMustache::Fragments::const_iterator Balau::SimpleMustache::render_r IAssert(fr->type != Fragment::END_SECTION, "Processing an end section tag... ?"); switch (fr->type) { case Fragment::STRING: - h->write(fr->str); + h->writeString(fr->str); break; case Fragment::VARIABLE: f = sCtx->find(fr->str); if (f != sCtx->end()) { Context * var = f->second; if (var->m_type == Context::STRING) - h->write(escape(var->m_str)); + h->writeString(escape(var->m_str)); else if (var->m_type == Context::BOOLSEC) - h->write(var->m_bool ? "true" : "false"); + h->writeString(var->m_bool ? "true" : "false"); } break; case Fragment::NOESCAPE: @@ -412,9 +412,9 @@ Balau::SimpleMustache::Fragments::const_iterator Balau::SimpleMustache::render_r if (f != sCtx->end()) { Context * var = f->second; if (var->m_type == Context::STRING) - h->write(var->m_str); + h->writeString(var->m_str); else if (var->m_type == Context::BOOLSEC) - h->write(var->m_bool ? "true" : "false"); + h->writeString(var->m_bool ? "true" : "false"); } break; case Fragment::SECTION: -- cgit v1.2.3