summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-08-13 06:50:21 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-08-13 06:50:21 +0200
commit60589fcd0c7afc4f4cf0d832fd603ae75bc9c71a (patch)
treed7595339d4470c2580e413a6867ab9272254e833 /src
parent735604976485ab69cd813d13ef53505bc454c201 (diff)
Cleaning up the Handle API a bit.
Diffstat (limited to 'src')
-rw-r--r--src/HttpServer.cc6
-rw-r--r--src/SimpleMustache.cc12
2 files changed, 9 insertions, 9 deletions
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: