Don't send Connection: close for streaming requests

This commit is contained in:
tastytea 2018-03-15 12:45:49 +01:00
parent f8aa6689a9
commit cd87269b59
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
2 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7)
project (mastodon-cpp
VERSION 0.6.4
VERSION 0.6.5
LANGUAGES CXX
)

View File

@ -74,18 +74,18 @@ const std::uint16_t API::http::request(const method &meth,
ttdebug << "User-Agent: " << parent.get_useragent() << "\n";
request.setOpt<curlopts::UserAgent>(parent.get_useragent());
headers.push_back("Connection: close");
if (!_access_token.empty())
{
headers.push_back("Authorization: Bearer " + _access_token);
}
request.setOpt<curlopts::HttpHeader>(headers);
// Get headers from server
if (meth != http::method::GET_STREAM)
{
headers.push_back("Connection: close");
// Get headers from server
request.setOpt<curlpp::options::Header>(true);
}
request.setOpt<curlopts::HttpHeader>(headers);
request.setOpt<curlopts::FollowLocation>(true);
request.setOpt<curlpp::options::WriteFunction>
(std::bind(&http::callback, this, _1, _2, _3, &answer));