mastodonpp/docs/classmastodonpp_1_1CURLWrapper.html
2020-01-16 18:34:50 +01:00

989 lines
70 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>mastodonpp: mastodonpp::CURLWrapper Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">mastodonpp
&#160;<span id="projectnumber">0.4.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacemastodonpp.html">mastodonpp</a></li><li class="navelem"><a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="classmastodonpp_1_1CURLWrapper-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">mastodonpp::CURLWrapper Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Handles the details of network connections.
<a href="classmastodonpp_1_1CURLWrapper.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="curl__wrapper_8hpp_source.html">mastodonpp/curl_wrapper.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for mastodonpp::CURLWrapper:</div>
<div class="dyncontent">
<div class="center">
<img src="classmastodonpp_1_1CURLWrapper.png" usemap="#mastodonpp::CURLWrapper_map" alt=""/>
<map id="mastodonpp::CURLWrapper_map" name="mastodonpp::CURLWrapper_map">
<area href="classmastodonpp_1_1Connection.html" title="Represents a connection to an instance. Used for requests." alt="mastodonpp::Connection" shape="rect" coords="0,56,209,80"/>
<area href="classmastodonpp_1_1Instance.html" title="Holds the access data of an instance." alt="mastodonpp::Instance" shape="rect" coords="219,56,428,80"/>
<area href="classmastodonpp_1_1Instance_1_1ObtainToken.html" title="Simplifies obtaining an OAuth 2.0 Bearer Access Token." alt="mastodonpp::Instance::ObtainToken" shape="rect" coords="438,56,647,80"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a736572303fbec7a307514e611e6a468c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a736572303fbec7a307514e611e6a468c">CURLWrapper</a> ()</td></tr>
<tr class="memdesc:a736572303fbec7a307514e611e6a468c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes curl and sets up connection. <a href="classmastodonpp_1_1CURLWrapper.html#a736572303fbec7a307514e611e6a468c">More...</a><br /></td></tr>
<tr class="separator:a736572303fbec7a307514e611e6a468c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a108929a9985c76a8e2cd1f531ac6d321"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a108929a9985c76a8e2cd1f531ac6d321">CURLWrapper</a> (const <a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;other)=delete</td></tr>
<tr class="memdesc:a108929a9985c76a8e2cd1f531ac6d321"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor. <a href="classmastodonpp_1_1CURLWrapper.html#a108929a9985c76a8e2cd1f531ac6d321">More...</a><br /></td></tr>
<tr class="separator:a108929a9985c76a8e2cd1f531ac6d321"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4d79b9a4525ac4b4b8954ccc794af0f9"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a4d79b9a4525ac4b4b8954ccc794af0f9">CURLWrapper</a> (<a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&amp;other) noexcept=delete</td></tr>
<tr class="memdesc:a4d79b9a4525ac4b4b8954ccc794af0f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move constructor. <a href="classmastodonpp_1_1CURLWrapper.html#a4d79b9a4525ac4b4b8954ccc794af0f9">More...</a><br /></td></tr>
<tr class="separator:a4d79b9a4525ac4b4b8954ccc794af0f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a350f7061c9cb54cb5992ae983db3fc19"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a350f7061c9cb54cb5992ae983db3fc19">~CURLWrapper</a> () noexcept</td></tr>
<tr class="memdesc:a350f7061c9cb54cb5992ae983db3fc19"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cleans up curl and connection. <a href="classmastodonpp_1_1CURLWrapper.html#a350f7061c9cb54cb5992ae983db3fc19">More...</a><br /></td></tr>
<tr class="separator:a350f7061c9cb54cb5992ae983db3fc19"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5f29b7f4d0b58f70bc96f362cdaa4d0a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a5f29b7f4d0b58f70bc96f362cdaa4d0a">operator=</a> (const <a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;other)=delete</td></tr>
<tr class="memdesc:a5f29b7f4d0b58f70bc96f362cdaa4d0a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy assignment operator. <a href="classmastodonpp_1_1CURLWrapper.html#a5f29b7f4d0b58f70bc96f362cdaa4d0a">More...</a><br /></td></tr>
<tr class="separator:a5f29b7f4d0b58f70bc96f362cdaa4d0a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a506cb49c00a63ef4b9d51d0d52c203dc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a506cb49c00a63ef4b9d51d0d52c203dc">operator=</a> (<a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&amp;other) noexcept=delete</td></tr>
<tr class="memdesc:a506cb49c00a63ef4b9d51d0d52c203dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move assignment operator. <a href="classmastodonpp_1_1CURLWrapper.html#a506cb49c00a63ef4b9d51d0d52c203dc">More...</a><br /></td></tr>
<tr class="separator:a506cb49c00a63ef4b9d51d0d52c203dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2b7aaf03245a0730eeb464802168aded"><td class="memItemLeft" align="right" valign="top">CURL *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a2b7aaf03245a0730eeb464802168aded">get_curl_easy_handle</a> ()</td></tr>
<tr class="memdesc:a2b7aaf03245a0730eeb464802168aded"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns pointer to the CURL easy handle. <a href="classmastodonpp_1_1CURLWrapper.html#a2b7aaf03245a0730eeb464802168aded">More...</a><br /></td></tr>
<tr class="separator:a2b7aaf03245a0730eeb464802168aded"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11a543a0821a275dfce1ad7a0e68b17f"><td class="memItemLeft" align="right" valign="top">string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a11a543a0821a275dfce1ad7a0e68b17f">escape_url</a> (const string_view url) const</td></tr>
<tr class="memdesc:a11a543a0821a275dfce1ad7a0e68b17f"><td class="mdescLeft">&#160;</td><td class="mdescRight">URL encodes the given string. <a href="classmastodonpp_1_1CURLWrapper.html#a11a543a0821a275dfce1ad7a0e68b17f">More...</a><br /></td></tr>
<tr class="separator:a11a543a0821a275dfce1ad7a0e68b17f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aed6d09b5c32d71276a851ddf321b5891"><td class="memItemLeft" align="right" valign="top">string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#aed6d09b5c32d71276a851ddf321b5891">unescape_url</a> (const string_view url) const</td></tr>
<tr class="memdesc:aed6d09b5c32d71276a851ddf321b5891"><td class="mdescLeft">&#160;</td><td class="mdescRight">URL decodes the given string . <a href="classmastodonpp_1_1CURLWrapper.html#aed6d09b5c32d71276a851ddf321b5891">More...</a><br /></td></tr>
<tr class="separator:aed6d09b5c32d71276a851ddf321b5891"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0059ecb78b53c4b3c941b19f8dc897f7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a0059ecb78b53c4b3c941b19f8dc897f7">setup_connection_properties</a> (string_view proxy, string_view access_token, string_view cainfo, string_view useragent)</td></tr>
<tr class="memdesc:a0059ecb78b53c4b3c941b19f8dc897f7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set some properties of the connection. <a href="classmastodonpp_1_1CURLWrapper.html#a0059ecb78b53c4b3c941b19f8dc897f7">More...</a><br /></td></tr>
<tr class="separator:a0059ecb78b53c4b3c941b19f8dc897f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:adc8808c3fad5397176f6755b09ee0be6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structmastodonpp_1_1answer__type.html">answer_type</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#adc8808c3fad5397176f6755b09ee0be6">make_request</a> (const <a class="el" href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100">http_method</a> &amp;method, string uri, const <a class="el" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> &amp;parameters)</td></tr>
<tr class="memdesc:adc8808c3fad5397176f6755b09ee0be6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Make a HTTP request. <a href="classmastodonpp_1_1CURLWrapper.html#adc8808c3fad5397176f6755b09ee0be6">More...</a><br /></td></tr>
<tr class="separator:adc8808c3fad5397176f6755b09ee0be6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04b3919cfb38716c5a032337e442db95"><td class="memItemLeft" align="right" valign="top">string &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a04b3919cfb38716c5a032337e442db95">get_buffer</a> ()</td></tr>
<tr class="memdesc:a04b3919cfb38716c5a032337e442db95"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a reference to the buffer libcurl writes into. <a href="classmastodonpp_1_1CURLWrapper.html#a04b3919cfb38716c5a032337e442db95">More...</a><br /></td></tr>
<tr class="separator:a04b3919cfb38716c5a032337e442db95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a892a4fc3d048798fa8e2584545b91861"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a892a4fc3d048798fa8e2584545b91861">cancel_stream</a> ()</td></tr>
<tr class="memdesc:a892a4fc3d048798fa8e2584545b91861"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cancel the stream. <a href="classmastodonpp_1_1CURLWrapper.html#a892a4fc3d048798fa8e2584545b91861">More...</a><br /></td></tr>
<tr class="separator:a892a4fc3d048798fa8e2584545b91861"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1564a42794ef7a9d170b725063ef504d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a1564a42794ef7a9d170b725063ef504d">set_proxy</a> (string_view proxy)</td></tr>
<tr class="memdesc:a1564a42794ef7a9d170b725063ef504d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the proxy to use. <a href="classmastodonpp_1_1CURLWrapper.html#a1564a42794ef7a9d170b725063ef504d">More...</a><br /></td></tr>
<tr class="separator:a1564a42794ef7a9d170b725063ef504d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a94aba6daedea376ccc20e5c983bd3358"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a94aba6daedea376ccc20e5c983bd3358">set_access_token</a> (string_view access_token)</td></tr>
<tr class="memdesc:a94aba6daedea376ccc20e5c983bd3358"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set OAuth 2.0 Bearer Access Token. <a href="classmastodonpp_1_1CURLWrapper.html#a94aba6daedea376ccc20e5c983bd3358">More...</a><br /></td></tr>
<tr class="separator:a94aba6daedea376ccc20e5c983bd3358"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af3f2bd4dea7c289d590fe19889360444"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#af3f2bd4dea7c289d590fe19889360444">set_cainfo</a> (string_view path)</td></tr>
<tr class="memdesc:af3f2bd4dea7c289d590fe19889360444"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set path to Certificate Authority (CA) bundle. <a href="classmastodonpp_1_1CURLWrapper.html#af3f2bd4dea7c289d590fe19889360444">More...</a><br /></td></tr>
<tr class="separator:af3f2bd4dea7c289d590fe19889360444"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae3b1445f9b94b1f7677d3cac6d538612"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#ae3b1445f9b94b1f7677d3cac6d538612">set_useragent</a> (string_view useragent)</td></tr>
<tr class="memdesc:ae3b1445f9b94b1f7677d3cac6d538612"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the User-Agent. <a href="classmastodonpp_1_1CURLWrapper.html#ae3b1445f9b94b1f7677d3cac6d538612">More...</a><br /></td></tr>
<tr class="separator:ae3b1445f9b94b1f7677d3cac6d538612"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:aeb3171d955832b8062dc02b4ac67d195"><td class="memItemLeft" align="right" valign="top">mutex&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#aeb3171d955832b8062dc02b4ac67d195">buffer_mutex</a></td></tr>
<tr class="memdesc:aeb3171d955832b8062dc02b4ac67d195"><td class="mdescLeft">&#160;</td><td class="mdescRight">Mutex for <a class="el" href="classmastodonpp_1_1CURLWrapper.html#a04b3919cfb38716c5a032337e442db95" title="Returns a reference to the buffer libcurl writes into.">get_buffer</a> a.k.a. _curl_buffer_body. <a href="classmastodonpp_1_1CURLWrapper.html#aeb3171d955832b8062dc02b4ac67d195">More...</a><br /></td></tr>
<tr class="separator:aeb3171d955832b8062dc02b4ac67d195"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Handles the details of network connections. </p>
<p>You don't need to use this.</p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a736572303fbec7a307514e611e6a468c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a736572303fbec7a307514e611e6a468c">&#9670;&nbsp;</a></span>CURLWrapper() <span class="overload">[1/3]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">mastodonpp::CURLWrapper::CURLWrapper </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initializes curl and sets up connection. </p>
<p>The first time an instance of <a class="el" href="classmastodonpp_1_1CURLWrapper.html" title="Handles the details of network connections.">CURLWrapper</a> is created, it calls <code>curl_global_init</code>, which is not thread-safe. For more information consult <a href="https://curl.haxx.se/libcurl/c/curl_global_init.html">curl_global_init(3)</a>.</p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; : _curl_buffer_error{}</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; , _stream_cancelled(<span class="keyword">false</span>)</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;{</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="keywordflow">if</span> (curlwrapper_instances == 0)</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; {</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; curl_global_init(CURL_GLOBAL_ALL); <span class="comment">// NOLINT(hicpp-signed-bitwise)</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; }</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; ++curlwrapper_instances;</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; debuglog &lt;&lt; <span class="stringliteral">&quot;CURLWrapper instances: &quot;</span> &lt;&lt; curlwrapper_instances &lt;&lt; <span class="stringliteral">&quot; (+1)\n&quot;</span>;</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; </div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; _connection = curl_easy_init();</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; setup_curl();</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a108929a9985c76a8e2cd1f531ac6d321"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a108929a9985c76a8e2cd1f531ac6d321">&#9670;&nbsp;</a></span>CURLWrapper() <span class="overload">[2/3]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mastodonpp::CURLWrapper::CURLWrapper </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">delete</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Copy constructor. </p>
</div>
</div>
<a id="a4d79b9a4525ac4b4b8954ccc794af0f9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4d79b9a4525ac4b4b8954ccc794af0f9">&#9670;&nbsp;</a></span>CURLWrapper() <span class="overload">[3/3]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mastodonpp::CURLWrapper::CURLWrapper </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">delete</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Move constructor. </p>
</div>
</div>
<a id="a350f7061c9cb54cb5992ae983db3fc19"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a350f7061c9cb54cb5992ae983db3fc19">&#9670;&nbsp;</a></span>~CURLWrapper()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mastodonpp::CURLWrapper::~CURLWrapper </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Cleans up curl and connection. </p>
<p>Calls <code>curl_global_cleanup</code>, which is not thread-safe. For more information consult <a href="https://curl.haxx.se/libcurl/c/curl_global_cleanup.html">curl_global_cleanup(3)</a>.</p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;{</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; curl_easy_cleanup(_connection);</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; </div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; --curlwrapper_instances;</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; debuglog &lt;&lt; <span class="stringliteral">&quot;CURLWrapper instances: &quot;</span> &lt;&lt; curlwrapper_instances &lt;&lt; <span class="stringliteral">&quot; (-1)\n&quot;</span>;</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <span class="keywordflow">if</span> (curlwrapper_instances == 0)</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; {</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; curl_global_cleanup();</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; }</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a892a4fc3d048798fa8e2584545b91861"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a892a4fc3d048798fa8e2584545b91861">&#9670;&nbsp;</a></span>cancel_stream()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void mastodonpp::CURLWrapper::cancel_stream </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Cancel the stream. </p>
<p>The stream will be cancelled, usually whithin a second. The <a class="el" href="structmastodonpp_1_1answer__type.html#a7c5582c4500034c0ea36ab1694944139">curl_error_code </a> of the answer will be set to 42 (<code>CURLE_ABORTED_BY_CALLBACK</code>).</p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; {</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; _stream_cancelled = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a11a543a0821a275dfce1ad7a0e68b17f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a11a543a0821a275dfce1ad7a0e68b17f">&#9670;&nbsp;</a></span>escape_url()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string mastodonpp::CURLWrapper::escape_url </td>
<td>(</td>
<td class="paramtype">const string_view&#160;</td>
<td class="paramname"><em>url</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>URL encodes the given string. </p>
<p>For more information consult <a href="https://curl.haxx.se/libcurl/c/curl_easy_escape.html">curl_easy_escape(3)</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">url</td><td>String to escape.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The escaped string or {} if it failed.</dd></dl>
<dl class="section since"><dt>Since</dt><dd>0.3.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; {</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; <span class="keywordtype">char</span> *cbuf{curl_easy_escape(_connection, url.data(),</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; static_cast&lt;int&gt;(url.size()))};</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; <span class="keywordtype">string</span> sbuf{cbuf};</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; curl_free(cbuf);</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <span class="keywordflow">return</span> sbuf;</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a04b3919cfb38716c5a032337e442db95"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a04b3919cfb38716c5a032337e442db95">&#9670;&nbsp;</a></span>get_buffer()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string&amp; mastodonpp::CURLWrapper::get_buffer </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a reference to the buffer libcurl writes into. </p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; {</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; <span class="keywordflow">return</span> _curl_buffer_body;</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a2b7aaf03245a0730eeb464802168aded"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2b7aaf03245a0730eeb464802168aded">&#9670;&nbsp;</a></span>get_curl_easy_handle()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">CURL* mastodonpp::CURLWrapper::get_curl_easy_handle </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns pointer to the CURL easy handle. </p>
<p>You can use this handle to set or modify curl options. For more information consult <a href="https://curl.haxx.se/libcurl/c/curl_easy_setopt.html">curl_easy_setopt(3)</a>.</p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; {</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <span class="keywordflow">return</span> _connection;</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; }</div>
</div><!-- fragment -->
</div>
</div>
<a id="adc8808c3fad5397176f6755b09ee0be6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adc8808c3fad5397176f6755b09ee0be6">&#9670;&nbsp;</a></span>make_request()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structmastodonpp_1_1answer__type.html">answer_type</a> mastodonpp::CURLWrapper::make_request </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100">http_method</a> &amp;&#160;</td>
<td class="paramname"><em>method</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">string&#160;</td>
<td class="paramname"><em>uri</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> &amp;&#160;</td>
<td class="paramname"><em>parameters</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Make a HTTP request. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">method</td><td>The HTTP method. </td></tr>
<tr><td class="paramname">uri</td><td>The full URI. </td></tr>
<tr><td class="paramname">parameters</td><td>A map of parameters.</td></tr>
</table>
</dd>
</dl>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;{</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; _stream_cancelled = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; _curl_buffer_headers.clear();</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; _curl_buffer_body.clear();</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; </div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; CURLcode code;</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keywordflow">switch</span> (method)</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; {</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="keywordflow">case</span> http_method::GET:</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; {</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; add_parameters_to_uri(uri, parameters);</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; curl_easy_setopt(_connection, CURLOPT_HTTPGET, 1L);</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; </div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; }</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="keywordflow">case</span> http_method::POST:</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; {</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <span class="keywordflow">if</span> (parameters.empty())</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; {</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; curl_easy_setopt(_connection, CURLOPT_POST, 1L);</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; }</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; {</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; curl_mime *mime{parameters_to_curl_mime(uri, parameters)};</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; }</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; </div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; }</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; <span class="keywordflow">case</span> http_method::PATCH:</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; {</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; <span class="keywordflow">if</span> (!parameters.empty())</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; {</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; curl_mime *mime{parameters_to_curl_mime(uri, parameters)};</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; }</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; </div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, <span class="stringliteral">&quot;PATCH&quot;</span>);</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="keywordflow">if</span> (code != CURLE_OK)</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; {</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <span class="keywordflow">throw</span> CURLException{code, <span class="stringliteral">&quot;Failed to set URI&quot;</span>, _curl_buffer_error};</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; }</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; }</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; <span class="keywordflow">case</span> http_method::PUT:</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; {</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keywordflow">if</span> (!parameters.empty())</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; {</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; curl_mime *mime{parameters_to_curl_mime(uri, parameters)};</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; }</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; </div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, <span class="stringliteral">&quot;PUT&quot;</span>);</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; <span class="keywordflow">if</span> (code != CURLE_OK)</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; {</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; <span class="keywordflow">throw</span> CURLException{code, <span class="stringliteral">&quot;Failed to set URI&quot;</span>, _curl_buffer_error};</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; }</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; </div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; }</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; <span class="keywordflow">case</span> http_method::DELETE:</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; {</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; <span class="keywordflow">if</span> (!parameters.empty())</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; {</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; curl_mime *mime{parameters_to_curl_mime(uri, parameters)};</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; curl_easy_setopt(_connection, CURLOPT_MIMEPOST, mime);</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; }</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; </div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; code = curl_easy_setopt(_connection, CURLOPT_CUSTOMREQUEST, <span class="stringliteral">&quot;DELETE&quot;</span>);</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; <span class="keywordflow">if</span> (code != CURLE_OK)</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; {</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; <span class="keywordflow">throw</span> CURLException{code, <span class="stringliteral">&quot;Failed to set URI&quot;</span>, _curl_buffer_error};</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; }</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; </div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>&#160; }</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; }</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>&#160; debuglog &lt;&lt; <span class="stringliteral">&quot;Making request to: &quot;</span> &lt;&lt; uri &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; </div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; code = curl_easy_setopt(_connection, CURLOPT_URL, uri.data());</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <span class="keywordflow">if</span> (code != CURLE_OK)</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>&#160; {</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <span class="keywordflow">throw</span> CURLException{code, <span class="stringliteral">&quot;Failed to set URI&quot;</span>, _curl_buffer_error};</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; }</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; </div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; answer_type answer;</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; code = curl_easy_perform(_connection);</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; <span class="keywordflow">if</span> (code == CURLE_OK</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; || (code == CURLE_ABORTED_BY_CALLBACK &amp;&amp; _stream_cancelled))</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>&#160; {</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; <span class="keywordtype">long</span> http_status; <span class="comment">// NOLINT(google-runtime-int)</span></div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; curl_easy_getinfo(_connection, CURLINFO_RESPONSE_CODE, &amp;http_status);</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; answer.http_status = static_cast&lt;uint16_t&gt;(http_status);</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; debuglog &lt;&lt; <span class="stringliteral">&quot;HTTP status code: &quot;</span> &lt;&lt; http_status &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; </div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; answer.headers = _curl_buffer_headers;</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160; answer.body = _curl_buffer_body;</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160; }</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <span class="keywordflow">else</span></div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; {</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; answer.curl_error_code = static_cast&lt;uint8_t&gt;(code);</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; answer.error_message = _curl_buffer_error;</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; debuglog &lt;&lt; <span class="stringliteral">&quot;libcurl error: &quot;</span> &lt;&lt; code &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; debuglog &lt;&lt; _curl_buffer_error &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; }</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; </div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <span class="keywordflow">return</span> answer;</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a5f29b7f4d0b58f70bc96f362cdaa4d0a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5f29b7f4d0b58f70bc96f362cdaa4d0a">&#9670;&nbsp;</a></span>operator=() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a>&amp; mastodonpp::CURLWrapper::operator= </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">delete</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Copy assignment operator. </p>
</div>
</div>
<a id="a506cb49c00a63ef4b9d51d0d52c203dc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a506cb49c00a63ef4b9d51d0d52c203dc">&#9670;&nbsp;</a></span>operator=() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a>&amp; mastodonpp::CURLWrapper::operator= </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">delete</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Move assignment operator. </p>
</div>
</div>
<a id="a94aba6daedea376ccc20e5c983bd3358"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a94aba6daedea376ccc20e5c983bd3358">&#9670;&nbsp;</a></span>set_access_token()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void mastodonpp::CURLWrapper::set_access_token </td>
<td>(</td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>access_token</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Set OAuth 2.0 Bearer Access Token. </p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160;{</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-signed-bitwise)</span></div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; CURLcode code{curl_easy_setopt(_connection, CURLOPT_XOAUTH2_BEARER,</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; access_token.data())};</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; <span class="keywordflow">if</span> (code != CURLE_OK)</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; {</div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; <span class="keywordflow">throw</span> CURLException{code, <span class="stringliteral">&quot;Could not set authorization token.&quot;</span>,</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; _curl_buffer_error};</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; }</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; </div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160;<span class="preprocessor">#if (LIBCURL_VERSION_NUM &lt; 0x073d00) // libcurl &lt; 7.61.0.</span></div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;<span class="preprocessor">#define CURLAUTH_BEARER CURLAUTH_ANY</span></div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160; </div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-signed-bitwise)</span></div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; code = curl_easy_setopt(_connection, CURLOPT_HTTPAUTH, CURLAUTH_BEARER);</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; <span class="keywordflow">if</span> (code != CURLE_OK)</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; {</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; <span class="keywordflow">throw</span> CURLException{code, <span class="stringliteral">&quot;Could not set authorization token.&quot;</span>,</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; _curl_buffer_error};</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160; }</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; </div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; debuglog &lt;&lt; <span class="stringliteral">&quot;Set authorization token.\n&quot;</span>;</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="af3f2bd4dea7c289d590fe19889360444"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af3f2bd4dea7c289d590fe19889360444">&#9670;&nbsp;</a></span>set_cainfo()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void mastodonpp::CURLWrapper::set_cainfo </td>
<td>(</td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>path</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Set path to Certificate Authority (CA) bundle. </p>
<dl class="section since"><dt>Since</dt><dd>0.3.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160;{</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; CURLcode code{curl_easy_setopt(_connection, CURLOPT_CAINFO, path.data())};</div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160; <span class="keywordflow">if</span> (code != CURLE_OK)</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160; {</div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160; <span class="keywordflow">throw</span> CURLException{code, <span class="stringliteral">&quot;Could not set CA info.&quot;</span>, _curl_buffer_error};</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; }</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a1564a42794ef7a9d170b725063ef504d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1564a42794ef7a9d170b725063ef504d">&#9670;&nbsp;</a></span>set_proxy()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void mastodonpp::CURLWrapper::set_proxy </td>
<td>(</td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>proxy</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the proxy to use. </p>
<p>See <a href="https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html">CURLOPT_PROXY(3)</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">proxy</td><td>Examples: "socks4a://127.0.0.1:9050", "http://[::1]:3128".</td></tr>
</table>
</dd>
</dl>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160;{</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; CURLcode code{curl_easy_setopt(_connection, CURLOPT_PROXY, proxy.data())};</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; <span class="keywordflow">if</span> (code != CURLE_OK)</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; {</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keywordflow">throw</span> CURLException{code, <span class="stringliteral">&quot;Failed to set proxy&quot;</span>, _curl_buffer_error};</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; }</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; debuglog &lt;&lt; <span class="stringliteral">&quot;Set proxy to: &quot;</span> &lt;&lt; proxy &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="ae3b1445f9b94b1f7677d3cac6d538612"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae3b1445f9b94b1f7677d3cac6d538612">&#9670;&nbsp;</a></span>set_useragent()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void mastodonpp::CURLWrapper::set_useragent </td>
<td>(</td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>useragent</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the User-Agent. </p>
<dl class="section since"><dt>Since</dt><dd>0.3.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160;{</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="comment">// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)</span></div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160; CURLcode code{curl_easy_setopt(_connection, CURLOPT_USERAGENT,</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160; useragent.data())};</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160; <span class="keywordflow">if</span> (code != CURLE_OK)</div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; {</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="keywordflow">throw</span> CURLException{code, <span class="stringliteral">&quot;Failed to set User-Agent&quot;</span>,</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160; _curl_buffer_error};</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160; }</div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160; debuglog &lt;&lt; <span class="stringliteral">&quot;Set User-Agent to: &quot;</span> &lt;&lt; useragent &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a0059ecb78b53c4b3c941b19f8dc897f7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0059ecb78b53c4b3c941b19f8dc897f7">&#9670;&nbsp;</a></span>setup_connection_properties()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void mastodonpp::CURLWrapper::setup_connection_properties </td>
<td>(</td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>proxy</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>access_token</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>cainfo</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>useragent</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set some properties of the connection. </p>
<p>Meant for internal use. See <a class="el" href="classmastodonpp_1_1Instance.html#aa486bc453907439e33f8402f270ef384" title="Set the properties of the connection of the calling class up.">Instance::copy_connection_properties()</a>.</p>
<dl class="section since"><dt>Since</dt><dd>0.3.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160;{</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; <span class="keywordflow">if</span> (!proxy.empty())</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; {</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a1564a42794ef7a9d170b725063ef504d">set_proxy</a>(proxy);</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; }</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; </div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; <span class="keywordflow">if</span> (!access_token.empty())</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; {</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a94aba6daedea376ccc20e5c983bd3358">set_access_token</a>(access_token);</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; }</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; </div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; <span class="keywordflow">if</span> (!cainfo.empty())</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; {</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; <a class="code" href="classmastodonpp_1_1CURLWrapper.html#af3f2bd4dea7c289d590fe19889360444">set_cainfo</a>(cainfo);</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; }</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; </div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordflow">if</span> (!useragent.empty())</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; {</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; <a class="code" href="classmastodonpp_1_1CURLWrapper.html#ae3b1445f9b94b1f7677d3cac6d538612">set_useragent</a>(useragent);</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; }</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="aed6d09b5c32d71276a851ddf321b5891"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aed6d09b5c32d71276a851ddf321b5891">&#9670;&nbsp;</a></span>unescape_url()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">string mastodonpp::CURLWrapper::unescape_url </td>
<td>(</td>
<td class="paramtype">const string_view&#160;</td>
<td class="paramname"><em>url</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>URL decodes the given string . </p>
<p>For more information consult <a href="https://curl.haxx.se/libcurl/c/curl_easy_unescape.html">curl_easy_unescape(3)</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">url</td><td>String to unescape.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The unescaped string or {} if it failed.</dd></dl>
<dl class="section since"><dt>Since</dt><dd>0.3.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; {</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <span class="keywordtype">char</span> *cbuf{curl_easy_unescape(_connection, url.data(),</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; static_cast&lt;int&gt;(url.size()), <span class="keyword">nullptr</span>)};</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; <span class="keywordtype">string</span> sbuf{cbuf};</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160; curl_free(cbuf);</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; <span class="keywordflow">return</span> sbuf;</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; }</div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="aeb3171d955832b8062dc02b4ac67d195"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeb3171d955832b8062dc02b4ac67d195">&#9670;&nbsp;</a></span>buffer_mutex</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mutex mastodonpp::CURLWrapper::buffer_mutex</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Mutex for <a class="el" href="classmastodonpp_1_1CURLWrapper.html#a04b3919cfb38716c5a032337e442db95" title="Returns a reference to the buffer libcurl writes into.">get_buffer</a> a.k.a. _curl_buffer_body. </p>
<p>This mutex is locked before anything is read or written from/to _curl_buffer_body.</p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>include/<a class="el" href="curl__wrapper_8hpp_source.html">curl_wrapper.hpp</a></li>
<li>src/curl_wrapper.cpp</li>
</ul>
</div><!-- contents -->
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a1564a42794ef7a9d170b725063ef504d"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a1564a42794ef7a9d170b725063ef504d">mastodonpp::CURLWrapper::set_proxy</a></div><div class="ttdeci">void set_proxy(string_view proxy)</div><div class="ttdoc">Set the proxy to use.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:216</div></div>
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_af3f2bd4dea7c289d590fe19889360444"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#af3f2bd4dea7c289d590fe19889360444">mastodonpp::CURLWrapper::set_cainfo</a></div><div class="ttdeci">void set_cainfo(string_view path)</div><div class="ttdoc">Set path to Certificate Authority (CA) bundle.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:253</div></div>
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_ae3b1445f9b94b1f7677d3cac6d538612"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#ae3b1445f9b94b1f7677d3cac6d538612">mastodonpp::CURLWrapper::set_useragent</a></div><div class="ttdeci">void set_useragent(string_view useragent)</div><div class="ttdoc">Sets the User-Agent.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:263</div></div>
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a94aba6daedea376ccc20e5c983bd3358"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a94aba6daedea376ccc20e5c983bd3358">mastodonpp::CURLWrapper::set_access_token</a></div><div class="ttdeci">void set_access_token(string_view access_token)</div><div class="ttdoc">Set OAuth 2.0 Bearer Access Token.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:227</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>