From cd87269b59329f2ca764c0e47a550d9b8e5458f3 Mon Sep 17 00:00:00 2001 From: tastytea Date: Thu, 15 Mar 2018 12:45:49 +0100 Subject: [PATCH] Don't send Connection: close for streaming requests --- CMakeLists.txt | 2 +- src/http.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b740007..8bc6ed0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (mastodon-cpp - VERSION 0.6.4 + VERSION 0.6.5 LANGUAGES CXX ) diff --git a/src/http.cpp b/src/http.cpp index 01592f0..71637f6 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -74,18 +74,18 @@ const std::uint16_t API::http::request(const method &meth, ttdebug << "User-Agent: " << parent.get_useragent() << "\n"; request.setOpt(parent.get_useragent()); - headers.push_back("Connection: close"); if (!_access_token.empty()) { headers.push_back("Authorization: Bearer " + _access_token); } - request.setOpt(headers); - - // Get headers from server if (meth != http::method::GET_STREAM) { + headers.push_back("Connection: close"); + // Get headers from server request.setOpt(true); } + + request.setOpt(headers); request.setOpt(true); request.setOpt (std::bind(&http::callback, this, _1, _2, _3, &answer));