GithubHelp home page GithubHelp logo

Comments (9)

DecaTec avatar DecaTec commented on August 11, 2024 1

Yes, the property WebProxy doesn't do anything. I've changed a bit on the library, so it should support using a proxy. Unfortunately, I don't have a proxy configuration to test against.

I've created a new package on MyGet: https://www.myget.org/feed/decatec-preview/package/nuget/PortableWebDavLibrary

Could you please have a look at it and provide some feedback?
The only thing you'll have to do is set the new property UseProxy on WebDavSession to true in order to change the internal handling when combining URIs.

from portable-webdav-library.

DecaTec avatar DecaTec commented on August 11, 2024 1

OK, here's a new beta version: https://www.myget.org/feed/decatec-preview/package/nuget/PortableWebDavLibrary

It contains:

  • Removed the unused property WebProxy.
  • WebDavSession.ListAsync methods now have an optional parameter uriKind (defaults to UriKind.Absolute). When UriKind.Relative is specified, the URIs of the resulting WebDavSessionItems are relative URIs.

That will not work with your current WebDAV server as long as the wrong URLs are returned by the server. But you can give it a try when the server configuration was changed. Looking forward for your feedback.

from portable-webdav-library.

YZahringer avatar YZahringer commented on August 11, 2024

Yes it works! Thanks for the quick fix

from portable-webdav-library.

DecaTec avatar DecaTec commented on August 11, 2024

Thanks for your feedback!

But this is only a test with a preview version of the library.
Problems I need to solve before releasing new version:

  • When using a constructor of WebDavSession which does not use a HttpMessageHandler, the proxy has to be specified in the constructor. In this case the WebDavSession "knows" that a proxy is used. When using a constructor specifying a HttpMessageHandler which has the proxy settings in its internals, I don't know if a proxy should be used or not. Unfortunately, I cannot retrieve information about a proxy only with the HttpMessageHandler used. Therefore I think about changing the signature of the WebDavSession's constructors using a HttpClientHandler.
  • In your case, the local server (hrefs in the result, MyLocalServer.localdoimain.com) provides absolute URIs. Thus, when combining URIs, I simply ignore the BaseUri (PublicWebDav.domain.com). What if the WebDAV server only provides relative URIs (e.g. not http://MyLocalServer.localdomain.com/Folder1, but only "Folder1"). Then the algorithm will fail.

Looking at your example above: PROPFIND for https://PublicWebdav.domain.com/RootFolder/ gives you result hrefs href=http://MyLocalServer.localdomain.com/Folder1 and href=http://MyLocalServer.localdomain.com/Folder2
What next, e.g. when you want to execute another PROPFIND for "Folder1"?
Would this be PROPFIND https://PublicWebdav.domain.com/RootFolder/Folder1 or http://MyLocalServer.localdomain.com/Folder1? I do think that only the first PROPFIND will work, so the WebDavSession.ListAsync has to create a different href for that item.
If that is true, the algorithm for creating combined URIs has to be changed.

Any ideas?
And can you please provide a piece of code showing how you create the WebDavSession?

from portable-webdav-library.

YZahringer avatar YZahringer commented on August 11, 2024

Yes, there are other problems after a few tests:

  • Call ListAsync with relative URI throw exception
  • Call ListAsync with different URI of baseURI throw exception

I was thinking to rewrite the URIs in response of PROPFIND with http://PublicWebdav.domain.com/RootFolter/ + relativeUriFromResult

It's not clean, but I do not see other solution.

Regarding HttpClientHandler, I think it's better to leave HttpMessageHandler in the constructor. Why put the WebProxy in the constructor? He is already in HttpClientHandler property, i can inject an HttpClientHandler with proxy.

A property like bool ProcessResponseUri could not be a solution?

from portable-webdav-library.

DecaTec avatar DecaTec commented on August 11, 2024

Well, simply combining the URIs this way should be a bit tricky. As an example: Looking at the URIs https://publicwebdav.domain.com/RootFolder/ and http://mylocalserver.localdomain.com/Folder1, what do they have in common? The host differs, but also the relative URIs.
What I can think of is that the proxy server does not handle the URIs correctly. The proxy should never return any URIs of the "local" server (behind the proxy) imho.

How does your proxy server configuration looks like? What comes to my mind is "ProxyPreserveHost" of Apache: see https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypreservehost

from portable-webdav-library.

YZahringer avatar YZahringer commented on August 11, 2024

I agree, there is a Proxy configuration problem. Unfortunately it is not my WebDav server, but I will try to contact the administrator to see if he can adapt the configuration. I think he should send me relative URLs in responses.

I still think that calls should work and not generate an exception. The response is OK, the href does not have the same scheme or same domain, but it should be accepted. Leave the original href if UriHelper.CombineUri generates an exception would not be a solution?

from portable-webdav-library.

DecaTec avatar DecaTec commented on August 11, 2024

@YZahringer Have you tested the beta version yet? Is it working for you?

from portable-webdav-library.

DecaTec avatar DecaTec commented on August 11, 2024

I'll close this issue because v1.1.7.0 was just released.
Feel free to open the issue again when you have any problems with the new release.

from portable-webdav-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.