summaryrefslogtreecommitdiff
path: root/indra/llmessage/llcorehttputil.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-08-28 20:47:43 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-08-28 20:47:43 -0400
commitcde1174345224d33d6b45b1e3243fa39043223e5 (patch)
tree6c8db6e0499622d8c7206a11c997eb173ebd478f /indra/llmessage/llcorehttputil.cpp
parent6f454ad8366ed33bbe199c3fc3ed69e6d3448cec (diff)
parent35efadf78315f9b351415930dca4fae251ef4dd0 (diff)
Merge branch 'main' into release/luau-scripting.
Diffstat (limited to 'indra/llmessage/llcorehttputil.cpp')
-rw-r--r--indra/llmessage/llcorehttputil.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp
index dcc0b59d07..684e96883f 100644
--- a/indra/llmessage/llcorehttputil.cpp
+++ b/indra/llmessage/llcorehttputil.cpp
@@ -35,8 +35,7 @@
#include "llsd.h"
#include "llsdjson.h"
#include "llsdserialize.h"
-#include "json/reader.h" // JSON
-#include "json/writer.h" // JSON
+#include "boost/json.hpp" // Boost.Json
#include "llfilesystem.h"
#include "message.h" // for getting the port
@@ -585,15 +584,12 @@ LLSD HttpCoroJSONHandler::handleSuccess(LLCore::HttpResponse * response, LLCore:
}
LLCore::BufferArrayStream bas(body);
- Json::Value jsonRoot;
- try
- {
- bas >> jsonRoot;
- }
- catch (std::runtime_error& e)
+ boost::json::error_code ec;
+ boost::json::value jsonRoot = boost::json::parse(bas, ec);
+ if(ec.failed())
{ // deserialization failed. Record the reason and pass back an empty map for markup.
- status = LLCore::HttpStatus(499, std::string(e.what()));
+ status = LLCore::HttpStatus(499, std::string(ec.what()));
return result;
}
@@ -613,13 +609,10 @@ LLSD HttpCoroJSONHandler::parseBody(LLCore::HttpResponse *response, bool &succes
}
LLCore::BufferArrayStream bas(body);
- Json::Value jsonRoot;
- try
- {
- bas >> jsonRoot;
- }
- catch (std::runtime_error&)
+ boost::json::error_code ec;
+ boost::json::value jsonRoot = boost::json::parse(bas, ec);
+ if (ec.failed())
{
success = false;
return LLSD();
@@ -802,12 +795,12 @@ LLSD HttpCoroutineAdapter::postJsonAndSuspend(LLCore::HttpRequest::ptr_t request
{
LLCore::BufferArrayStream outs(rawbody.get());
- Json::Value root = LlsdToJson(body);
- Json::FastWriter writer;
+ auto root = LlsdToJson(body);
+ std::string value = boost::json::serialize(root);
- LL_WARNS("Http::post") << "JSON Generates: \"" << writer.write(root) << "\"" << LL_ENDL;
+ LL_WARNS("Http::post") << "JSON Generates: \"" << value << "\"" << LL_ENDL;
- outs << writer.write(root);
+ outs << value;
}
return postAndSuspend_(request, url, rawbody, options, headers, httpHandler);
@@ -861,11 +854,11 @@ LLSD HttpCoroutineAdapter::putJsonAndSuspend(LLCore::HttpRequest::ptr_t request,
{
LLCore::BufferArrayStream outs(rawbody.get());
- Json::Value root = LlsdToJson(body);
- Json::FastWriter writer;
+ auto root = LlsdToJson(body);
+ std::string value = boost::json::serialize(root);
- LL_WARNS("Http::put") << "JSON Generates: \"" << writer.write(root) << "\"" << LL_ENDL;
- outs << writer.write(root);
+ LL_WARNS("Http::put") << "JSON Generates: \"" << value << "\"" << LL_ENDL;
+ outs << value;
}
return putAndSuspend_(request, url, rawbody, options, headers, httpHandler);