dav icon indicating copy to clipboard operation
dav copied to clipboard

add support for multipart range requests according to rfc 7233

Open DanRiess opened this issue 3 years ago • 10 comments

This implementation of the WebDav standard was missing multipart range request support. These kinds of requests are important for speeding up NextCloud file access of large binary files.

DanRiess avatar Sep 27 '22 10:09 DanRiess

https://github.com/sabre-io/dav/actions/runs/3134827626/jobs/5090168461 php-cs-fixer complains. Please run:

composer install
composer cs-fixer

and commit the code-style changes that it makes. That will get past the first bit of CI.

phil-davis avatar Sep 27 '22 10:09 phil-davis

Then try:

composer phpunit

and sort out getting the unit tests to pass, and add some unit tests to cover new functionality.

phil-davis avatar Sep 27 '22 10:09 phil-davis

Excuse the noob question, but how do I set up the local server for the unit tests? I tried using php -S localhost:8000 in the tests folder (elevated and non elevated console) and failed a lot of them that shouldn't have anything to do with what i wrote. Usually it was some access forbidden or resource not available errors.

DanRiess avatar Sep 29 '22 08:09 DanRiess

After having done composer install or composer update there will be sabre/http in the vendor dir. That has some resources that the tests expect to be available at localhost:8000

In a terminal from the root of the dav repo, run:

php -S localhost:8000 -t vendor/sabre/http/tests/www

Then run the tests in another terminal window:

phil@phil-Inspiron-5468:~/git/sabre-io/dav$ composer phpunit
> phpunit --configuration tests/phpunit.xml
PHPUnit 9.5.25 #StandWithUkraine

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

.............................................................   61 / 1796 (  3%)
.............................................................  122 / 1796 (  6%)
.............................................................  183 / 1796 ( 10%)
.........SSSS................................................  244 / 1796 ( 13%)
.............................................................  305 / 1796 ( 16%)
.............................................................  366 / 1796 ( 20%)
....SSSSSSSSSSSSSSSS.........................................  427 / 1796 ( 23%)
...........................................................SS  488 / 1796 ( 27%)
SSSSSSSSSSSSSSSS.............................................  549 / 1796 ( 30%)
.............................................................  610 / 1796 ( 33%)
.............................................................  671 / 1796 ( 37%)
.............................................................  732 / 1796 ( 40%)
.............................................................  793 / 1796 ( 44%)
.............................................................  854 / 1796 ( 47%)
..................SSSSSSSSSSSSSSSSSSSSSSSSSS.................  915 / 1796 ( 50%)
.............................................................  976 / 1796 ( 54%)
...............SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS 1037 / 1796 ( 57%)
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS. 1098 / 1796 ( 61%)
............................................................. 1159 / 1796 ( 64%)
............................................................. 1220 / 1796 ( 67%)
............................................................. 1281 / 1796 ( 71%)
............................................................. 1342 / 1796 ( 74%)
............................................................. 1403 / 1796 ( 78%)
............................................................. 1464 / 1796 ( 81%)
............................................................. 1525 / 1796 ( 84%)
............................................................. 1586 / 1796 ( 88%)
............................................................. 1647 / 1796 ( 91%)
....................SSSSSSSSSSSSSSSSSSSSSSSSSSSS............. 1708 / 1796 ( 95%)
............................................................. 1769 / 1796 ( 98%)
...........................                                   1796 / 1796 (100%)

Time: 00:11.504, Memory: 102.00 MB

OK, but incomplete, skipped, or risky tests!
Tests: 1796, Assertions: 3183, Skipped: 198.

That gets rid of 3 errors that I had at first.

phil-davis avatar Sep 29 '22 09:09 phil-davis

Thanks for your help! I did that and it did indeed fix some issues. I still get loads of errors and failures However, i get even more errors when i try to run the unit tests of the original repo. So I guess it's my work environment. I decided to ignore most of them now and only took care about the ones directly affecting get requests and ranges, fixed them and added some unit tests for multipart stuff.

DanRiess avatar Sep 30 '22 08:09 DanRiess

Codecov Report

Merging #1418 (d2879cf) into master (5c4fb8e) will increase coverage by 0.03%. The diff coverage is 98.16%.

@@             Coverage Diff              @@
##             master    #1418      +/-   ##
============================================
+ Coverage     97.23%   97.26%   +0.03%     
- Complexity     2830     2858      +28     
============================================
  Files           175      175              
  Lines          8566     9503     +937     
============================================
+ Hits           8329     9243     +914     
- Misses          237      260      +23     
Impacted Files Coverage Δ
lib/CalDAV/Schedule/IMipPlugin.php 98.24% <ø> (+0.13%) :arrow_up:
lib/DAV/Server.php 94.94% <88.88%> (-1.73%) :arrow_down:
lib/DAV/CorePlugin.php 96.52% <99.00%> (+1.10%) :arrow_up:

... and 87 files with indirect coverage changes

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

codecov[bot] avatar Sep 30 '22 08:09 codecov[bot]

hey, could someone please approve the workflow again? i updated code and tests to make the codecov bot happier

DanRiess avatar Oct 25 '22 10:10 DanRiess

I am interested in that feature too. Plz approve ... Many thanks to Daniel

Phil, would be nice to approve soon and finish this. Thank you

Madrich avatar Oct 31 '22 10:10 Madrich

Hi Phil, are you going to merge soon?

Madrich avatar Feb 21 '23 09:02 Madrich

Please merge asap .... thanks

Madrich avatar Jun 20 '23 08:06 Madrich