Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for multipart range requests according to rfc 7233 #1418

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

DanRiess
Copy link

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.

@phil-davis
Copy link
Contributor

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
Copy link
Contributor

Then try:

composer phpunit

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

@DanRiess
Copy link
Author

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.

@phil-davis
Copy link
Contributor

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.

@DanRiess
Copy link
Author

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.

@codecov
Copy link

codecov bot commented Sep 30, 2022

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%) ⬆️
lib/DAV/Server.php 94.94% <88.88%> (-1.73%) ⬇️
lib/DAV/CorePlugin.php 96.52% <99.00%> (+1.10%) ⬆️

... and 87 files with indirect coverage changes

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

@DanRiess
Copy link
Author

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

@Madrich
Copy link

Madrich commented Oct 31, 2022

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
Copy link

Madrich commented Feb 21, 2023

Hi Phil, are you going to merge soon?

@Madrich
Copy link

Madrich commented Jun 20, 2023

Please merge asap .... thanks

* If the first offset is null, the second offset should be used to retrieve the last x bytes of the entity
*
* @return int[]|null
* @return string|null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the signature of a public function which breaks BC ...

... we need to see how to work around this ....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:

  • keep getHTTPRange unchanged
  • mark it as deprecated
  • add new method getHttpRangeString (better naming accepted)
  • base the new implementation in core plugin upon the new method

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your feedback! I have added the changes as per your suggestion.

lib/DAV/Server.php Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants