fix: correctly handle suffix and unsatisfiable range requests#3
Open
Amahdip wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR refactors how
FerroS3parses and responds to HTTPRangerequests, bringing it in line with standard HTTP semantics and resolving multiple edge cases.Changes Made:
RangeRequestenum (Satisfiable,Unsatisfiable,Invalid) to explicitly model range parsing outcomes.bytes=-500will correctly fetch the last 500 bytes).200 OKdownloads) and structurally valid but unsatisfiable ranges (e.g., requesting byte1000-from a500byte file).416 Range Not Satisfiablealong with theContent-Range: bytes */<file_size>header.0-byte file edge cases to prevent integer underflows in math bounds.توضیحات فارسی
این PR نحوه پردازش درخواستهای بازهای (Range Requests) را کاملاً بازنویسی میکند تا رفتار سرور با استانداردهای HTTP کاملاً منطبق شود و باگهای مربوط به آن برطرف گردد.
تغییرات اعمال شده:
enumجدید به نامRangeRequestبرای تفکیک دقیق ۳ حالتSatisfiable،UnsatisfiableوInvalidاضافه شد.bytes=-500برای دانلود ۵۰۰ بایت آخر فایل) به درستی پردازش میشوند.416 Range Not Satisfiableرا به همراه هدرContent-Rangeبرمیگردانند.