Don't send Connection: close for streaming requests
This commit is contained in:
parent
f8aa6689a9
commit
cd87269b59
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.7)
|
cmake_minimum_required (VERSION 3.7)
|
||||||
project (mastodon-cpp
|
project (mastodon-cpp
|
||||||
VERSION 0.6.4
|
VERSION 0.6.5
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -74,18 +74,18 @@ const std::uint16_t API::http::request(const method &meth,
|
||||||
ttdebug << "User-Agent: " << parent.get_useragent() << "\n";
|
ttdebug << "User-Agent: " << parent.get_useragent() << "\n";
|
||||||
request.setOpt<curlopts::UserAgent>(parent.get_useragent());
|
request.setOpt<curlopts::UserAgent>(parent.get_useragent());
|
||||||
|
|
||||||
headers.push_back("Connection: close");
|
|
||||||
if (!_access_token.empty())
|
if (!_access_token.empty())
|
||||||
{
|
{
|
||||||
headers.push_back("Authorization: Bearer " + _access_token);
|
headers.push_back("Authorization: Bearer " + _access_token);
|
||||||
}
|
}
|
||||||
request.setOpt<curlopts::HttpHeader>(headers);
|
|
||||||
|
|
||||||
// Get headers from server
|
|
||||||
if (meth != http::method::GET_STREAM)
|
if (meth != http::method::GET_STREAM)
|
||||||
{
|
{
|
||||||
|
headers.push_back("Connection: close");
|
||||||
|
// Get headers from server
|
||||||
request.setOpt<curlpp::options::Header>(true);
|
request.setOpt<curlpp::options::Header>(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
request.setOpt<curlopts::HttpHeader>(headers);
|
||||||
request.setOpt<curlopts::FollowLocation>(true);
|
request.setOpt<curlopts::FollowLocation>(true);
|
||||||
request.setOpt<curlpp::options::WriteFunction>
|
request.setOpt<curlpp::options::WriteFunction>
|
||||||
(std::bind(&http::callback, this, _1, _2, _3, &answer));
|
(std::bind(&http::callback, this, _1, _2, _3, &answer));
|
||||||
|
|
Reference in New Issue