-
Notifications
You must be signed in to change notification settings - Fork 365
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
Improve streaming range responses #3872
Conversation
This is an enhanced fix for varnishcache#1777
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice and tidy!
FYI this new logic conflicts with the refactor in the pending #3859. |
At quick glance it shouldn't be a conflict too hard to solve, thank you for pointing it out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bugwash: we need to study the effect on HTTP/1 framing closely.
Without a known The potentially new case is that the response processes less bytes than indicated by varnish-cache/bin/varnishd/cache/cache_range.c Lines 51 to 64 in eec2a6b
It probably needs to be patched so that the request doesn't fail when |
Amended my PR with a patch to not error on short ranges. FYI, the logic in |
After a brief look at 535a5f0, I come to the same nice and tidy conclusion. You even went the extra mile and found a disabled test case that you rehabilitated. I missed this when I first reviewed this directly on Github and I just noticed after a first pass in my proper work environment. FYI we have lined up 3 reviewers to comb this pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has taken me several partial attempts but I finally managed an almost complete review. I couldn't find anything wrong and I'm confident this is a solid change. We often get very good contributions but this one checks all my marks and then more.
Thank you again!
The last thing I need to do what I mentioned above in #3872 (comment) but I would rather adapt my work after merging this one.
Bugwash: OK. |
Opportunity noticed during the review of #3872.
This is a proper fix for #1777 so that it doesn't sometimes deliver
200
responses to range requests. This is achieved by simply not adding acontent-length
header to streaming responses. With this fix the response just contains less bytes than thecontent-range
range would indicate, which is a valid response when the complete-length is unknown as indicated by/*
.FYI, returning less bytes than the
content-range
indicates is exploited in RFC 8673. Incidentally, this patch makes Varnish partially support such streaming range responses.I have re-enabled the disabled tests from #1777, and revised all streaming range tests to expect
206
responses.Background
I am using varnish to cache requests to a backend that delivers Low-Latency HLS. This includes a mode, where parts are delivered using byte range requests from the containing segments. Besides requiring byte-range support, this mode also requires the server to deliver data using streaming range responses. When I tried to deliver individual parts using byte range requests, Varnish failed to work and delivered a full segment in response to
range
requests (response code200
).