Initial import (#1372999).
parent
47afd6a5a9
commit
472b34f969
@ -0,0 +1 @@
|
||||
/http_parser.rb-0.6.0.gem
|
@ -0,0 +1,122 @@
|
||||
diff -uNr http_parser.rb-0.6.0.orig/spec/parser_spec.rb http_parser.rb-0.6.0/spec/parser_spec.rb
|
||||
--- http_parser.rb-0.6.0.orig/spec/parser_spec.rb 2016-09-02 14:40:59.042007967 +0200
|
||||
+++ http_parser.rb-0.6.0/spec/parser_spec.rb 2016-09-02 14:43:37.886554449 +0200
|
||||
@@ -65,8 +65,8 @@
|
||||
"\r\n" +
|
||||
"World"
|
||||
|
||||
- @started.should be_true
|
||||
- @done.should be_true
|
||||
+ @started.should be_truthy
|
||||
+ @done.should be_truthy
|
||||
|
||||
@parser.http_major.should == 1
|
||||
@parser.http_minor.should == 1
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
@headers.should == {'Content-Length' => '5'}
|
||||
@body.should be_empty
|
||||
- @done.should be_false
|
||||
+ @done.should be_falsey
|
||||
end
|
||||
|
||||
it "should reset to initial state" do
|
||||
@@ -114,7 +114,7 @@
|
||||
|
||||
@parser.request_url.should == '/'
|
||||
|
||||
- @parser.reset!.should be_true
|
||||
+ @parser.reset!.should be_truthy
|
||||
|
||||
@parser.http_version.should be_nil
|
||||
@parser.http_method.should be_nil
|
||||
@@ -124,7 +124,7 @@
|
||||
end
|
||||
|
||||
it "should optionally reset parser state on no-body responses" do
|
||||
- @parser.reset!.should be_true
|
||||
+ @parser.reset!.should be_truthy
|
||||
|
||||
@head, @complete = 0, 0
|
||||
@parser.on_headers_complete = proc {|h| @head += 1; :reset }
|
||||
@@ -143,12 +143,12 @@
|
||||
end
|
||||
|
||||
it "should retain callbacks after reset" do
|
||||
- @parser.reset!.should be_true
|
||||
+ @parser.reset!.should be_truthy
|
||||
|
||||
@parser << "GET / HTTP/1.0\r\n\r\n"
|
||||
- @started.should be_true
|
||||
+ @started.should be_truthy
|
||||
@headers.should == {}
|
||||
- @done.should be_true
|
||||
+ @done.should be_truthy
|
||||
end
|
||||
|
||||
it "should parse headers incrementally" do
|
||||
@@ -231,10 +231,10 @@
|
||||
@parser = HTTP::Parser.new(callbacks)
|
||||
@parser << "GET / HTTP/1.0\r\n\r\n"
|
||||
|
||||
- @started.should be_true
|
||||
+ @started.should be_truthy
|
||||
@headers.should == {}
|
||||
@body.should == ''
|
||||
- @done.should be_true
|
||||
+ @done.should be_truthy
|
||||
end
|
||||
|
||||
it "should ignore extra content beyond specified length" do
|
||||
@@ -246,7 +246,7 @@
|
||||
" \n"
|
||||
|
||||
@body.should == 'hello'
|
||||
- @done.should be_true
|
||||
+ @done.should be_truthy
|
||||
end
|
||||
|
||||
it 'sets upgrade_data if available' do
|
||||
@@ -256,7 +256,7 @@
|
||||
"Upgrade: WebSocket\r\n\r\n" +
|
||||
"third key data"
|
||||
|
||||
- @parser.upgrade?.should be_true
|
||||
+ @parser.upgrade?.should be_truthy
|
||||
@parser.upgrade_data.should == 'third key data'
|
||||
end
|
||||
|
||||
@@ -266,7 +266,7 @@
|
||||
"Connection: Upgrade\r\n" +
|
||||
"Upgrade: WebSocket\r\n\r\n"
|
||||
|
||||
- @parser.upgrade?.should be_true
|
||||
+ @parser.upgrade?.should be_truthy
|
||||
@parser.upgrade_data.should == ''
|
||||
end
|
||||
|
||||
@@ -281,13 +281,13 @@
|
||||
|
||||
@parser.on_headers_complete = proc { |e| :stop }
|
||||
offset = (@parser << request)
|
||||
- @parser.upgrade?.should be_true
|
||||
+ @parser.upgrade?.should be_truthy
|
||||
@parser.upgrade_data.should == ''
|
||||
offset.should == request.length
|
||||
end
|
||||
|
||||
it "should execute on_body on requests with no content-length" do
|
||||
- @parser.reset!.should be_true
|
||||
+ @parser.reset!.should be_truthy
|
||||
|
||||
@head, @complete, @body = 0, 0, 0
|
||||
@parser.on_headers_complete = proc {|h| @head += 1 }
|
||||
@@ -316,7 +316,7 @@
|
||||
@parser.keep_alive?.should == test['should_keep_alive']
|
||||
|
||||
if test.has_key?('upgrade') and test['upgrade'] != 0
|
||||
- @parser.upgrade?.should be_true
|
||||
+ @parser.upgrade?.should be_truthy
|
||||
@parser.upgrade_data.should == test['upgrade']
|
||||
end
|
||||
|
@ -0,0 +1,9 @@
|
||||
diff -uNr http_parser.rb-0.6.0.orig/bench/standalone.rb http_parser.rb-0.6.0/bench/standalone.rb
|
||||
--- http_parser.rb-0.6.0.orig/bench/standalone.rb 2016-09-03 15:27:48.046366524 +0200
|
||||
+++ http_parser.rb-0.6.0/bench/standalone.rb 2016-09-03 15:28:13.458093864 +0200
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env ruby
|
||||
+#!/usr/bin/ruby
|
||||
$:.unshift File.dirname(__FILE__) + "/../lib"
|
||||
require "rubygems"
|
||||
require "http/parser"
|
@ -0,0 +1,104 @@
|
||||
# Generated from http_parser.rb-0.6.0.gem by gem2rpm -*- rpm-spec -*-
|
||||
%global gem_name http_parser.rb
|
||||
|
||||
Name: rubygem-%{gem_name}
|
||||
Version: 0.6.0
|
||||
Release: 2%{?dist}
|
||||
Summary: Simple callback-based HTTP request/response parser
|
||||
Group: Development/Languages
|
||||
License: MIT
|
||||
URL: https://github.com/tmm1/http_parser.rb
|
||||
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
||||
# Fedora ships with RSpec 3.0 and the Expectations have a different
|
||||
# name. Patch aims to update them to the newer Expectations.
|
||||
Patch0: http_parser.rb-0.6.0-rspec3.patch
|
||||
Patch1: http_parser.rb-0.6.0-usr_bin_ruby.patch
|
||||
BuildRequires: rubygems-devel
|
||||
BuildRequires: ruby-devel
|
||||
BuildRequires: rubygem-rspec
|
||||
%if 0%{?fedora} <= 20 || 0%{?el7}
|
||||
Provides: rubygem(%{gem_name}) = %{version}
|
||||
%endif
|
||||
|
||||
%description
|
||||
Ruby bindings to http://github.com/joylent/http-parser and
|
||||
http://github.com/a2800276/http-parser.java.
|
||||
|
||||
|
||||
%package doc
|
||||
Summary: Documentation for %{name}
|
||||
Group: Documentation
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
BuildArch: noarch
|
||||
|
||||
%description doc
|
||||
Documentation for %{name}.
|
||||
|
||||
%prep
|
||||
gem unpack %{SOURCE0}
|
||||
|
||||
%setup -q -D -T -n %{gem_name}-%{version}
|
||||
|
||||
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
gem build %{gem_name}.gemspec
|
||||
|
||||
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
|
||||
%gem_install
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}%{gem_dir}
|
||||
cp -a .%{gem_dir}/* \
|
||||
%{buildroot}%{gem_dir}/
|
||||
|
||||
%if 0%{?fedora} > 0
|
||||
mkdir -p %{buildroot}%{gem_extdir_mri}
|
||||
cp -ar .%{gem_extdir_mri}/{gem.build_complete,*.so} %{buildroot}%{gem_extdir_mri}/
|
||||
%endif
|
||||
|
||||
%if 0%{?rhel} >= 7
|
||||
mkdir -p %{buildroot}%{gem_extdir_mri}/lib
|
||||
cp -ar .%{gem_instdir}/lib/ruby_http_parser.so %{buildroot}%{gem_extdir_mri}/lib
|
||||
%endif
|
||||
|
||||
# Prevent dangling symlink in -debuginfo (rhbz#878863).
|
||||
rm -rf %{buildroot}%{gem_instdir}/ext/
|
||||
|
||||
rm -f %{buildroot}%{gem_instdir}/{.gitignore,.gitmodules,Gemfile.lock}
|
||||
|
||||
# Run the test suite
|
||||
%check
|
||||
pushd .%{gem_instdir}
|
||||
# Workaround for issue https://github.com/tmm1/http_parser.rb/issues/27
|
||||
export LC_ALL=en_US.UTF-8
|
||||
rspec -Ilib -I%{buildroot}%{gem_extdir_mri} spec
|
||||
popd
|
||||
|
||||
%files
|
||||
%dir %{gem_instdir}
|
||||
%{gem_libdir}
|
||||
%{gem_extdir_mri}
|
||||
%exclude %{gem_extdir_mri}/gem.build_complete
|
||||
%exclude %{gem_cache}
|
||||
%{gem_spec}
|
||||
%doc %{gem_instdir}/README.md
|
||||
%license %{gem_instdir}/LICENSE-MIT
|
||||
%doc %{gem_instdir}/Gemfile
|
||||
|
||||
%files doc
|
||||
%doc %{gem_docdir}
|
||||
%{gem_instdir}/%{gem_name}.gemspec
|
||||
%{gem_instdir}/Rakefile
|
||||
%{gem_instdir}/spec
|
||||
%{gem_instdir}/bench
|
||||
%{gem_instdir}/tasks
|
||||
|
||||
%changelog
|
||||
* Fri Sep 02 2016 Yanis Guenane <yguenane@redhat.com> - 0.6.0-2
|
||||
- Patch the spec file to match key words in RSpec 3
|
||||
* Mon Jan 05 2015 Graeme Gillies <ggillies@redhat.com> - 0.6.0-1
|
||||
- Initial package
|
Loading…
Reference in new issue