flymzero / webdav_client

A dart WebDAV client library
https://pub.dev/packages/webdav_client
BSD 3-Clause "New" or "Revised" License
54 stars 34 forks source link

writeFromFile stream modification and OPTIONS fix #9

Closed dutsky closed 2 years ago

dutsky commented 3 years ago

Hello! This PR built above @isoos's PR #6 There was an error if you try to use this patch when your webdav server responses just for one non-root directory and not for the entire server. For example, if your webserver have static pages(without auth) at / or other directories and handle authenticated webdav requests under /webdav directory only. There is situation when fix in commit 3aac22ca087336f05cb447b437b360ea4899e1c4 doesn't works: 1) webdav_client asks the webserver to OPTIONS / and webserver answers with 200 without any webdav information, because server-side webdav module doesn't know anything above /webdav directory 3) webdav_client subscribing to file stream and trying to PUT file without authorization, but here webdav server answers 401 authentication required 4) webdav_client retrying, but fail with DIOErrors or something like "stream already listened".

I hope this PR will fix this error.

flymzero commented 2 years ago

thanks, but something need to change, such as data.length and.... i will add new version to add these, thanks very much.