Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ QueryHandler::QueryHandler(string service, cxxtools::http::Request& request)
}

if ( found_json ) {
jsonObject = jsonParser.Parse(body);
jsonObject.reset(jsonParser.Parse(body));
esyslog("restfulapi: JSON parsed successfully: %s", jsonObject == NULL ? "no" : "yes");
} else {
_body.parse_url(body);
Expand All @@ -1617,13 +1617,6 @@ QueryHandler::QueryHandler(string service, cxxtools::http::Request& request)
if ( (int)_url.find(".html") != -1 ) { _format = ".html"; }
}

QueryHandler::~QueryHandler()
{
if (jsonObject != NULL) {
delete jsonObject;
}
}

/**
* fix wrong decoded urls
*/
Expand Down
4 changes: 2 additions & 2 deletions tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <exception>
#include <iostream>
#include <fstream>
#include <memory>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -268,7 +269,7 @@ class QueryHandler
cxxtools::QueryParams _options;
cxxtools::QueryParams _body;
JsonParser jsonParser;
JsonObject* jsonObject;
std::shared_ptr<JsonObject> jsonObject;
std::string fixUrl(std::string url);
void parseRestParams(std::string params);
std::string getJsonString(std::string name);
Expand All @@ -277,7 +278,6 @@ class QueryHandler
std::string _format;
public:
QueryHandler(std::string service, cxxtools::http::Request& request);
~QueryHandler();
bool has(std::string name);
bool hasJson(std::string name);
bool hasOption(std::string name);
Expand Down