fakeweb 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ fakeweb (1.2.2)
2
+
3
+ * fix that HTTP Digest and OAuth requests could raise URI::InvalidURIErrors
4
+ [Bill Kocik, Chris Kampmeier]
5
+
6
+
1
7
  fakeweb (1.2.1)
2
8
 
3
9
  * fix that query parameters are handled correctly when registering with a URI
@@ -12,6 +18,7 @@ fakeweb (1.2.1)
12
18
  * add support for HTTP basic authentication via userinfo strings in URIs
13
19
  [Michael Bleigh]
14
20
 
21
+
15
22
  fakeweb (1.2.0)
16
23
 
17
24
  * add lib/fakeweb.rb so you can require "fakeweb" as well [Chris Kampmeier]
@@ -38,10 +38,10 @@ module Net #:nodoc: all
38
38
  path = request.path
39
39
  path = URI.parse(request.path).request_uri if request.path =~ /^http/
40
40
 
41
- if request['authorization'].nil?
42
- userinfo = ""
41
+ if request["authorization"] =~ /^Basic /
42
+ userinfo = request["authorization"].sub(/^Basic /, "").unpack("m").first + "@"
43
43
  else
44
- userinfo = request['authorization'].sub(/^Basic /, "").unpack("m").first + "@"
44
+ userinfo = ""
45
45
  end
46
46
 
47
47
  uri = "#{protocol}://#{userinfo}#{self.address}:#{self.port}#{path}"
@@ -41,4 +41,28 @@ class TestFakeAuthentication < Test::Unit::TestCase
41
41
  req.basic_auth 'user2', 'pass'
42
42
  assert_equal http.request(req).body, 'wrong user'
43
43
  end
44
+
45
+ def test_basic_auth_support_is_transparent_to_oauth
46
+ FakeWeb.register_uri(:get, "http://sp.example.com/protected", :string => "secret")
47
+
48
+ # from http://oauth.net/core/1.0/#auth_header
49
+ auth_header = <<-HEADER
50
+ OAuth realm="http://sp.example.com/",
51
+ oauth_consumer_key="0685bd9184jfhq22",
52
+ oauth_token="ad180jjd733klru7",
53
+ oauth_signature_method="HMAC-SHA1",
54
+ oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D",
55
+ oauth_timestamp="137131200",
56
+ oauth_nonce="4572616e48616d6d65724c61686176",
57
+ oauth_version="1.0"
58
+ HEADER
59
+ auth_header.gsub!(/\s+/, " ").strip!
60
+
61
+ http = Net::HTTP.new("sp.example.com", 80)
62
+ response = nil
63
+ http.start do |request|
64
+ response = request.get("/protected", {"authorization" => auth_header})
65
+ end
66
+ assert_equal "secret", response.body
67
+ end
44
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakeweb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blaine Cook
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-04-29 00:00:00 -07:00
13
+ date: 2009-05-04 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -38,18 +38,13 @@ files:
38
38
  - LICENSE.txt
39
39
  - README.rdoc
40
40
  - Rakefile
41
- - lib
42
- - lib/fake_web
43
41
  - lib/fake_web.rb
44
- - lib/fake_web/ext
45
42
  - lib/fake_web/ext/net_http.rb
46
43
  - lib/fake_web/registry.rb
47
44
  - lib/fake_web/responder.rb
48
45
  - lib/fake_web/response.rb
49
46
  - lib/fake_web/stub_socket.rb
50
47
  - lib/fakeweb.rb
51
- - test
52
- - test/fixtures
53
48
  - test/fixtures/google_response_from_curl
54
49
  - test/fixtures/google_response_with_transfer_encoding
55
50
  - test/fixtures/google_response_without_transfer_encoding
@@ -64,6 +59,8 @@ files:
64
59
  - test/test_trailing_slashes.rb
65
60
  has_rdoc: true
66
61
  homepage: http://github.com/chrisk/fakeweb
62
+ licenses: []
63
+
67
64
  post_install_message:
68
65
  rdoc_options:
69
66
  - --main
@@ -91,12 +88,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
88
  requirements: []
92
89
 
93
90
  rubyforge_project: fakeweb
94
- rubygems_version: 1.3.0
91
+ rubygems_version: 1.3.2
95
92
  signing_key:
96
- specification_version: 2
93
+ specification_version: 3
97
94
  summary: A tool for faking responses to HTTP requests
98
95
  test_files:
99
- - test/fixtures
100
96
  - test/fixtures/google_response_from_curl
101
97
  - test/fixtures/google_response_with_transfer_encoding
102
98
  - test/fixtures/google_response_without_transfer_encoding