diff --git a/DecaTec.WebDav/WebDavArtifacts/Prop.cs b/DecaTec.WebDav/WebDavArtifacts/Prop.cs index 95a9f56..65e2f83 100644 --- a/DecaTec.WebDav/WebDavArtifacts/Prop.cs +++ b/DecaTec.WebDav/WebDavArtifacts/Prop.cs @@ -826,7 +826,9 @@ public string ParentName /// /// Gets or sets additional WebDAV properties as array. /// - /// This property is used for WebDAV properties not defined in RFC 4918, RFC 4331, Additional WebDAV Collection Properties or IIS WebDAV specification. + /// This property is used for WebDAV properties not defined in RFC 4918, RFC 4331, Additional WebDAV Collection Properties or IIS WebDAV specification. + ///

+ /// Important: Additional WebDAV properties are currently not supported on Xamarin. See the project's wiki for more information about the Portable WebDAV Library used on Xamarin.
[XmlAnyElement] public XElement[] AdditionalProperties { diff --git a/DecaTec.WebDav/WebDavClient.cs b/DecaTec.WebDav/WebDavClient.cs index f3d534e..5b14049 100644 --- a/DecaTec.WebDav/WebDavClient.cs +++ b/DecaTec.WebDav/WebDavClient.cs @@ -114,7 +114,7 @@ public class WebDavClient : HttpClient private const string MediaTypeXml = "application/xml"; - internal static readonly Version DefaultHttpVersion = new Version(2, 0); + internal static readonly Version DefaultHttpVersion = new Version(1, 1); #region Constructor diff --git a/DecaTec.WebDav/WebDavSessionItem.cs b/DecaTec.WebDav/WebDavSessionItem.cs index cbf8827..baeb40a 100644 --- a/DecaTec.WebDav/WebDavSessionItem.cs +++ b/DecaTec.WebDav/WebDavSessionItem.cs @@ -615,6 +615,7 @@ private set /// /// Gets the representing the additional WebDAV properties not defined in RFC 4918, RFC 4331, Additional WebDAV Collection Properties or the IIS WebDAV specification. /// + /// Important: Additional WebDAV properties are currently not supported on Xamarin. See the project's wiki for more information about the Portable WebDAV Library used on Xamarin. public AdditionalWebDavProperties AdditionalProperties { get diff --git a/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/HowTo.aml b/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/HowTo.aml index 11f50bc..eb2b894 100644 --- a/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/HowTo.aml +++ b/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/HowTo.aml @@ -30,6 +30,12 @@ + + + + + + diff --git a/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/Http2.aml b/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/Http2.aml new file mode 100644 index 0000000..969ce81 --- /dev/null +++ b/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/Http2.aml @@ -0,0 +1,47 @@ + + + + + + + The Portable WebDAV Library has full HTTP/2 support. But for compatibility reasons (Xamarin), the default is still HTTP/1.1. + + + +
+ + + In oder to use HTTP/2, use the property HttpVersion or an overloaded constructor of WebDavClient/WebDavSession: + + + > List() +{ + // The base URL of the WebDAV server. + var webDavServerUrl = @"http://www.myserver.com/webdav/"; + + // Specify the user credentials and use it to create a WebDavSession instance. + var credentials = new NetworkCredential("MyUsername", "MyPassword"); + + using (var webDavSession = new WebDavSession(webDavServerUrl, credentials, new Version(2, 0))) + { + // You could also use the property HttpVersion to use HTTP/2: + // webDavSession.HttpVersion = new Version(2, 0); + + var list = await webDavSession.ListAsync("/"); + return list; + } +} + ]]> + + +
+ + + + + +
+
diff --git a/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/Xamarin.aml b/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/Xamarin.aml index 7957f0f..56f3ef3 100644 --- a/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/Xamarin.aml +++ b/Documentation/DecaTec.WebDav.Documentation/Content/HowTos/Xamarin.aml @@ -55,6 +55,20 @@ var items = await webDavSession.ListAsync("/folder"); // Will raise exception +
+ + Unknown WebDAV properties + + + + Currently unknown WebDAV properties are not supported when using the Portable WebDAV Library on Xamarin. This is due to the fact that these AdditionalProperties of Prop cannot be (de-) serialized on Xamarin. The operations will throw an exception that the XmlAnyElementAttribute cannot be applied to XElement arrays. + + + As a workaround, use WebDavClient providing XML strings directly (e.g. for PropFind). These XML strings need to be created by the client using the library. + + +
+ diff --git a/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/v1.1.0.0.aml b/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/v1.1.0.0.aml index d96bddc..54042dd 100644 --- a/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/v1.1.0.0.aml +++ b/Documentation/DecaTec.WebDav.Documentation/Content/VersionHistory/v1.1.0.0.aml @@ -13,13 +13,11 @@ - Added full HTTP/2 support. + Added full HTTP/2 support. - - - + - The library now uses HTTP/2 by default. Use the overloaded constructors (WebDavClient/WebDavSession) to use other HTTP versions than 2.0. + The default HTTP version is still HTTP/1.1 for compatibility reasons (Xamarin). Use the overloaded constructors or the property HttpVersion (WebDavClient/WebDavSession) to use HTTP/2 instead. diff --git a/Documentation/DecaTec.WebDav.Documentation/ContentLayout.content b/Documentation/DecaTec.WebDav.Documentation/ContentLayout.content index 173d9f9..41da4f1 100644 --- a/Documentation/DecaTec.WebDav.Documentation/ContentLayout.content +++ b/Documentation/DecaTec.WebDav.Documentation/ContentLayout.content @@ -24,7 +24,12 @@ - + + + + + + @@ -144,7 +149,7 @@ - + diff --git a/Documentation/DecaTec.WebDav.Documentation/DecaTec.WebDav.Documentation.shfbproj b/Documentation/DecaTec.WebDav.Documentation/DecaTec.WebDav.Documentation.shfbproj index 5677f2d..ef04a99 100644 --- a/Documentation/DecaTec.WebDav.Documentation/DecaTec.WebDav.Documentation.shfbproj +++ b/Documentation/DecaTec.WebDav.Documentation/DecaTec.WebDav.Documentation.shfbproj @@ -92,6 +92,7 @@ + diff --git a/UnitTests/DecaTec.WebDav.UnitTest/UnitTestWebDavClient.cs b/UnitTests/DecaTec.WebDav.UnitTest/UnitTestWebDavClient.cs index 4312551..25aa7fa 100644 --- a/UnitTests/DecaTec.WebDav.UnitTest/UnitTestWebDavClient.cs +++ b/UnitTests/DecaTec.WebDav.UnitTest/UnitTestWebDavClient.cs @@ -61,14 +61,14 @@ private WebDavClient CreateWebDavClient(MockHttpMessageHandler mockHandler) public void UT_WebDavClient_ConstructorWithDefaultHttpVersion() { var client = new WebDavClient(); - Assert.AreEqual(new Version(2, 0), client.HttpVersion); + Assert.AreEqual(new Version(1, 1), client.HttpVersion); } [TestMethod] public void UT_WebDavClient_ConstructorWithNonDefaultHttpVersion() { - var client = new WebDavClient(new Version(1, 1)); - Assert.AreEqual(new Version(1, 1), client.HttpVersion); + var client = new WebDavClient(new Version(2, 0)); + Assert.AreEqual(new Version(2, 0), client.HttpVersion); } #endregion Constructor @@ -147,7 +147,7 @@ public void UT_WebDavClient_UnLockAsync_WithoutLockToken() public void UT_WebDavClient_WithHttpVersionDefault() { var mockHandler = new MockHttpMessageHandler(); - var defaultHttpVersion = new Version(2, 0); + var defaultHttpVersion = new Version(1, 1); mockHandler.When(WebDavMethod.PropFind, WebDavRootFolder).With(req => req.Version == defaultHttpVersion).Respond(HttpStatusCode.OK); diff --git a/UnitTests/DecaTec.WebDav.UnitTest/UnitTestWebDavSession.cs b/UnitTests/DecaTec.WebDav.UnitTest/UnitTestWebDavSession.cs index 22c8c93..072b16c 100644 --- a/UnitTests/DecaTec.WebDav.UnitTest/UnitTestWebDavSession.cs +++ b/UnitTests/DecaTec.WebDav.UnitTest/UnitTestWebDavSession.cs @@ -1,7 +1,6 @@ using DecaTec.WebDav.Headers; using DecaTec.WebDav.MessageHandlers; using DecaTec.WebDav.Tools; -using DecaTec.WebDav.WebDavArtifacts; using Microsoft.VisualStudio.TestTools.UnitTesting; using RichardSzalay.MockHttp; using System; @@ -9,7 +8,6 @@ using System.IO; using System.Net; using System.Net.Http; -using System.Text; namespace DecaTec.WebDav.UnitTest { @@ -65,7 +63,7 @@ public void UT_WebDavSession_ConstructorWithDefaultHttpVersion() { var credentials = new NetworkCredential(UserName, Password); var session = new WebDavSession(credentials); - Assert.AreEqual(new Version(2, 0), session.HttpVersion); + Assert.AreEqual(new Version(1, 1), session.HttpVersion); } @@ -73,8 +71,8 @@ public void UT_WebDavSession_ConstructorWithDefaultHttpVersion() public void UT_WebDavSession_ConstructorWithNomDefaultHttpVersion() { var credentials = new NetworkCredential(UserName, Password); - var session = new WebDavSession(credentials, new Version(1, 1)); - Assert.AreEqual(new Version(1, 1), session.HttpVersion); + var session = new WebDavSession(credentials, new Version(2, 0)); + Assert.AreEqual(new Version(2, 0), session.HttpVersion); } diff --git a/changelog.md b/changelog.md index 35f3121..ac09631 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ v1.1.0.0 -- Added full HTTP/2 support. -- The library now uses HTTP/2 by default. Use the overloaded constructors (WebDavClient/WebDavSession) to use other HTTP versions than 2.0. +- Added full HTTP/2 support. The default HTTP version is still HTTP/1.1 for compatibility reasons (Xamarin). Use the overloaded constructors or the property HttpVersion (WebDavClient/WebDavSession) to use HTTP/2 instead. +- The WebDavSession now exposes the DefaultRequestHeaders of the underlying WebDavClient. By using this property, default headers can be set which should be sent with every request of the WebDavSession. v1.0.1.0 - Bugfix [Xamarin]: WebDavSession.ListAsync returned wrong URLs when used with folders containing spaces.