diff --git a/DecaTec.WebDav/DecaTec.WebDav.csproj b/DecaTec.WebDav/DecaTec.WebDav.csproj
index 0363a4d..923373f 100644
--- a/DecaTec.WebDav/DecaTec.WebDav.csproj
+++ b/DecaTec.WebDav/DecaTec.WebDav.csproj
@@ -3,7 +3,7 @@
netstandard1.1PortableWebDavLibrary
- 1.1.1.0
+ 1.1.2.0DecaTecDecaTecPortableWebDavLibrary
@@ -16,8 +16,8 @@
WebDAV, portable, NETStandard, NETCore, UWP, dotnet, portable-webdav-library, Xamarin, Mono, multiplatformTrueFull documentation with changelog is available at https://decatec.de/ext/PortableWebDAVLibrary/Doc
- 1.1.1.0
- 1.1.1.0
+ 1.1.2.0
+ 1.1.2.0
diff --git a/DecaTec.WebDav/Tools/WebDavHelper.cs b/DecaTec.WebDav/Tools/WebDavHelper.cs
index 347a5c7..3d69ee9 100644
--- a/DecaTec.WebDav/Tools/WebDavHelper.cs
+++ b/DecaTec.WebDav/Tools/WebDavHelper.cs
@@ -18,39 +18,6 @@ namespace DecaTec.WebDav.Tools
///
public static class WebDavHelper
{
- ///
- /// Gets the from a .
- ///
- /// The whose should be retrieved.
- /// The of the or null if the does not contain a lock token.
- /// Thrown if the is null.
- public static ActiveLock GetActiveLockFromWebDavResponseMessage(WebDavResponseMessage responseMessage)
- {
- if (responseMessage == null)
- throw new ArgumentNullException(nameof(responseMessage));
-
- var prop = WebDavResponseContentParser.ParsePropResponseContentAsync(responseMessage.Content).Result;
- var activeLock = prop.LockDiscovery?.ActiveLock.FirstOrDefault();
-
- if (activeLock == null)
- return null;
-
- // If lock token was not be found in the response content, it should be submitted by response header.
- if (activeLock.LockToken == null)
- // Try to get lock token from response header.
- if (responseMessage.Headers.TryGetValues(WebDavRequestHeader.LockToken, out IEnumerable lockTokenHeaderValues))
- {
- // We assume only one Lock-Token header is sent, based on the spec: https://tools.ietf.org/html/rfc4918#section-9.10.1
- var lockTokenHeaderValue = lockTokenHeaderValues.FirstOrDefault();
-
- // Make sure the lockTokenHeaderValue is valid according to spec (https://tools.ietf.org/html/rfc4918#section-10.5).
- if (lockTokenHeaderValue != null && CodedUrl.TryParse(lockTokenHeaderValue, out var _))
- activeLock.LockToken = new WebDavLockToken { Href = lockTokenHeaderValue };
- }
-
- return activeLock;
- }
-
///
/// Gets a UTF-8 encoded string by serializing the object specified.
///
@@ -135,6 +102,41 @@ public static LockToken GetLockTokenFromWebDavResponseMessage(WebDavResponseMess
return null;
}
+ ///
+ /// Gets the from a .
+ ///
+ /// The whose should be retrieved.
+ /// The of the or null if the does not contain a lock token.
+ /// Thrown if the is null.
+ public static ActiveLock GetActiveLockFromWebDavResponseMessage(WebDavResponseMessage responseMessage)
+ {
+ if (responseMessage == null)
+ throw new ArgumentNullException(nameof(responseMessage));
+
+ var prop = WebDavResponseContentParser.ParsePropResponseContentAsync(responseMessage.Content).Result;
+ var activeLock = prop.LockDiscovery?.ActiveLock.FirstOrDefault();
+
+ if (activeLock == null)
+ return null;
+
+ // If lock token was not be found in the response content, it should be submitted by response header.
+ if (activeLock.LockToken == null)
+ {
+ // Try to get lock token from response header.
+ if (responseMessage.Headers.TryGetValues(WebDavRequestHeader.LockToken, out IEnumerable lockTokenHeaderValues))
+ {
+ // We assume only one Lock-Token header is sent, based on the spec: https://tools.ietf.org/html/rfc4918#section-9.10.1
+ var lockTokenHeaderValue = lockTokenHeaderValues.FirstOrDefault();
+
+ // Make sure the lockTokenHeaderValue is valid according to spec (https://tools.ietf.org/html/rfc4918#section-10.5).
+ if (lockTokenHeaderValue != null && CodedUrl.TryParse(lockTokenHeaderValue, out var _))
+ activeLock.LockToken = new WebDavLockToken { Href = lockTokenHeaderValue };
+ }
+ }
+
+ return activeLock;
+ }
+
///
/// Extracts the property names (known and unknown) from a .
///
diff --git a/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/VersionHistory.aml b/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/VersionHistory.aml
index 554b9cb..76304a7 100644
--- a/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/VersionHistory.aml
+++ b/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/VersionHistory.aml
@@ -146,6 +146,12 @@
+
+
+
+
+
+
diff --git a/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/v1.1.2.0.aml b/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/v1.1.2.0.aml
new file mode 100644
index 0000000..22d6063
--- /dev/null
+++ b/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/v1.1.2.0.aml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+ Changes in release v1.1.2.0
+
+
+
+
+
+
+ WebDavHelper: Added method to receive the ActiveLock from a WebDavResponseMessage.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Documentation/DecaTec.WebDav.Documentation/ContentLayout.content b/Documentation/DecaTec.WebDav.Documentation/ContentLayout.content
index f09bded..ed6906a 100644
--- a/Documentation/DecaTec.WebDav.Documentation/ContentLayout.content
+++ b/Documentation/DecaTec.WebDav.Documentation/ContentLayout.content
@@ -154,10 +154,15 @@
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Documentation/DecaTec.WebDav.Documentation/DecaTec.WebDav.Documentation.shfbproj b/Documentation/DecaTec.WebDav.Documentation/DecaTec.WebDav.Documentation.shfbproj
index a8b33a8..34002ad 100644
--- a/Documentation/DecaTec.WebDav.Documentation/DecaTec.WebDav.Documentation.shfbproj
+++ b/Documentation/DecaTec.WebDav.Documentation/DecaTec.WebDav.Documentation.shfbproj
@@ -120,6 +120,7 @@
+
diff --git a/UnitTests/DecaTec.WebDav.UnitIntegrationTest/UnitIntegrationTestWebDavClient.cs b/UnitTests/DecaTec.WebDav.UnitIntegrationTest/UnitIntegrationTestWebDavClient.cs
index 04f694b..c0e8523 100644
--- a/UnitTests/DecaTec.WebDav.UnitIntegrationTest/UnitIntegrationTestWebDavClient.cs
+++ b/UnitTests/DecaTec.WebDav.UnitIntegrationTest/UnitIntegrationTestWebDavClient.cs
@@ -56,7 +56,7 @@ public static void ClassSetup(TestContext ctx)
{
throw new FileNotFoundException("The configuration file cannot be found. Make sure that there is a file 'TestConfiguration.txt' in the test's output folder containing data about the WebDAV server to test against.", ConfigurationFile, ex);
}
- }
+ }
private WebDavClient CreateWebDavClientWithDebugHttpMessageHandler()
{
@@ -73,7 +73,7 @@ private WebDavClient CreateWebDavClientWithDebugHttpMessageHandler()
var debugHttpMessageHandler = new DebugHttpMessageHandler(httpClientHandler);
var wdc = new WebDavClient(debugHttpMessageHandler);
return wdc;
- }
+ }
#region Copy
@@ -87,7 +87,7 @@ public void UIT_WebDavClient_Copy()
var testFile = UriHelper.CombineUrl(testCollectionSource, TestFile, true);
// Create source collection.
- var response = client.MkcolAsync(testCollectionSource).Result;
+ var response = client.MkcolAsync(testCollectionSource).Result;
var mkColResponseSuccess = response.IsSuccessStatusCode;
// Put file.
@@ -96,11 +96,11 @@ public void UIT_WebDavClient_Copy()
var content = new StreamContent(fileStream);
response = client.PutAsync(testFile, content).Result;
}
-
+
var putResponseSuccess = response.IsSuccessStatusCode;
// Copy.
- response = client.CopyAsync(testCollectionSource, testCollectionDestination).Result;
+ response = client.CopyAsync(testCollectionSource, testCollectionDestination).Result;
var copyResponseSuccess = response.IsSuccessStatusCode;
// PropFind.
@@ -506,19 +506,21 @@ public void UIT_WebDavClient_LockRefreshLockUnlock()
return;
using (var client = CreateWebDavClientWithDebugHttpMessageHandler())
- {
+ {
+ var userEmail = "test@test.com";
// Lock.
var lockInfo = new LockInfo()
{
LockScope = LockScope.CreateExclusiveLockScope(),
LockType = LockType.CreateWriteLockType(),
- OwnerHref = "test@test.com"
+ OwnerHref = userEmail
};
var response = client.LockAsync(webDavRootFolder, WebDavTimeoutHeaderValue.CreateWebDavTimeout(TimeSpan.FromMinutes(1)), WebDavDepthHeaderValue.Infinity, lockInfo).Result;
var lockResponseSuccess = response.IsSuccessStatusCode;
LockToken lockToken = WebDavHelper.GetLockTokenFromWebDavResponseMessage(response);
+ ActiveLock activeLock = WebDavHelper.GetActiveLockFromWebDavResponseMessage(response);
// Refresh lock.
response = client.RefreshLockAsync(webDavRootFolder, WebDavTimeoutHeaderValue.CreateWebDavTimeout(TimeSpan.FromSeconds(10)), lockToken).Result;
@@ -530,6 +532,7 @@ public void UIT_WebDavClient_LockRefreshLockUnlock()
Assert.IsTrue(lockResponseSuccess);
Assert.IsNotNull(lockToken);
+ Assert.AreEqual(userEmail, activeLock.OwnerHref);
Assert.IsTrue(refreshLockResponseSuccess);
Assert.IsTrue(unlockResponseSuccess);
}
diff --git a/changelog.md b/changelog.md
index 3e7349b..db66ab7 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,6 @@
+v1.1.2.0
+- WebDavHelper: Added method to receive the ActiveLock from a WebDavResponseMessage.
+
v1.1.1.0
- WebDavClient: Added missing overload for Mkcol accepting an URI/URL and a CancellationToken.