From 311581345a9a0d5a6b2b69b77edb065425d902f9 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 13 Mar 2018 13:22:17 +0100 Subject: [PATCH] Bugfixes: answer was not deleted before filled again; Header/Body separation was broken --- CMakeLists.txt | 2 +- src/http_sync.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15dd2d0..f5dfce1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (mastodon-cpp - VERSION 0.6.2 + VERSION 0.6.3 LANGUAGES CXX ) diff --git a/src/http_sync.cpp b/src/http_sync.cpp index eec563d..361b67d 100644 --- a/src/http_sync.cpp +++ b/src/http_sync.cpp @@ -112,10 +112,14 @@ const std::uint16_t API::http::request_sync(const method &meth, break; } + //request.setOpt(true); + + answer.clear(); request.perform(); ret = curlpp::infos::ResponseCode::get(request); ttdebug << "Response code: " << ret << '\n'; - size_t pos = answer.find("\r\n\r\n"); + // Work around "HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK" + size_t pos = answer.find("\r\n\r\n", 25); _headers = answer.substr(0, pos); if (ret == 200 || ret == 302 || ret == 307)