Removed and replaced last bits of curlpp.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2019-08-21 04:54:17 +02:00
parent ed989935ac
commit c48c1a66f2
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
6 changed files with 19 additions and 31 deletions

View File

@ -1,8 +1,7 @@
include(CMakeFindDependencyMacro)
include(GNUInstallDirs)
find_depencency(jsoncpp REQUIRED CONFIG)
find_dependency(PkgConfig REQUIRED)
pkg_check_modules(curlpp REQUIRED IMPORTED_TARGET curlpp)
find_depencency(jsoncpp CONFIG REQUIRED)
find_package(Poco COMPONENTS Foundation Net NetSSL CONFIG REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")

View File

@ -7,5 +7,6 @@ Name: ${name}
Description: @PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -l${name} -lpthread
Requires: jsoncpp curlpp
Libs: -L${libdir} -l${name} -lpthread -lPocoNet
Requires: jsoncpp
Libs.private: -lPocoFoundation -lPocoNetSSL

View File

@ -1,9 +1,7 @@
include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(curlpp REQUIRED IMPORTED_TARGET curlpp)
if(WITH_EASY)
find_package(jsoncpp REQUIRED CONFIG)
find_package(jsoncpp CONFIG REQUIRED)
endif()
# Some distributions do not contain Poco*Config.cmake recipes.
find_package(Poco COMPONENTS Foundation Net NetSSL CONFIG)
@ -33,10 +31,7 @@ target_include_directories(${PROJECT_NAME}
if(WITH_EASY)
target_link_libraries(${PROJECT_NAME}
PUBLIC pthread PkgConfig::curlpp jsoncpp_lib)
else()
target_link_libraries(${PROJECT_NAME}
PUBLIC pthread PkgConfig::curlpp)
PUBLIC pthread jsoncpp_lib)
endif()
# If no Poco*Config.cmake recipes are found, look for headers in standard dirs.

View File

@ -18,9 +18,6 @@
#include <functional> // std::bind
#include <exception>
#include <thread>
#include <curlpp/Options.hpp>
#include <curlpp/Exception.hpp>
#include <curlpp/Infos.hpp>
#include <Poco/Net/HTTPSClientSession.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPResponse.h>
@ -35,7 +32,6 @@
#include <string>
using namespace Mastodon;
namespace curlopts = curlpp::options;
using std::cerr;
using std::istream;
using std::make_unique;
@ -54,8 +50,6 @@ API::http::http(const API &api, const string &instance,
, _access_token(access_token)
, _cancel_stream(false)
{
curlpp::initialize();
Poco::Net::initializeSSL();
// FIXME: rewrite set_proxy() that it calls set_proxy() here.
@ -98,8 +92,6 @@ API::http::http(const API &api, const string &instance,
API::http::~http()
{
curlpp::terminate();
Poco::Net::uninitializeSSL();
}

View File

@ -21,6 +21,7 @@
#include <iostream>
#include <exception>
#include <Poco/Net/FilePartSource.h>
#include <Poco/URI.h>
#include "version.hpp"
#include "debug.hpp"
#include "mastodon-cpp.hpp"
@ -333,11 +334,16 @@ const parameters API::delete_params(const parameters &params,
const string Mastodon::urlencode(const std::string &str)
{
return curlpp::escape(str);
string out;
Poco::URI::encode(str, "", out);
return out;
}
const string Mastodon::urldecode(const std::string &str)
{
return curlpp::unescape(str);
string out;
Poco::URI::decode(str, out);
return out;
}
const string Mastodon::unescape_html(const string &html)

View File

@ -25,8 +25,6 @@
#include <ostream>
#include <thread>
#include <cstdint>
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <Poco/Net/HTMLForm.h>
#include "return_types.hpp"
@ -686,13 +684,12 @@ namespace Mastodon
};
/*!
* @brief Percent-encodes a string. This is done automatically, unless
* you make a custom request.
* @brief Percent-encodes a string.
*
* Calls curlpp::escape(str).
*
* The only time you should use this, is if you use
* get(const string &call, string &answer).
* This is done automatically where necessary. The only time you
* should use this, is if you use get(const string &call, string
* &answer).
*
* See RFC 3986 section 2.1 for more info.
*
@ -707,8 +704,6 @@ namespace Mastodon
/*!
* @brief Decodes a percent-encoded string.
*
* Calls curlpp::unescape(str).
*
* See RFC 3986 section 2.1 for more info.
*
* @param str The string to decode.