From 1348befe297d32de9bf40f89f37bcbae2c91d81f Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Fri, 27 May 2016 17:50:27 +0600 Subject: CLOUD: Add access to CurlRequest's Stream One can access CurlRequest's NetworkReadStream in order to find out HTTP response code or some other Stream-related data. OneDriveTokenRefresher uses it to print some info on that 404 error I'm trying to troubleshoot. --- backends/cloud/onedrive/onedrivetokenrefresher.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'backends/cloud') diff --git a/backends/cloud/onedrive/onedrivetokenrefresher.cpp b/backends/cloud/onedrive/onedrivetokenrefresher.cpp index 6943d89297..6620c23dc6 100644 --- a/backends/cloud/onedrive/onedrivetokenrefresher.cpp +++ b/backends/cloud/onedrive/onedrivetokenrefresher.cpp @@ -25,6 +25,7 @@ #include "backends/cloud/onedrive/onedrivestorage.h" #include "backends/networking/curl/connectionmanager.h" #include "backends/networking/curl/curljsonrequest.h" +#include "backends/networking/curl/networkreadstream.h" #include "common/config-manager.h" #include "common/debug.h" #include "common/json.h" @@ -56,6 +57,17 @@ void OneDriveTokenRefresher::innerRequestCallback(Networking::JsonResponse pair) Common::JSONObject result = pair.value->asObject(); if (result.contains("error")) { //new token needed => request token & then retry original request + CurlJsonRequest *streamRequest = (CurlJsonRequest *)pair.request; + if (streamRequest) { + const Networking::NetworkReadStream *stream = streamRequest->getNetworkReadStream(); + if (stream) { + debug("code %ld", stream->httpResponseCode()); + } + } + + Common::JSONObject error = result.getVal("error")->asObject(); + debug("code = %s", error.getVal("code")->asString().c_str()); + debug("message = %s", error.getVal("message")->asString().c_str()); if (pair.request) pair.request->pause(); _retryRequest = pair.request; delete pair.value; -- cgit v1.2.3