1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00
rest-client--rest-client/rest-client.gemspec
Andy Brody 4fb434e351 Add dependency on http-accept for Content-Type.
The previous "Content-Type" header parser was ported from Python and was
not very idiomatic Ruby. While fast and correct per the RFCs, it was
triggering bugs in Ruby MRI that we could probably work around. Ideally
someone would fix the bugs in Ruby MRI, but I haven't had time to track
them down.

Switch to using HTTP::Accept for parsing the media-type charset out of
the "Content-Type" header. Also relax the tests since HTTP::Accept is
somewhat stricter in the input it will accept. As a result, rest-client
will now ignore Content-Type headers with a trailing `;` character.
(This is invalid per the RFCs, so impact is likely to be small in
comparison to fixing the Ruby 2.4 memory leak.)

I also tried using https://github.com/httprb/content_type.rb but it is
significantly slower (caused 2x blowup in time on a simple benchmark)
and doesn't correctly handle content-types containing '.' characters.

Fixes: #523 (occasional MRI segfault)
Fixes: #611 (MRI 2.4.* memory leak)

* Unfortunately, HTTP::Accept does not support Ruby 2.0 due to its use
  of named capture groups in StringScanner, which was added in Ruby 2.1.
  Because rest-client still supports Ruby 2.0, fall back on the old
  logic when running on Ruby 2.0. Even though Ruby 2.0 is unsupported,
  it probably still sees wide use since it is the system Ruby even on
  macOS Sierra.

* Don't bother running tests for .cgi_parse_header on Ruby 2.0. Still
  keep the higher level tests that will exercise the deprecated code.
2017-07-05 00:42:43 -04:00

32 lines
1.3 KiB
Ruby

# -*- encoding: utf-8 -*-
require File.expand_path('../lib/restclient/version', __FILE__)
Gem::Specification.new do |s|
s.name = 'rest-client'
s.version = RestClient::VERSION
s.authors = ['REST Client Team']
s.description = 'A simple HTTP and REST client for Ruby, inspired by the Sinatra microframework style of specifying actions: get, put, post, delete.'
s.license = 'MIT'
s.email = 'rest.client@librelist.com'
s.executables = ['restclient']
s.extra_rdoc_files = ['README.md', 'history.md']
s.files = `git ls-files -z`.split("\0")
s.test_files = `git ls-files -z spec/`.split("\0")
s.homepage = 'https://github.com/rest-client/rest-client'
s.summary = 'Simple HTTP and REST client for Ruby, inspired by microframework syntax for specifying actions.'
s.add_development_dependency('webmock', '~> 2.0')
s.add_development_dependency('rspec', '~> 3.0')
s.add_development_dependency('pry', '~> 0')
s.add_development_dependency('pry-doc', '~> 0')
s.add_development_dependency('rdoc', '>= 2.4.2', '< 6.0')
s.add_development_dependency('rubocop', '~> 0')
s.add_dependency('http-accept', '>= 1.7.0', '< 2.0')
s.add_dependency('http-cookie', '>= 1.0.2', '< 2.0')
s.add_dependency('mime-types', '>= 1.16', '< 4.0')
s.add_dependency('netrc', '~> 0.8')
s.required_ruby_version = '>= 2.0.0'
end