From 5cb92c01b9e328f2cf382d8ab631c8139ca47823 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sun, 15 Apr 2018 20:02:39 +1000 Subject: [PATCH] Expand HTTPS debug to include GET JSON responses * Change debug flag from --debug-http to --debug-https as OneDrive only uses HTTPS, not HTTP * Expand --debug-https to print the JSON responses to GET operations. This is to assist with debugging #334 where a change in the MS API (https://github.com/OneDrive/onedrive-api-docs/issues/834) no longer sends 'lastModifiedDateTime' with responses to some GET's. This issue seems to manefest itself with OneDrive Business accounts currently. --- src/main.d | 2 +- src/onedrive.d | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.d b/src/main.d index e75de5b3..6c46e69b 100644 --- a/src/main.d +++ b/src/main.d @@ -63,7 +63,7 @@ int main(string[] args) "confdir", "Set the directory used to store the configuration files", &configDirName, "create-directory", "Create a directory on OneDrive - no sync will be performed.", &createDirectory, "destination-directory", "Destination directory for renamed or move on OneDrive - no sync will be performed.", &destinationDirectory, - "debug-http", "Debug OneDrive HTTP communication.", &debugHttp, + "debug-https", "Debug OneDrive HTTPS communication.", &debugHttp, "download|d", "Only download remote changes", &downloadOnly, "local-first", "Synchronize from the local directory source first, before downloading changes from OneDrive.", &localFirst, "logout", "Logout the current user", &logout, diff --git a/src/onedrive.d b/src/onedrive.d index ea3254e5..976d6951 100644 --- a/src/onedrive.d +++ b/src/onedrive.d @@ -3,7 +3,7 @@ import std.datetime, std.exception, std.file, std.json, std.path; import std.stdio, std.string, std.uni, std.uri; import config; static import log; - +shared bool debugResponse = false; private immutable { string clientId = "22c49a0d-d21c-4792-aed1-8f163c982546"; @@ -55,6 +55,7 @@ final class OneDriveApi http = HTTP(); if (debugHttp) { http.verbose = true; + .debugResponse = true; } } @@ -308,6 +309,9 @@ final class OneDriveApi if (!skipToken) addAccessTokenHeader(); // HACK: requestUploadStatus auto response = perform(); checkHttpCode(response); + if (.debugResponse){ + log.vlog("OneDrive Response: ", response); + } return response; }