Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 4 commits
  • 10 files changed
  • 0 commit comments
  • 2 contributors
Commits on Jan 02, 2013
@kenmazaika kenmazaika Add support for passing in ciphers information into the ConnectionAda…
…pter, and have this work as expected with the Net:HTTP ConnectionAdapter.
e63ee15
@jnunemaker Merge branch 'openssl-ciphers2' of https://github.com/where/httparty
…into where-openssl-ciphers2

Conflicts:
	spec/httparty/connection_adapter_spec.rb
a936eaa
Commits on Jan 10, 2013
@jnunemaker Remove yaml due to possible security risk. 53a8124
@jnunemaker Release 0.10.0.
* Removed yaml support.
3e2ec2b
View
4 History
@@ -1,3 +1,7 @@
+== 0.10.0 2013-01-10
+* changes
+ * removed yaml support because of security risk (see rails yaml issues)
+
== 0.9.0 2012-09-07
* new
* [support for connection adapters](https://github.com/jnunemaker/httparty/pull/157)
View
2 examples/custom_parsers.rb
@@ -1,7 +1,7 @@
class ParseAtom
include HTTParty
- # Support Atom along with the default parsers: xml, json, yaml, etc.
+ # Support Atom along with the default parsers: xml, json, etc.
class Parser::Atom < HTTParty::Parser
SupportedFormats.merge!({"application/atom+xml" => :atom})
View
15 lib/httparty.rb
@@ -299,7 +299,7 @@ def query_string_normalizer(normalizer)
default_options[:query_string_normalizer] = normalizer
end
- # Allows setting of SSL version to use. This only works in Ruby 1.9.
+ # Allows setting of SSL version to use. This only works in Ruby 1.9+.
# You can get a list of valid versions from OpenSSL::SSL::SSLContext::METHODS.
#
# class Foo
@@ -310,6 +310,19 @@ def ssl_version(version)
default_options[:ssl_version] = version
end
+ # Allows setting of SSL ciphers to use. This only works in Ruby 1.9+.
+ # You can get a list of valid specific ciphers from OpenSSL::Cipher.ciphers.
+ # You also can specify a cipher suite here, listed here at openssl.org:
+ # http://www.openssl.org/docs/apps/ciphers.html#CIPHER_SUITE_NAMES
+ #
+ # class Foo
+ # include HTTParty
+ # ciphers "RC4-SHA"
+ # end
+ def ciphers(cipher_names)
+ default_options[:ciphers] = cipher_names
+ end
+
# Allows setting an OpenSSL certificate authority file
#
# class Foo
View
4 lib/httparty/connection_adapter.rb
@@ -81,6 +81,10 @@ def connection
http.set_debug_output(options[:debug_output])
end
+ if options[:ciphers]
+ http.ciphers = options[:ciphers]
+ end
+
return http
end
View
8 lib/httparty/parser.rb
@@ -1,5 +1,5 @@
module HTTParty
- # The default parser used by HTTParty, supports xml, json, html, yaml, and
+ # The default parser used by HTTParty, supports xml, json, html, and
# plain text.
#
# == Custom Parsers
@@ -45,8 +45,6 @@ class Parser
'application/javascript' => :json,
'text/javascript' => :json,
'text/html' => :html,
- 'application/x-yaml' => :yaml,
- 'text/yaml' => :yaml,
'text/plain' => :plain
}
@@ -120,10 +118,6 @@ def json
end
end
- def yaml
- YAML.load(body)
- end
-
def html
body
end
View
2 lib/httparty/version.rb
@@ -1,3 +1,3 @@
module HTTParty
- VERSION = "0.9.1"
+ VERSION = "0.10.0"
end
View
9 spec/httparty/connection_adapter_spec.rb
@@ -78,6 +78,7 @@
it { should use_ssl }
end
+
context "when ssl version is set" do
let(:options) { {:ssl_version => :TLSv1} }
@@ -95,6 +96,14 @@
end
end
+ context "specifying ciphers" do
+ let(:options) { {:ciphers => 'RC4-SHA' } }
+
+ it "should set the ciphers on the connection" do
+ subject.ciphers.should == 'RC4-SHA'
+ end
+ end if RUBY_VERSION > '1.9'
+
context "when timeout is not set" do
it "doesn't set the timeout" do
http = mock("http", :null_object => true)
View
5 spec/httparty/parser_spec.rb
@@ -155,11 +155,6 @@ def self.name; 'AtomParser'; end
subject.send(:json)
end
- it "parses yaml" do
- YAML.should_receive(:load).with('body')
- subject.send(:yaml)
- end
-
it "parses html by simply returning the body" do
subject.send(:html).should == 'body'
end
View
6 spec/httparty/request_spec.rb
@@ -225,12 +225,6 @@
@request.send(:parse_response, json).should == {'books' => {'book' => {'id' => '1234', 'name' => 'Foo Bar!'}}}
end
- it 'should handle yaml automatically' do
- yaml = "books: \n book: \n name: Foo Bar!\n id: \"1234\"\n"
- @request.options[:format] = :yaml
- @request.send(:parse_response, yaml).should == {'books' => {'book' => {'id' => '1234', 'name' => 'Foo Bar!'}}}
- end
-
it "should include any HTTP headers in the returned response" do
@request.options[:format] = :html
response = stub_response "Content"
View
15 spec/httparty_spec.rb
@@ -45,6 +45,14 @@
end
end
+ describe 'ciphers' do
+ it 'should set the ciphers content' do
+ @klass.default_options[:ciphers].should be_nil
+ @klass.ciphers 'RC4-SHA'
+ @klass.default_options[:ciphers].should == 'RC4-SHA'
+ end
+ end
+
describe 'http_proxy' do
it 'should set the address' do
@klass.http_proxy 'proxy.foo.com', 80
@@ -376,11 +384,6 @@ class MyParser < HTTParty::Parser
@klass.default_options[:format].should == :json
end
- it "should allow yaml" do
- @klass.format :yaml
- @klass.default_options[:format].should == :yaml
- end
-
it "should allow plain" do
@klass.format :plain
@klass.default_options[:format].should == :plain
@@ -395,7 +398,7 @@ class MyParser < HTTParty::Parser
it 'should only print each format once with an exception' do
lambda do
@klass.format :foobar
- end.should raise_error(HTTParty::UnsupportedFormat, "':foobar' Must be one of: html, json, plain, xml, yaml")
+ end.should raise_error(HTTParty::UnsupportedFormat, "':foobar' Must be one of: html, json, plain, xml")
end
it 'sets the default parser' do

No commit comments for this range

Something went wrong with that request. Please try again.