Commit 0edcb223 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[torque-ls] Fix Json serialization

Stringification of Json wrongly used quotes for "true", "false" and
"null".

Drive-by: Manually flush std::cout when sending messages. This might
fix the server on windows.

R=tebbi@chromium.org

Bug: v8:8880
Change-Id: Ie499595a1b429514c5d8b1d3ece24f4690ece02e
Reviewed-on: https://chromium-review.googlesource.com/c/1498132Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59992}
parent df1279bf
...@@ -24,10 +24,10 @@ void SerializeToString(std::stringstream& str, const JsonValue& value) { ...@@ -24,10 +24,10 @@ void SerializeToString(std::stringstream& str, const JsonValue& value) {
str << StringLiteralQuote(value.ToString()); str << StringLiteralQuote(value.ToString());
break; break;
case JsonValue::IS_NULL: case JsonValue::IS_NULL:
str << "\"null\""; str << "null";
break; break;
case JsonValue::BOOL: case JsonValue::BOOL:
str << (value.ToBool() ? "\"true\"" : "\"false\""); str << (value.ToBool() ? "true" : "false");
break; break;
case JsonValue::OBJECT: { case JsonValue::OBJECT: {
str << "{"; str << "{";
......
...@@ -54,7 +54,7 @@ void WriteMessage(JsonValue& message) { ...@@ -54,7 +54,7 @@ void WriteMessage(JsonValue& message) {
Logger::Log("[outgoing] ", content, "\n\n"); Logger::Log("[outgoing] ", content, "\n\n");
std::cout << kContentLength << content.size() << "\r\n\r\n"; std::cout << kContentLength << content.size() << "\r\n\r\n";
std::cout << content; std::cout << content << std::flush;
} }
namespace { namespace {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment