Commit Graph
46 Commits
Author SHA1 Message Date
Kenneth Skovhede a0c0cbf3d5 Removed mentions of Mono in code, and fixed some entry paths pointing to the dll instead of the exe 2024-04-15 13:20:39 +02:00
Kenneth Skovhede 40dd3c6816 Updated all license mentions to MIT 2024-02-28 15:45:30 +01:00
Tyler Gill b64c2f1df0 Move Retry-After logic to RetryAfterHelper to make it easier for other backends to incorporate it. 2021-03-23 17:28:39 -06:00
Tyler Gill dadd30380c Add some logging to Microsoft Graph backends. 2021-03-23 17:08:58 -06:00
Tyler Gill 06c28387d5 Address some more feedback 2021-03-20 16:09:23 -06:00
Tyler Gill 9a4632d551 Remove SubStream and add functionality to ReadLimitLengthStream. Switch to using that.
Also add some hardening around the Position and make sure the stream starts at relative Position 0.
2021-03-17 20:37:46 -06:00
Tyler Gill b0793d3e49 Refactor the Retry-After logic. Now it tracks Retry-After headers on all requests, and blocks any future requests until the time from the prior request has passed. 2021-03-16 11:40:38 -06:00
Tyler Gill 7894152489 A few more improvements to the MicrosoftGraphBackends.
First, when performing an upload using an upload session, data is streamed directly from the input stream to the request stream. (It is no longer read into an intermediate buffer first.)
Hopefully this will help these uploads respond to throttling behavior better.
Second, these backends now check for and respect a Retry-After header if it is present.
On 5xx errors, the existing exponential backoff is used for the intermediate retries.
A few other minor things have also been cleaned up (e.g., using Task.Delay instead of Thread.Sleep)
2021-03-15 18:04:39 -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 Hsu 48444782c2 Fix regression with SharePoint backend.
In pull request #3989, we set the conflict resolution behavior for
creating new items to be "Replace".  While this worked for OneDrive,
SharePoint apparently is case-sensitive and expects "replace".  Since
the default behavior is to replace, we will simply remove the
specification to avoid possible conflicts.

See the forum discussion below:

https://forum.duplicati.com/t/bad-request-error-from-request-nameconflictbehavior-must-be-fail-replace-or-rename/8578
2019-12-07 12:19:21 -08:00
Tyler Gill 5364345edd Add ConfigureAwait(false) to MSGraph backends' awaits. 2019-11-14 07:51:49 -07:00
Tyler Gill e9543142f2 Explicitly dispose request messages, request contents, and response messages 2019-11-13 12:18:19 -07:00
Kenneth Hsu 988c445233 Provide cancellation token to async methods. 2019-05-26 14:55:31 -07:00
Sean Templeton b02b19e683 Change Put method name to PutAsync 2019-03-17 18:28:45 -05:00
Sean Templeton 8bd4b825c8 Fix several Codacy issues 2019-03-13 21:51:05 -05:00
Sean Templeton 13f83a22a1 Update Mega, OneDrive, and Rclone backends for async Put 2019-03-05 21:25:29 -06:00
Sean Templeton 0c122ff550 Change IBackend and IStreamingBackend to return Task for Put() 2019-03-03 21:43:10 -06:00
verhoek b2cc18426c Renamed Library.IO to Library.Common.IO.
Moved basic Platform functions to Library.Common.Platform.
Turned IO_OS into property within Library.Common.
2018-11-02 21:34:07 +01:00
verhoek 71c6aca8a7 Fixed IO calls in Filebackend.
Moved FileEntry to Library.IO due to AlphaFS not implementing
System.IO.FileInfo/DirectoryInfo.
2018-11-01 17:56:48 +01:00
Kenneth Hsu a567b467dc Fix slashes in Microsoft Graph URLs.
This fixes an issue introduced in revision f9022fec ("Avoid referencing
virtual members in constructor").

This addresses issue #3460.
2018-10-27 13:03:25 -07:00
Kenneth Hsu 8bb770964d Constrain generic type to be a class to allow for null comparison.
The SendRequest method performs a comparison between an object of type T
and null.  While there are no use cases currently where the generic type
is a value type, we should constrain the generic type to be a class so
that the comparison remains meaningful.
2018-10-08 19:13:23 -07:00
Kenneth Hsu 6c08f44394 Revert "Avoid potential comparison of value type with null."
This reverts commit ecb670a2d9.

While there aren't any cases where the generic type is a struct, the
comparison with default(T) is incorrect.  If T is int, we wouldn't want
the behavior to differ based on whether the value was zero or nonzero.
2018-10-08 18:54:36 -07:00
Kenneth Hsu ecb670a2d9 Avoid potential comparison of value type with null.
While there aren't currently any cases where the generic type is a value
type, this will make the code slightly more robust to future
implementations.
2018-10-07 09:59:13 -07:00
Kenneth Hsu e2bc85c7e4 Merge remote-tracking branch 'upstream/master' into constructor_virtual_members
Resolved Conflicts:
	Duplicati/Library/Backend/OneDrive/MicrosoftGraphBackend.cs
2018-10-01 17:15:58 -07:00
Rune HenriksenandGitHub 5f4236cbc2 Merge pull request #3399 from duplicati/remove_unused_variables_assignments
Remove unused variables, fields, and unnecessary assignments
2018-10-01 23:19:37 +02:00
Kenneth Hsu 024bc5bea2 Mark immutable field as readonly. 2018-09-30 15:45:42 -07:00
Kenneth Hsu ee14862db5 Add comment to clarify use of Lazy. 2018-09-30 15:06:55 -07:00
Kenneth Hsu f59607d94d Rename property. 2018-09-30 15:06:55 -07:00
Kenneth Hsu f9022fec66 Avoid referencing virtual members in constructor.
Since the call to GetRootPathFromUrl may be expensive, we cache the
value using a lazy initializer.
2018-09-30 15:06:49 -07:00
Kenneth Hsu 7cf830cad7 Provide protocol key to MicrosoftGraphBackend constructor.
This will help us avoid referencing virtual members in the constructor.
2018-09-30 10:59:26 -07:00
Kenneth Hsu 9ce1e807c7 Remove unused variables and fields. 2018-09-29 10:41:27 -07:00
Kenneth Hsu 44b7c29489 Rename local variable to avoid hiding class field. 2018-09-28 20:57:44 -07:00
Tyler Gill f2f5d4c0a6 Change from swallowing delete errors to wrapping DriveItemNotFoundException in FileMissingException.
This way, the regular backend manager logic can handle and log the delete of a non-existant file.
Also update some of the other operations to throw FileMissingException (rather than the backend specific DriveItemNotFoundException).
2018-06-02 15:52:20 -06:00
Tyler Gill 8131e85581 (MS Graph) When the delete operation fails due to a 'file not found' error, we don't need to bubble up an exception. 2018-05-25 09:18:20 -06:00
Tyler Gill f93f9dcc5a Add new utility class, OAuthHttpClient.
This class extends HttpClient and uses an OAuthHttpMessageHandler under the covers to automatically authenticate requests.
Additionally, it automatically respects the global HttpContextSettings for overall timeout, read/write timeout, and SSL certificate validation.
(BufferRequests isn't currently handled, as HttpClient doesn't seem to easily expose that flag, and as of .NET 4.5, seems to not buffer by default.)
2018-03-23 15:07:51 -06:00
Tyler Gill 407bead9f9 Change some fragment settings.
Default retry delay is now 1000ms, and fragment sizes must be at least the multiple size (320 KiB)
2018-03-23 15:04:23 -06:00
Tyler Gill 5bec41b665 Update both SharePoint and Office 365 group backends to support more human-discernable methods of specifying the backend destination.
For SharePoint, this means instead of giving the site ID as a parameter (and a relative path as the backup URL), the full URL to the folder in SharePoint (e.g., 'sharepoint://{tenant}.sharepoint.com/{PathToSite}/{DocumentBase}/{subfolder}') can be given, and the site ID will be looked up.
(This should match the existing SharePoint backend, including the convention of using '//' to indicate the document root, though I can't explicitly test that since the SharePoint sites I have access to require 2FA, which the old backend doesn't support.)
I've tested both explicit ID and site path methods of specifying the destination, and they appear to be working.
For Office 365 groups, it now supports looking up a group by its email address.
2018-03-22 15:20:17 -06:00
Tyler Gill 987cda7e1d When uploading large files, MS graph backends need to parse the response inside the try block for retries to work (since that is where errors are thrown) 2018-03-22 14:41:19 -06:00
Tyler Gill 258799266e SharePoint and Group drives appear to report quota info that is all zeros.
In that case, pretend that no quota info was reported instead of causing incorrect quota warnings and errors.
2018-03-22 14:40:37 -06:00
Tyler Gill 438c84f824 Ensure custom fragment sizes fit the recommended sizes (under 60 MiB and multiple of 320 KiB) 2018-03-21 11:32:41 -06:00
Tyler Gill 6c05da925e Explicitly request the 'replace' conflict resolution behavior when uploading large files. 2018-03-20 15:28:57 -06:00
Tyler Gill dbb28c5f62 Make sure DNS names reported by Microsoft Graph backends are unique. 2018-03-20 15:26:52 -06:00
Tyler Gill c57d7e75cd Add helpId parameter to UserInformationExceptions in MicrosoftGraphBackends. 2018-03-20 15:09:06 -06:00
Tyler Gill 94341a640d Implement DNSName method in MicrosoftGraphBackend base class. 2018-03-20 15:08:30 -06:00
Tyler Gill f4c6100873 Add Duplicati + version as the user agent in the MS Graph backends. 2018-03-20 15:07:46 -06:00
Tyler Gill a98c967f70 Add new backends for OneDrive+OneDrive for Business, SharePoint, and Microsoft Groups based on the Microsoft Graph API.
These backends are implemented via the common base class, MicrosoftGraphBackend, with only a few minor tweaks (different id parameters, protocol keys, descriptions, etc.)
All three backends support streaming, quota retrieval, and rename.
2018-03-20 14:18:49 -06:00