Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature/tus-improvements] tus support improvements (WIP) #80

Open
wants to merge 256 commits into
base: develop
Choose a base branch
from

Conversation

felix-schwarz
Copy link
Collaborator

Description

Improves support for tus and adds support for the following extensions:

Needs ocis-side support for the extensions for testing in production.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

- add additional details to OCHTTPPipeline logging
- remove unused source code (OCWaitConditionPendingRequest)
- disabling background NSURLSession usage for apps running under iOS 13.1+ and having a FileProvider
- add auto-resume flag when downloading files

OCHTTPPipeline:
- add support for auto-resume of downloads
- updated `CONFIGURATION.md` to document the change
- OCAppIdentity: added appVersion and appBuildNumber properties
- UIDevice+ModelID: category allowing to retrieve the device's model identifier
- OCHTTPPipeline:
	- OCHTTPPipeline.userAgent builds, caches and returns the User-Agent
	- injects User-Agent into requests before sending them out
	- new OCClassSettingsIdentifierHTTP and OCHTTPPipelineSettingUserAgent
- OCDatabase: removed leftover debug message
- add ability to register classes for keys globally (use this sparingly)
- avoid unneeded deserializations when notifying observers of new values: if there's no observer for a key, there's no need to deserialize it

OCProcessManager:
- make property-like method sharedProcessManager an actual property
…lability across supported platforms

	- Adapt code to compile File Provider support code only on iOS and Mac Catalyst
…at's used in startAuthenticationSession

	- added new OCAuthenticationBrowserSession class to allow plugging in alternative OAuth2 session providers
		- added OCAuthenticationBrowserSessionUIWebView as an implementation based on UIWebView, available right in the SDK as an option to work around issues in certain MDM software
	- added new OCClassSettings parameter "oa2-browser-session-class" to specify a class to use as alternative OAuth2 session providers
		- use "oc:authentication-oauth2.oa2-browser-session-class=string:UIWebView" as environment variable to use the OCAuthenticationBrowserSessionUIWebView class for OAuth2
	- added OC_FEATURE_AVAILABLE_AUTHENTICATION_SESSION availability macro

- add tvOS target and devices to ownCloudSDK target
	- fix dependencies and availability issues
…n-compatible APIs may be used (which silences a warning about this not being the case in a version of ownCloudApp with OCLicense*)
- SyncEngine: add preflight completion handler support
- LocalImport: make sure the placeholder completion handler is only called *after* the placeholder item is also in the database (fixes owncloud/enterprise#3642)
- CreateFolder: make sure the placeholder completion handler is only called *after* the placeholder item is also in the database (for future-proofing / consistency)
- OCItem: add -syncActivityDescription to provide a description of the OCItem sync activity contents
- adding .latestVersionOfLocalItem convenience attribute that retrieves (and caches) the latest version of an item

OCSyncActionUpload:
- use .latestVersionOfLocalItem instead of .localItem to fix an issue where a file was added offline, then updated offline, so that the activeSyncRecords of the OCItem got inconsistent:
	- upload file -> item has activeSyncRecord A
	- update file -> item has activeSyncRecords A, B
	- A: actually upload file -> item has no activeSyncRecords
	- B: actually update file -> item has activeSyncRecords A, spinning forever
- fix related issue that preflight could add a placeholder item to the database more than once, by only adding the placeholder as a new item if it has no databaseID yet
- OCConnection
	- new method to retrieve the path for a private link
- OCError
	- two new error codes indicating private link formatting or resolution errors
- OCCore
	- new method to retrieve the OCItem for a private link
	- make trackItem method more robust when targeting directories with non-OCPath-conforming paths (missing a trailing "/")
- OCItem+OCXMLObjectCreation
	- add support for extracting resolved private link paths
- Unit Tests
	- 4 new unit tests for the new OCConnection and OCCore methods
- expose background change scan activity via OCActivityIdentifierPendingServerScanJobsSummary activity identifier
- new OCBookmarkUserInfoKey type for OCBookmark.userInfo keys
- new OCBookmarkUserInfoKeyStatusInfo key holding the status.php contents of the last valid & non-maintenance connection to a server
- replace left-over usage of NSUUID* with OCBookmarkUUID in OCBookmarkManager

OCConnection:
- update OCBookmark.userInfo[OCBookmarkUserInfoKeyStatusInfo] on every successful connect
- add "email" to scope
- make scope configurable via ClassSettings
- document `oidc-scope` in CONFIGURATION.md
	- NSError category to simplify detecting NSErrors representing a network error/network failure
- OCConnection:
	- new OCConnection.authSignals that authentication methods can use to schedule their requests - allows the core to define conditions for these
- OCAuthenticationMethodOAuth2:
	- change token refresh to wait for network availability before sending token requests
	- taking advantage of new OCConnection.authSignals
	- fixing an unnecessary scheduling loop when no network connection is available and the token needs to be refreshed
- OCCore:
	- add new ready state (OCCoreStateReady) that is reached after setting up the infrastructure but before contacting the server
	- work around compiler bug in -[OCCore stopQuery:] that could crash the app
- OCCore+ConnectionStatus:
	- add new network available signal (OCConnectionSignalIDNetworkAvailable)
	- (re)starts background update checks and item task list scheduling when the connection is coming online
- OCCoreServerStatusSignalProvider:
	- allow providing the exact error when reporting that the connection was refused
	- uses the localizedDescription of the error as .shortDescription, if available
- OCCore+ItemList:
	- faster duplicate scheduled task detection
	- ensure OCQuerys are updated promptly even if there's already an item list task for the same path, resulting in queueing
	- fix bug that could permanently halt the item list task scheduling queue when offline
	- re-attempt update of item list tasks that failed and were put back in "new" state
	- ensure thread-safe use of _itemListTasksByPath
	- fix bug that led to deletion of scheduled background scans when offline
	- ensure scheduled background scans only take place when network is available (utilizing new OCConnectionSignalIDNetworkAvailable)
	- detect and avoid duplicate scheduling of jobs
- OCCoreItemListTask:
	- add new updateIfNew method to update only those sets whose state is "new"
	- add support for injecting required signal options depending on whether a PROPFIND is scheduled for a query or background scan
…che results, fetch new results in the event of a duplicate request, to ensure result consistency
…sync action until the metadata of an item changes or the item becomes unavailable

- OCEvent: new wakeup event (OCEventTypeWakeupSyncRecord) for use in wait conditions to wake up the Sync Engine
- OCCore+SyncEngine: new convenience method to create and send a wakeup event
- OCSyncActionDownload: improved handling of error 412
	- triggers a rescan of the enclosing directory to get up-to-date metadata to base future download retries on
	- adds a metadata refresh wait condition to pause the download until the metadata is up-to-date again
	- checks for versions of the item to download newer than the archived version the download was scheduled with - and updates itself if necessary
	- uses timeouts and a retry counter to avoid infinite retries in environments with frequent updates
	- provide an improved error message to the user if the error can't be resolved internally
…nd -[OCCore _pollForSharesWithScope:item:completionHandler:]
… enums

- OCConnection: provide better error message for HTTP status code 403 (DAV error message + fallback message)
…starting the core, ensuring that OAuth2 token refresh is carried out if the OCCore is started with an expired OAuth2 token
…l duplicate control and permanent removal of support for subfolder installs in `/owncloud/`.
- Connection Validator: infinite loops detection:
	- increments a counter for the URL whose response triggered a connection validation
	- decrements the counter when receiving a response from the same URL that no longer would trigger a connection validation (bringing it back to 0, ideally)
	- if the response to the URL triggered validation more than 3 times, the response is delivered instead of triggering validation
- Connection Setup:
	- count how often an URL was the target of a redirect during setup
	- if a URL was already targeted more than 0 times (adjustable), declare detection of the server root URL as failed
- HTTP Pipeline:
	- turn certificate missing log message from error into warning, since it is not handled as an error internally, either and can be confusing when debugging
…errors to indicate from where a redirection started

- OCAuthenticationMethodOpenIDConnect:
	- add redirection detection for .well-known/openid-configuration
	- improved error handling
- OCBookmark+Diagnostics: add "Use Origin URL as URL" action to reset multi-tenancy redirection info in bookmarks
- OCConnection:
	- fix recovery from answered redirection warning issues
	- add support for redirections to other hosts (previously a hard error)
- OCCore:
	- pick up certificate rejection errors from OCHTTPPolicyBookmark and present them to the user
	- remove unused attemptConnect method variant
- OCHTTPPolicyBookmark: improved description of errors where a certificate was changed but could not be auto-accepted
- OCCertificateDetailsViewNode: fix a crasher caused by unconverted object types stored in .previousValue
- OCConnection: add fallback option to extractBaseURLFromRedirectionTargetURL:… to return redirectionTargetURL in case no common base path could be found
- OCAuthenticationMethod: replace local fallback with above fallback
…ze resource usage

- OCAuthenticationMethodOAuth2: use OCLock to secure token refreshs and avoid issue (3) reported in ios-app#886
- OCHTTPPipeline: new HTSum-tagged brief one-line summary of HTTP requests and responses (to be extended)
- OCConnection+Setup: add base URL extraction call to redirection handling for status requests
- OCConnection: Connection Validator now also checks for the same port before it starts
- NSURL+OCURLNormalization: standardized URL port and scheme/host/port comparison additions, nullability annotations
…host and scheme to NSURL+OCURLNormalization utility method.
…owing shortening of the identifiers earlier)
	- NSDictionary category to expand flat keys into hierarchies
	- implemented unit test in MiscTests
- OCClassSettingsFlatSourceManagedConfiguration
	- add detection of changes pushed via MDM and posting OCClassSettingsManagedSettingsChanged notification
	- utilize NSDictionary+OCExpand to support simplified notations of MDM configurations
…mark that contains a provided OCLocalID

- OCCoreManager+ItemResolution: add new method to request OCCore and OCItem for a provided OCLocalID (build upon OCBookmarkManager+ItemResolution)
- OCChecksum+TUS: category providing a link between TUS-style checksums and the existing OCChecksum infrastructure
- differentiate between tus protocol provided and OC-specific metadata keys
- add preliminary support for upload-tag extension
- add additional debug output
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@felix-schwarz felix-schwarz changed the base branch from master to develop February 25, 2021 16:17
@delete-merged-branch delete-merged-branch bot deleted the branch develop June 21, 2023 08:10
@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Merging #80 (254633e) into develop (2dff1ea) will decrease coverage by 77.51%.
Report is 61 commits behind head on develop.
The diff coverage is 1.51%.

@@             Coverage Diff             @@
##           develop     #80       +/-   ##
===========================================
- Coverage    78.94%   1.43%   -77.51%     
===========================================
  Files          227     310       +83     
  Lines        26444   37454    +11010     
===========================================
- Hits         20877     539    -20338     
- Misses        5567   36915    +31348     
Files Coverage Δ
ownCloudSDK/Activity/OCActivityUpdate.m 0.00% <ø> (-84.00%) ⬇️
...wnCloudSDK/Authentication/OCAuthenticationMethod.h 100.00% <100.00%> (ø)
...wnCloudSDK/Core/FileProvider/OCCore+FileProvider.m 0.00% <ø> (ø)
ownCloudSDK/Core/ItemList/OCCoreItemList.m 0.00% <ø> (-73.92%) ⬇️
...es/Processors/Vacuum/OCItemPolicyProcessorVacuum.h 100.00% <100.00%> (ø)
.../Sync/Actions/Delete/OCSyncActionLocalCopyDelete.m 0.00% <ø> (ø)
.../Core/Sync/Actions/Download/OCSyncActionDownload.m 5.86% <ø> (-43.47%) ⬇️
...oudSDK/Core/Sync/Actions/OCSyncAction+Diagnostic.m 0.00% <ø> (ø)
ownCloudSDK/Core/Sync/Actions/OCSyncAction.h 75.00% <ø> (-25.00%) ⬇️
ownCloudSDK/Core/Sync/Actions/OCSyncAction.m 11.72% <ø> (-63.75%) ⬇️
... and 145 more

... and 145 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants