ruby-openid 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.3
4
+
5
+ * Fixed 'invalid byte sequence in UTF-8' error in parse_link_attrs - 0f46921a97677b83b106366c805063105c5e9f20
6
+ * Fixed license information in gemspec - f032e949e1ca9078ab7508d9629398ca2c36980a
7
+ * Update starts/ends_with? to handle nil prefix - beee5e8d1dc24ad55725cfcc720eefba6bdbd279
8
+
3
9
  ## 2.2.2
4
10
 
5
11
  * Limit fetching file size & disable XML entity expansion - be2bab5c21f04735045e071411b349afb790078f
@@ -34,7 +34,15 @@ module OpenID
34
34
 
35
35
 
36
36
  def OpenID.parse_link_attrs(html)
37
- stripped = html.gsub(REMOVED_RE,'')
37
+ begin
38
+ stripped = html.gsub(REMOVED_RE,'')
39
+ rescue ArgumentError
40
+ begin
41
+ stripped = html.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '').gsub(REMOVED_RE,'')
42
+ rescue Encoding::UndefinedConversionError #needed for a problem in JRuby where it can't handle the conversion
43
+ stripped = html.encode('UTF-8', 'ASCII', :invalid => :replace, :undef => :replace, :replace => '').gsub(REMOVED_RE,'')
44
+ end
45
+ end
38
46
  parser = HTMLTokenizer.new(stripped)
39
47
 
40
48
  links = []
data/lib/openid/extras.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  class String
2
2
  def starts_with?(other)
3
+ other = other.to_s
3
4
  head = self[0, other.length]
4
5
  head == other
5
6
  end
6
7
 
7
8
  def ends_with?(other)
9
+ other = other.to_s
8
10
  tail = self[-1 * other.length, other.length]
9
11
  tail == other
10
12
  end
@@ -1,3 +1,3 @@
1
1
  module OpenID
2
- VERSION = "2.2.2"
2
+ VERSION = "2.2.3"
3
3
  end
@@ -84,6 +84,7 @@ class LinkParseTestCase < Test::Unit::TestCase
84
84
  assert(false, "datafile parsing error: bad header #{h}")
85
85
  end
86
86
  }
87
+ html = html.force_encoding('UTF-8') if html.respond_to? :force_encoding
87
88
  links = OpenID::parse_link_attrs(html)
88
89
 
89
90
  found = links.dup
@@ -97,5 +98,16 @@ class LinkParseTestCase < Test::Unit::TestCase
97
98
  end
98
99
  }
99
100
  assert_equal(numtests, testnum, "Number of tests")
101
+
102
+ # test handling of invalid UTF-8 byte sequences
103
+ if "".respond_to? :force_encoding
104
+ html = "<html><body>hello joel\255</body></html>".force_encoding('UTF-8')
105
+ else
106
+ html = "<html><body>hello joel\255</body></html>"
107
+ end
108
+ assert_nothing_raised do
109
+ OpenID::parse_link_attrs(html)
110
+ end
111
+
100
112
  end
101
113
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-openid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
5
4
  prerelease:
5
+ version: 2.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - JanRain, Inc
9
9
  autorequire: openid
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-23 00:00:00.000000000 Z
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: openid@janrain.com
@@ -219,7 +219,8 @@ files:
219
219
  - UPGRADE.md
220
220
  homepage: https://github.com/openid/ruby-openid
221
221
  licenses:
222
- - Apache Software License
222
+ - Ruby
223
+ - Apache Software License 2.0
223
224
  post_install_message:
224
225
  rdoc_options:
225
226
  - --main
@@ -231,19 +232,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
232
  requirements:
232
233
  - - ! '>='
233
234
  - !ruby/object:Gem::Version
234
- version: '0'
235
235
  segments:
236
236
  - 0
237
- hash: 94044718274269500
237
+ hash: -848479263465910560
238
+ version: '0'
238
239
  required_rubygems_version: !ruby/object:Gem::Requirement
239
240
  none: false
240
241
  requirements:
241
242
  - - ! '>='
242
243
  - !ruby/object:Gem::Version
243
- version: '0'
244
244
  segments:
245
245
  - 0
246
- hash: 94044718274269500
246
+ hash: -848479263465910560
247
+ version: '0'
247
248
  requirements: []
248
249
  rubyforge_project:
249
250
  rubygems_version: 1.8.23