fix: range request with 0 rows and 0 offset return status 416 (#2991)

This commit is contained in:
Kam Ting Hoi
2023-10-25 16:16:21 +02:00
committed by Wolfgang Walther
parent d07b5acf15
commit e1e0cea494
3 changed files with 18 additions and 3 deletions
+3 -3
View File
@@ -104,9 +104,9 @@ rangeStatusHeader topLevelRange queryTotal tableTotal =
rangeStatus :: Integer -> Integer -> Maybe Integer -> Status
rangeStatus _ _ Nothing = status200
rangeStatus lower upper (Just total)
| lower >= total && lower /= upper = status416 -- 416 Range Not Satisfiable
| (1 + upper - lower) < total = status206 -- 206 Partial Content
| otherwise = status200 -- 200 OK
| lower >= total && lower /= upper && lower /= 0 = status416 -- 416 Range Not Satisfiable
| (1 + upper - lower) < total = status206 -- 206 Partial Content
| otherwise = status200 -- 200 OK
contentRangeH :: (Integral a, Show a) => a -> a -> Maybe a -> Header
contentRangeH lower upper total =