Commit Graph

25 Commits

Author SHA1 Message Date
Kenneth Skovhede 40dd3c6816 Updated all license mentions to MIT 2024-02-28 15:45:30 +01:00
Kenneth Skovhede 2f1f5bb7e0 The purpose of this update is to provide better error messages from servers that return error messages, but are expected to return JSON data.
In the current setup, the response stream is parsed by the JSON decoder, which throws an exception due to reading a non-json formatted error message.
The reported exception simply states that the first character on the first line was not valid json, which is true, but does not help diagnose the problem.

In many cases this is a human readable message, such as "over quota", "permission denied", etc.
This update adds a stream that keeps the first 2kb of the response in an internal buffer, which can then be printed in case the JSON parsing fails.
Most of the added code is just simple redirects for calling the base stream in the peeking stream.
2020-05-10 14:14:35 +02:00
Tyler Gill 1ae534e45e Add ConfigureAwait(false) to JSONWebHelper.cs 2020-03-23 20:22:22 -06:00
Tyler Gill e742205f65 Add --use-http-client=false parameter to backends based on Microsoft Graph APIs (OneDrive v2, SharePoint v2, etc.) to make them use the OAuthHelper and HttpWebRequest infra used by most / all other backends for HTTP requests. This lives in parallel to the original implementation that uses the OAuthHttpClient class, but is intended to see if this prevents the memory leaks and problems seen in some versions of Mono when using the OneDrive v2 backend. 2020-03-23 14:10:40 -06:00
Kenneth Skovhede 99d0cb3c57 Merge pull request #3953 from warwickmm/make_fields_readonly
Mark fields that don't need to be reassigned as readonly
2019-10-21 08:36:17 +02:00
Kenneth Hsu 2aa76881a5 Mark fields that don't need to be reassigned as readonly.
This makes it explicit at compile-time that these fields should not be
reassigned outside the constructor.
2019-10-19 13:59:22 -07:00
Kenneth Hsu afab61a05b Use pattern matching to simplify casts. 2019-10-19 10:15:38 -07:00
Kenneth Hsu ffaaa55f2f Use AsyncHttpRequest to handle async HttpWebRequests.
For some reason, when using HttpWebRequest.GetRequestStreamAsync, the
Amazon Cloud Drive and Box backends would fail when attempting to upload
larger amounts of data (these are the only backends that use the
PostMultipartAsync method).

This fixes issue #3756.
2019-05-04 16:38:36 -07:00
Sean Templeton 8bd4b825c8 Fix several Codacy issues 2019-03-13 21:51:05 -05:00
Sean Templeton c3472823de Update HubiC and OpenStack backends for async Put 2019-03-05 21:08:26 -06:00
Sean Templeton 5db326bcdb Update Azure Blob and Backblaze B2 backends for async Put 2019-03-05 21:08:24 -06:00
Sean Templeton b1c6e9798d Update Amazon Cloud Drive backend for async Put 2019-03-05 21:08:14 -06:00
verhoek 55e349f410 Renamed variable to indicate meaning properly. 2018-05-09 18:57:04 +02:00
Tyler Gill f9a8b30b2f Update JSONWebHelper.PostAndGetJSONData to remove parameters that aren't actually being used (setup and setupreq).
These parameters weren't being used in the method body, or being passed in by any callers (it looks like a copy / paste error when a previous method was converted into this one)
These are replaced with a new optional parameter (method) which allows the caller to request a custom HTTP method to be used.
2018-03-20 13:56:05 -06:00
Kenneth Hsu 5fb1958ceb Remove redundant calls to ToString. 2017-11-26 15:44:34 -08:00
Kenneth Skovhede a7b46b622c Spelling fix in documentation 2017-03-03 20:50:11 +01:00
Kenneth Skovhede 0c68daff6c Fixed all whitespace to be 4 spaces instead of tabs 2016-09-15 11:39:27 +02:00
Kenneth Skovhede 5f7e63ae78 Fixed the timeout issue 2016-04-16 17:51:44 +02:00
Kenneth Skovhede d0711011a2 Rewrote all WebRequest code to use AsyncHttpRequest, and normalized usage such that WebResponse objects are always correctly disposed. 2016-04-16 11:12:28 +02:00
Kenneth Skovhede 5e35d30a61 Added support for multi-part uploads in the helper class 2015-12-07 09:53:13 +01:00
Kenneth Skovhede a9e34a1625 Virtualized some methods in the JSONHelper and added a method for capturing custom error messages 2015-12-05 14:19:44 +01:00
Kenneth Skovhede a53686d1d0 Moved the JSON helper methods out of the OAuthHelper and into the JSONHelper class.
Added a new method to also POST JSON data.
2015-12-05 11:27:21 +01:00
Kenneth Skovhede 9517af31cc Removed some unused variables and improved the use of a non-standard --oauth-url 2015-08-25 16:02:33 +01:00
Kenneth Skovhede 6dac0f3c2e Fixed an invalid line-ending character 2015-08-05 13:51:56 +02:00
Kenneth Skovhede a359b3bbae The OAuthHelper was a mix of JSON web requests and OAuth calls, so now it has been split into two. 2015-07-01 09:39:13 +02:00