fix invalid range request test failed

This commit is contained in:
Gzx1999 2024-05-11 14:55:23 +08:00
parent 10bf0b84e7
commit 0bd11ea003
2 changed files with 29 additions and 1 deletions

23
Fix-broken-spec.patch Normal file
View File

@ -0,0 +1,23 @@
From 5baa1c8ddcadfdfe07b74c2a72fc9a29121851fd Mon Sep 17 00:00:00 2001
From: Jordan Owens <jkowens@gmail.com>
Date: Sun, 22 Jan 2023 19:28:40 -0500
Subject: [PATCH] Fix broken spec
HTTP ranges with non decimal characters is treated as range 0..0 as of Rack 2.2.6.2.
---
test/static_test.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/static_test.rb b/test/static_test.rb
index 232cd21c5d..0022f088b4 100644
--- a/test/static_test.rb
+++ b/test/static_test.rb
@@ -164,7 +164,7 @@ def assert_valid_range(http_range, range, path, file)
end
it 'correctly ignores syntactically invalid range requests' do
- ["bytes=45-40", "bytes=IV-LXVI", "octets=10-20", "bytes=", "bytes=3-1,4-5"].each do |http_range|
+ ["bytes=45-40", "octets=10-20", "bytes=", "bytes=3-1,4-5"].each do |http_range|
request = Rack::MockRequest.new(@app)
response = request.get("/#{File.basename(__FILE__)}", 'HTTP_RANGE' => http_range)

View File

@ -3,7 +3,7 @@
Summary: Ruby-based web application framework
Name: rubygem-%{gem_name}
Version: 2.0.8.1
Release: 2
Release: 3
License: MIT
URL: http://www.sinatrarb.com/
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
@ -15,6 +15,7 @@ Source1: %{gem_name}-%{version}-test.tar.gz
Patch0: rubygem-sinatra-2.0.8.1-Fix-failing-tests.patch
Patch1: Internal-Sinatra-errors-now-extend-Sinatra-Error-test.patch
Patch2: Internal-Sinatra-errors-now-extend-Sinatra-Error.patch
Patch3: Fix-broken-spec.patch
BuildRequires: rubygems-devel ruby(release) ruby >= 2.2.0
%if ! 0%{?bootstrap}
BuildRequires: rubygem(rack) >= 2.0 rubygem(rack-protection) = %{version} rubygem(tilt)
@ -40,6 +41,7 @@ This package contains documentation for %{name}.
pushd %{_builddir}
%patch0 -p1
%patch1 -p1
%patch3 -p1
popd
%patch2 -p1
@ -87,6 +89,9 @@ popd
%{gem_instdir}/examples
%changelog
* Sat May 11 2024 Zhengxin Guo <guozhengxin@kylinos.cn> - 1:2.0.8.1-3
- fix the correctly ignores syntactically invalid range requests test
* Tue Jan 17 2023 wulei <wulei80@h-partners.com> - 1:2.0.8.1-2
- fix the error_highlight test