From 210eba9fdb9b4ed28ab0b9dcdbcaf45209a143b4 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Thu, 20 Nov 2014 14:04:16 +0100 Subject: [REST] fix headersonly flag for BINARY responses --- src/rest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/rest.cpp') diff --git a/src/rest.cpp b/src/rest.cpp index 122b36171..1aa864a30 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -100,7 +100,7 @@ static bool rest_block(AcceptedConnection *conn, switch (rf) { case RF_BINARY: { string binaryBlock = ssBlock.str(); - conn->stream() << HTTPReply(HTTP_OK, binaryBlock, fRun, true, "application/octet-stream") << binaryBlock << std::flush; + conn->stream() << HTTPReplyHeader(HTTP_OK, fRun, binaryBlock.size(), "application/octet-stream") << binaryBlock << std::flush; return true; } @@ -148,7 +148,7 @@ static bool rest_tx(AcceptedConnection *conn, switch (rf) { case RF_BINARY: { string binaryTx = ssTx.str(); - conn->stream() << HTTPReply(HTTP_OK, binaryTx, fRun, true, "application/octet-stream") << binaryTx << std::flush; + conn->stream() << HTTPReplyHeader(HTTP_OK, fRun, binaryTx.size(), "application/octet-stream") << binaryTx << std::flush; return true; } -- cgit v1.2.3 From 78bdc8103ff4c1b2f1f636f9c5564285028f3e19 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Wed, 26 Nov 2014 13:51:02 +0100 Subject: [REST] give an appropriate response in warmup phase --- src/rest.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/rest.cpp') diff --git a/src/rest.cpp b/src/rest.cpp index 1aa864a30..4953d7e71 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -188,6 +188,10 @@ bool HTTPReq_REST(AcceptedConnection *conn, bool fRun) { try { + std::string statusmessage; + if(RPCIsInWarmup(&statusmessage)) + throw RESTERR(HTTP_SERVICE_UNAVAILABLE, "Service temporarily unavailable: "+statusmessage); + for (unsigned int i = 0; i < ARRAYLEN(uri_prefixes); i++) { unsigned int plen = strlen(uri_prefixes[i].prefix); if (strURI.substr(0, plen) == uri_prefixes[i].prefix) { -- cgit v1.2.3