nokogiri 1.6.7 → 1.6.8.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.cross_rubies +2 -0
  3. data/.travis.yml +19 -9
  4. data/CHANGELOG.rdoc +112 -2
  5. data/CONTRIBUTING.md +42 -0
  6. data/Gemfile +10 -10
  7. data/LICENSE.txt +1 -1
  8. data/Manifest.txt +7 -2
  9. data/README.md +23 -27
  10. data/ROADMAP.md +11 -1
  11. data/Rakefile +35 -17
  12. data/bin/nokogiri +2 -2
  13. data/build_all +1 -1
  14. data/dependencies.yml +29 -4
  15. data/ext/nokogiri/extconf.rb +164 -79
  16. data/ext/nokogiri/html_document.c +6 -6
  17. data/ext/nokogiri/html_element_description.c +1 -1
  18. data/ext/nokogiri/html_entity_lookup.c +1 -1
  19. data/ext/nokogiri/html_sax_parser_context.c +4 -4
  20. data/ext/nokogiri/html_sax_push_parser.c +2 -2
  21. data/ext/nokogiri/nokogiri.c +0 -7
  22. data/ext/nokogiri/nokogiri.h +1 -34
  23. data/ext/nokogiri/xml_attr.c +2 -2
  24. data/ext/nokogiri/xml_comment.c +1 -1
  25. data/ext/nokogiri/xml_document.c +20 -22
  26. data/ext/nokogiri/xml_encoding_handler.c +3 -3
  27. data/ext/nokogiri/xml_entity_reference.c +1 -1
  28. data/ext/nokogiri/xml_namespace.c +56 -17
  29. data/ext/nokogiri/xml_node.c +73 -67
  30. data/ext/nokogiri/xml_node_set.c +164 -146
  31. data/ext/nokogiri/xml_node_set.h +3 -4
  32. data/ext/nokogiri/xml_processing_instruction.c +2 -2
  33. data/ext/nokogiri/xml_reader.c +5 -18
  34. data/ext/nokogiri/xml_sax_parser.c +9 -12
  35. data/ext/nokogiri/xml_sax_parser_context.c +1 -1
  36. data/ext/nokogiri/xml_sax_push_parser.c +1 -1
  37. data/ext/nokogiri/xml_schema.c +1 -1
  38. data/ext/nokogiri/xml_syntax_error.c +0 -4
  39. data/ext/nokogiri/xml_syntax_error.h +0 -1
  40. data/ext/nokogiri/xml_text.c +1 -1
  41. data/ext/nokogiri/xml_xpath_context.c +15 -24
  42. data/ext/nokogiri/xslt_stylesheet.c +6 -6
  43. data/lib/nokogiri/css/parser.rb +8 -2
  44. data/lib/nokogiri/css/parser.y +7 -2
  45. data/lib/nokogiri/html/document.rb +4 -2
  46. data/lib/nokogiri/version.rb +1 -1
  47. data/lib/nokogiri/xml/document.rb +7 -1
  48. data/lib/nokogiri/xml/dtd.rb +4 -4
  49. data/lib/nokogiri/xml/node.rb +6 -10
  50. data/lib/nokogiri/xml/node_set.rb +3 -3
  51. data/lib/nokogiri/xml/parse_options.rb +22 -0
  52. data/lib/nokogiri.rb +14 -7
  53. data/ports/archives/libxml2-2.9.4.tar.gz +0 -0
  54. data/ports/archives/libxslt-1.1.29.tar.gz +0 -0
  55. data/tasks/test.rb +5 -0
  56. data/test/css/test_parser.rb +7 -1
  57. data/test/files/GH_1042.html +18 -0
  58. data/test/files/namespace_pressure_test.xml +1684 -0
  59. data/test/files/tlm.html +2 -1
  60. data/test/helper.rb +4 -0
  61. data/test/html/sax/test_parser.rb +2 -2
  62. data/test/html/test_document.rb +47 -11
  63. data/test/html/test_document_encoding.rb +55 -58
  64. data/test/html/test_document_fragment.rb +27 -23
  65. data/test/html/test_node.rb +16 -0
  66. data/test/html/test_node_encoding.rb +71 -13
  67. data/test/namespaces/test_namespaces_in_parsed_doc.rb +14 -0
  68. data/test/test_css_cache.rb +1 -1
  69. data/test/test_encoding_handler.rb +2 -0
  70. data/test/test_xslt_transforms.rb +38 -3
  71. data/test/xml/sax/test_parser.rb +54 -53
  72. data/test/xml/test_document.rb +7 -2
  73. data/test/xml/test_document_encoding.rb +19 -16
  74. data/test/xml/test_document_fragment.rb +12 -0
  75. data/test/xml/test_dtd_encoding.rb +0 -2
  76. data/test/xml/test_namespace.rb +2 -2
  77. data/test/xml/test_node.rb +15 -4
  78. data/test/xml/test_node_attributes.rb +6 -0
  79. data/test/xml/test_node_encoding.rb +49 -87
  80. data/test/xml/test_node_reparenting.rb +193 -18
  81. data/test/xml/test_node_set.rb +1 -1
  82. data/test/xml/test_reader.rb +589 -0
  83. data/test/xml/test_reader_encoding.rb +100 -102
  84. data/test/xml/test_unparented_node.rb +14 -1
  85. data/test/xslt/test_exception_handling.rb +1 -1
  86. data/test_all +47 -31
  87. metadata +42 -67
  88. data/CHANGELOG.ja.rdoc +0 -1041
  89. data/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch +0 -29
  90. data/patches/libxml2/0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch +0 -31
  91. data/patches/libxml2/0003-Stop-parsing-on-entities-boundaries-errors.patch +0 -32
  92. data/patches/libxml2/0004-Cleanup-conditional-section-error-handling.patch +0 -49
  93. data/patches/libxml2/0005-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch +0 -177
  94. data/patches/libxml2/0006-Another-variation-of-overflow-in-Conditional-section.patch +0 -32
  95. data/patches/libxml2/0007-Fix-an-error-in-previous-Conditional-section-patch.patch +0 -28
  96. data/patches/libxml2/0008-CVE-2015-8035-Fix-XZ-compression-support-loop.patch +0 -31
  97. data/patches/libxml2/0009-Updated-config.guess.patch +0 -397
  98. data/patches/libxml2/0010-Fix-parsering-short-unclosed-comment-uninitialized-access.patch +0 -64
  99. data/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch +0 -222
  100. data/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch +0 -53
  101. data/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch +0 -60
  102. data/patches/libxslt/0004-EXSLT-function-str-replace-is-broken-as-is.patch +0 -42
  103. data/patches/libxslt/0006-Fix-str-padding-to-work-with-UTF-8-strings.patch +0 -164
  104. data/patches/libxslt/0007-Separate-function-for-predicate-matching-in-patterns.patch +0 -587
  105. data/patches/libxslt/0008-Fix-direct-pattern-matching.patch +0 -80
  106. data/patches/libxslt/0009-Fix-certain-patterns-with-predicates.patch +0 -185
  107. data/patches/libxslt/0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch +0 -126
  108. data/patches/libxslt/0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch +0 -25
  109. data/patches/libxslt/0014-Fix-for-bug-436589.patch +0 -43
  110. data/patches/libxslt/0015-Fix-mkdir-for-mingw.patch +0 -41
  111. data/patches/libxslt/0016-Fix-for-type-confusion-in-preprocessing-attributes.patch +0 -29
  112. data/patches/libxslt/0017-Updated-config.guess.patch +0 -1226
  113. data/ports/archives/libxml2-2.9.2.tar.gz +0 -0
  114. data/ports/archives/libxslt-1.1.28.tar.gz +0 -0
  115. data/test/test_reader.rb +0 -558
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbe7bb154e401bfe8898f4007e337ed4dde1f95d
4
- data.tar.gz: 50a017cac7c2659a4b5006840515d57ed84d945b
3
+ metadata.gz: 7aba1b02c58b5803189789642e2509a8c37f7c17
4
+ data.tar.gz: 27b7137433f9b0ad54bdc5818ca6bfaf94d41f55
5
5
  SHA512:
6
- metadata.gz: fc15e6bf53fc885e7255e1a71208171f27de0e3b82a835a565380f913cdf356da0be1fff592f126443a2eb528e2ca0d2aadae1211b6e7eb12eace35191ea43f5
7
- data.tar.gz: dee4a2c8648fbed9ef2ff90752347a7c777ef917530f2d296e87bb212c741800c68576b25423ae175ef8e141f1dd8c80c7d215c09ccae861781a92e92f02191a
6
+ metadata.gz: c18fc20453e6fbc27da1d006224cc63106bf82db2e777373e8d9c9746cc70bb9ea4f801795f27d9be7d5136e98177751ed02e029fd0f4129494524b872682ae2
7
+ data.tar.gz: 9991ca8a13901c1ef526781107797a9be90ab18badfb0bcd39e312bd3cdadeaa9489b2b94a7e290a07f8503d44aea94c887fb93e4e45728ad71d8b1969bef7f8
data/.cross_rubies CHANGED
@@ -5,3 +5,5 @@
5
5
  2.1.6:x86_64-w64-mingw32
6
6
  2.2.2:i686-w64-mingw32
7
7
  2.2.2:x86_64-w64-mingw32
8
+ 2.3.0:i686-w64-mingw32
9
+ 2.3.0:x86_64-w64-mingw32
data/.travis.yml CHANGED
@@ -4,13 +4,15 @@ sudo: false
4
4
 
5
5
  rvm:
6
6
  - ruby-1.9.2
7
- - ruby-1.9.3
8
- - ruby-2.0.0
9
- - ruby-2.1.7
10
- - ruby-2.2.2
7
+ - 1.9.3
8
+ - 2.0
9
+ - 2.1
10
+ - 2.2.3
11
+ - 2.3.0
11
12
  - jruby-19mode
12
- - jruby-1.7.22
13
- - jruby-9.0.0.0
13
+ - jruby
14
+ - jruby-9.0.4.0
15
+ - jruby-head
14
16
  - rbx-19mode
15
17
  - rbx-2
16
18
 
@@ -19,15 +21,20 @@ os:
19
21
  - osx
20
22
 
21
23
  matrix:
24
+ allow_failures:
25
+ # https://github.com/travis-ci/travis-ci/issues/5361
26
+ - os: osx
27
+ rvm: 2.3.0
28
+ - rvm: jruby-head
22
29
  exclude:
23
30
  - os: osx
24
31
  rvm: ruby-1.9.2
25
32
  - os: osx
26
33
  rvm: jruby-19mode
27
34
  - os: osx
28
- rvm: jruby-1.7.22
35
+ rvm: jruby
29
36
  - os: osx
30
- rvm: jruby-9.0.0.0
37
+ rvm: jruby-9.0.4.0
31
38
  - os: osx
32
39
  rvm: rbx-19mode
33
40
  - os: osx
@@ -37,5 +44,8 @@ notifications:
37
44
  irc:
38
45
  channels:
39
46
  - "chat.freenode.net#nokogiri"
40
- use_notice: true
47
+ on_success: always
48
+ on_failure: always
49
+ template:
50
+ - "%{repository} (%{branch}:%{commit} by %{author}): %{message} (%{build_url})"
41
51
  skip_join: true
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,113 @@
1
+ === 1.6.8.1 / 2016-10-03
2
+
3
+ ==== Dependency License Notes
4
+
5
+ Removes required dependency on the `pkg-config` gem. This dependency
6
+ was introduced in v1.6.8 and, because it's distributed under LGPL, was
7
+ objectionable to many Nokogiri users (#1488, #1496).
8
+
9
+ This version makes `pkg-config` an optional dependency. If it's
10
+ installed, it's used; but otherwise Nokogiri will attempt to work
11
+ around its absence.
12
+
13
+
14
+ === 1.6.8 / 2016-06-06
15
+
16
+ ==== Security Notes
17
+
18
+ [MRI] Bundled libxml2 is upgraded to 2.9.4, which fixes many security issues. Many of these had previously been patched in the vendored libxml 2.9.2 in the 1.6.7.x branch, but some are newer.
19
+
20
+ See these libxml2 email posts for more:
21
+
22
+ * https://mail.gnome.org/archives/xml/2015-November/msg00012.html
23
+ * https://mail.gnome.org/archives/xml/2016-May/msg00023.html
24
+
25
+ For a more detailed analysis, you may care to read Canonical's take on these security issues:
26
+
27
+ * http://www.ubuntu.com/usn/usn-2994-1
28
+
29
+
30
+ [MRI] Bundled libxslt is upgraded to 1.1.29, which fixes a security issue as well as many long-known outstanding bugs, some features, some portability improvements, and general cleanup.
31
+
32
+ See this libxslt email post for more:
33
+
34
+ * https://mail.gnome.org/archives/xslt/2016-May/msg00004.html
35
+
36
+
37
+ ==== Features
38
+
39
+ Several changes were made to improve performance:
40
+
41
+ * [MRI] Simplify NodeSet#to_a with a minor speed-up. (#1397)
42
+ * XML::Node#ancestors optimization. (#1297) (Thanks, Bruno Sutic!)
43
+ * Use Symbol#to_proc where we weren't previously. (#1296) (Thanks, Bruno Sutic!)
44
+ * XML::DTD#each uses implicit block calls. (Thanks, @glaucocustodio!)
45
+ * Fall back to the `pkg-config` gem if we're having trouble finding the system libxml2. This should help many FreeBSD users. (#1417)
46
+ * Set document encoding appropriately even on blank document. (#1043) (Thanks, @batter!)
47
+
48
+
49
+ ==== Bug Fixes
50
+
51
+ * [JRuby] fix slow add_child (#692)
52
+ * [JRuby] fix load errors when deploying to JRuby/Torquebox (#1114) (Thanks, @atambo and @jvshahid!)
53
+ * [JRuby] fix NPE when inspecting nodes returned by NodeSet#drop (#1042) (Thanks, @mkristian!)
54
+ * [JRuby] fix nil attriubte node's namespace in reader (#1327) (Thanks, @codekitchen!)
55
+ * [JRuby] fix Nokogiri munging unicode characters that require more than 2 bytes (#1113) (Thanks, @mkristian!)
56
+ * [JRuby] allow unlinking an unparented node (#1112, #1152) (Thanks, @esse!)
57
+ * [JRuby] allow Fragment parsing on a frozen string (#444, #1077)
58
+ * [JRuby] HTML `style` tags are no longer encoded (#1316) (Thanks, @tbeauvais!)
59
+ * [MRI] fix assertion failure while accessing attribute node's namespace in reader (#843) (Thanks, @2potatocakes!)
60
+ * [MRI] fix issue with GCing namespace nodes returned in an xpath query. (#1155)
61
+ * [MRI] Ensure C strings are null-terminated. (#1381)
62
+ * [MRI] Ensure Rubygems is loaded before using mini_portile2 at installation. (#1393, #1411) (Thanks, @JonRowe!)
63
+ * [MRI] Handling another edge case where the `libxml-ruby` gem's global callbacks were smashing the heap. (#1426). (Thanks to @bbergstrom for providing an isolated test case!)
64
+ * [MRI] Ensure encodings are passed to Sax::Parser xmldecl callback. (#844)
65
+ * [MRI] Ensure default ns prefix is applied correctly when reparenting nodes to another document. (#391) (Thanks, @ylecuyer!)
66
+ * [MRI] Ensure Reader handles non-existent attributes as expected. (#1254) (Thanks, @ccutrer!)
67
+ * [MRI] Cleanup around namespace handling when reparenting nodes. (#1332, #1333, #1444) (Thanks, @cuttrer and @bradleybeddoes!)
68
+ * unescape special characters in CSS queries (#1303) (Thanks, @twalpole!)
69
+ * consistently handle empty documents (#1349)
70
+ * Update to mini_portile2 2.1.0 to address whitespace-handling during patching. (#1402)
71
+ * Fix encoding of xml node namespaces.
72
+ * Work around issue installing Nokogiri on overlayfs (commonly used in Docker containers). (#1370, #1405)
73
+
74
+
75
+
76
+ ==== Other Notes
77
+
78
+ * Removed legacy code remaining from Ruby 1.8.x support.
79
+ * Removed legacy code remaining from REE support.
80
+ * Removing hacky workarounds for bugs in some older versions of libxml2.
81
+ * Handling C strings in a forward-compatible manner, see https://github.com/ruby/ruby/blob/v2_2_0/NEWS#L319
82
+
83
+
84
+ === 1.6.7.2 / 2016-01-20
85
+
86
+ This version pulls in several upstream patches to the vendored libxml2 and libxslt to address:
87
+
88
+ CVE-2015-7499
89
+
90
+ Ubuntu classifies this as "Priority: Low", RedHat classifies this as "Impact: Moderate", and NIST classifies this as "Severity: 5.0 (MEDIUM)".
91
+
92
+ MITRE record is https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-7499
93
+
94
+
95
+ === 1.6.7.1 / 2015-12-16
96
+
97
+ This version pulls in several upstream patches to the vendored libxml2 and libxslt to address:
98
+
99
+ CVE-2015-5312
100
+ CVE-2015-7497
101
+ CVE-2015-7498
102
+ CVE-2015-7499
103
+ CVE-2015-7500
104
+ CVE-2015-8241
105
+ CVE-2015-8242
106
+ CVE-2015-8317
107
+
108
+ See also http://www.ubuntu.com/usn/usn-2834-1/
109
+
110
+
1
111
  === 1.6.7 / 2015-11-29
2
112
 
3
113
  ==== Notes
@@ -25,7 +135,7 @@ See #1374 and #1376 for details.
25
135
  * [JRuby] reset the namespace cache when replacing the document's innerHtml (#1265) (Thanks, @mkristian!)
26
136
  * [JRuby] Document#parse should support IO objects that respond to #read. (#1124) (Thanks, Jake Byman!)
27
137
  * [MRI] Duplicate-id errors when setting the `id` attribute on HTML documents are now silenced. (#1262)
28
- * [JRuby] SAX parser cuts texts in peices when quare brackets exist. (#1261)
138
+ * [JRuby] SAX parser cuts texts in pieces when square brackets exist. (#1261)
29
139
  * [JRuby] Namespaced attributes aren't removed by remove_attribute. (#1299)
30
140
 
31
141
 
@@ -35,7 +145,7 @@ This version pulls in an upstream patch to the vendored libxml2 to address:
35
145
 
36
146
  * unclosed comment uninitialized access issue (#1376)
37
147
 
38
- This issue does not have a CVE assigned to it as this time.
148
+ This issue was assigned CVE-2015-8710 after the fact. See http://seclists.org/oss-sec/2015/q4/616 for details.
39
149
 
40
150
 
41
151
  === 1.6.6.3 / 2015-11-16
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,42 @@
1
+ # Issue and Pull Request Guidelines
2
+
3
+ Thank you for getting involved in making Nokogiri better!
4
+
5
+
6
+ ## Code of Conduct
7
+
8
+ For best results, be nice. Remember that Nokogiri maintainers are
9
+ volunteers, and treat them with respect.
10
+
11
+ Do not act entitled to service. Do not be rude. Do not use judgmental
12
+ or foul language.
13
+
14
+ The maintainers reserve the right to delete comments that are rude, or
15
+ that contain foul language. The maintainers reserve the right to
16
+ delete comments that they deem harassing or offensive.
17
+
18
+
19
+ ## Issues
20
+
21
+ Please read the
22
+ ["Getting Help" tutorial](http://www.nokogiri.org/tutorials/getting_help.html)
23
+ at the [nokogiri.org](http://nokogiri.org) site.
24
+
25
+ If you're reporting an issue, it must contain:
26
+
27
+ * Example code that reproduces the **observed** behavior.
28
+ * An explanation of what the **expected** behavior is.
29
+
30
+ That's it. If you don't provide that information, we'll ask you for
31
+ it, tag the story "needs more information", and then after a time will
32
+ close it if the information isn't provided.
33
+
34
+
35
+ ## Pull Requests
36
+
37
+ Pull requests must always contain a test to prevent
38
+ regressions. Preferably, the test should demonstrate the __intent__ of
39
+ the code.
40
+
41
+ We may ask you for clarification if we don't understand the intent of
42
+ the change.
data/Gemfile CHANGED
@@ -4,19 +4,19 @@
4
4
 
5
5
  source "https://rubygems.org/"
6
6
 
7
- gem "mini_portile2", "~>2.0.0.rc2"
7
+ gem "mini_portile2", "~>2.1.0"
8
8
 
9
9
  gem "rdoc", "~>4.0", :group => [:development, :test]
10
- gem "hoe-bundler", ">=1.1", :group => [:development, :test]
11
- gem "hoe-debugging", "~>1.2.0", :group => [:development, :test]
12
- gem "hoe-gemspec", ">=1.0", :group => [:development, :test]
13
- gem "hoe-git", ">=1.4", :group => [:development, :test]
14
- gem "minitest", "~>2.2.2", :group => [:development, :test]
15
- gem "rake", ">=0.9", :group => [:development, :test]
10
+ gem "hoe-bundler", "~>1.2.0", :group => [:development, :test]
11
+ gem "hoe-debugging", "~>1.2.1", :group => [:development, :test]
12
+ gem "hoe-gemspec", "~>1.0.0", :group => [:development, :test]
13
+ gem "hoe-git", "~>1.6.0", :group => [:development, :test]
14
+ gem "minitest", "~>5.8.4", :group => [:development, :test]
15
+ gem "rake", "~>10.5.0", :group => [:development, :test]
16
16
  gem "rake-compiler", "~>0.9.2", :group => [:development, :test]
17
- gem "rake-compiler-dock", "~>0.4.2", :group => [:development, :test]
18
- gem "racc", ">=1.4.6", :group => [:development, :test], :platform => :ruby
19
- gem "rexical", ">=1.0.5", :group => [:development, :test], :platform => :ruby
17
+ gem "rake-compiler-dock", "~>0.5.1", :group => [:development, :test]
18
+ gem "racc", "~>1.4.14", :group => [:development, :test], :platform => :ruby
19
+ gem "rexical", "~>1.0.5", :group => [:development, :test], :platform => :ruby
20
20
  gem "hoe", "~>3.14", :group => [:development, :test]
21
21
 
22
22
  # vim: syntax=ruby
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2008 - 2015:
3
+ Copyright (c) 2008 - 2016:
4
4
 
5
5
  * [Aaron Patterson](http://tenderlovemaking.com)
6
6
  * [Mike Dalessio](http://mike.daless.io)
data/Manifest.txt CHANGED
@@ -3,8 +3,8 @@
3
3
  .editorconfig
4
4
  .gemtest
5
5
  .travis.yml
6
- CHANGELOG.ja.rdoc
7
6
  CHANGELOG.rdoc
7
+ CONTRIBUTING.md
8
8
  C_CODING_STYLE.rdoc
9
9
  Gemfile
10
10
  LICENSE.txt
@@ -241,7 +241,10 @@ lib/nokogiri/xml/xpath/syntax_error.rb
241
241
  lib/nokogiri/xml/xpath_context.rb
242
242
  lib/nokogiri/xslt.rb
243
243
  lib/nokogiri/xslt/stylesheet.rb
244
+ lib/serializer.jar
245
+ lib/xalan.jar
244
246
  lib/xercesImpl.jar
247
+ lib/xml-apis.jar
245
248
  lib/xsd/xmlparser/nokogiri.rb
246
249
  patches/sort-patches-by-date
247
250
  suppressions/README.txt
@@ -256,6 +259,7 @@ test/css/test_tokenizer.rb
256
259
  test/css/test_xpath_visitor.rb
257
260
  test/decorators/test_slop.rb
258
261
  test/files/2ch.html
262
+ test/files/GH_1042.html
259
263
  test/files/address_book.rlx
260
264
  test/files/address_book.xml
261
265
  test/files/atom.xml
@@ -268,6 +272,7 @@ test/files/exslt.xml
268
272
  test/files/exslt.xslt
269
273
  test/files/foo/foo.xsd
270
274
  test/files/metacharset.html
275
+ test/files/namespace_pressure_test.xml
271
276
  test/files/noencoding.html
272
277
  test/files/po.xml
273
278
  test/files/po.xsd
@@ -314,7 +319,6 @@ test/test_css_cache.rb
314
319
  test/test_encoding_handler.rb
315
320
  test/test_memory_leak.rb
316
321
  test/test_nokogiri.rb
317
- test/test_reader.rb
318
322
  test/test_soap4r_sax.rb
319
323
  test/test_xslt_transforms.rb
320
324
  test/xml/node/test_save_options.rb
@@ -346,6 +350,7 @@ test/xml/test_node_reparenting.rb
346
350
  test/xml/test_node_set.rb
347
351
  test/xml/test_parse_options.rb
348
352
  test/xml/test_processing_instruction.rb
353
+ test/xml/test_reader.rb
349
354
  test/xml/test_reader_encoding.rb
350
355
  test/xml/test_relax_ng.rb
351
356
  test/xml/test_schema.rb
data/README.md CHANGED
@@ -22,9 +22,6 @@ Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among
22
22
  Nokogiri's many features is the ability to search documents via XPath
23
23
  or CSS3 selectors.
24
24
 
25
- XML is like violence - if it doesn’t solve your problems, you are not
26
- using enough of it.
27
-
28
25
 
29
26
  ## Features
30
27
 
@@ -86,29 +83,28 @@ There are open-source tutorials (to which we invite contributions!) here: http:/
86
83
  Nokogiri is a large library, but here is example usage for parsing and examining a document:
87
84
 
88
85
  ```ruby
89
- require 'nokogiri'
90
- require 'open-uri'
91
-
92
- # Fetch and parse HTML document
93
- doc = Nokogiri::HTML(open('http://www.nokogiri.org/tutorials/installing_nokogiri.html'))
94
-
95
- ####
96
- # Search for nodes by css
97
- doc.css('nav ul.menu li a').each do |link|
98
- puts link.content
99
- end
100
-
101
- ####
102
- # Search for nodes by xpath
103
- doc.xpath('//h2 | //h3').each do |link|
104
- puts link.content
105
- end
106
-
107
- ####
108
- # Or mix and match.
109
- doc.search('code.sh', '//h2').each do |link|
110
- puts link.content
111
- end
86
+ #! /usr/bin/env ruby
87
+
88
+ require 'nokogiri'
89
+ require 'open-uri'
90
+
91
+ # Fetch and parse HTML document
92
+ doc = Nokogiri::HTML(open('http://www.nokogiri.org/tutorials/installing_nokogiri.html'))
93
+
94
+ puts "### Search for nodes by css"
95
+ doc.css('nav ul.menu li a', 'article h2').each do |link|
96
+ puts link.content
97
+ end
98
+
99
+ puts "### Search for nodes by xpath"
100
+ doc.xpath('//nav//ul//li/a', '//article//h2').each do |link|
101
+ puts link.content
102
+ end
103
+
104
+ puts "### Or mix and match."
105
+ doc.search('nav ul.menu li a', '//article//h2').each do |link|
106
+ puts link.content
107
+ end
112
108
  ```
113
109
 
114
110
 
@@ -121,7 +117,7 @@ Nokogiri is a large library, but here is example usage for parsing and examining
121
117
  gem, but if you want to use the system versions:
122
118
 
123
119
  * at install time, set the environment variable
124
- `USING_SYSTEM_ALLOCATOR_LIBRARY` or else use the
120
+ `NOKOGIRI_USE_SYSTEM_LIBRARIES` or else use the
125
121
  `--use-system-libraries` argument. (See
126
122
  http://nokogiri.org/tutorials/installing_nokogiri.html#using_your_system_libraries
127
123
  for specifics.)
data/ROADMAP.md CHANGED
@@ -1,4 +1,4 @@
1
- # Roadmap for 2.0
1
+ # Roadmap for API Changes
2
2
 
3
3
  ## overhaul serialize/pretty printing API
4
4
 
@@ -99,3 +99,13 @@ So, instead, let's make alternative methods like
99
99
  `Nokogiri::XML::Document#new_comment`, and recommend those as the
100
100
  proper convention.
101
101
 
102
+
103
+ ## `collect_namespaces` is just broken
104
+
105
+ `collect_namespaces` is returning a hash, which means it can't return
106
+ namespaces with the same prefix. See this issue for background:
107
+
108
+ > https://github.com/sparklemotion/nokogiri/issues/885
109
+
110
+ Do we care? This seems like a useless method, but then again I hate
111
+ XML, so what do I know?
data/Rakefile CHANGED
@@ -8,7 +8,6 @@ Hoe.plugin :debugging
8
8
  Hoe.plugin :git
9
9
  Hoe.plugin :gemspec
10
10
  Hoe.plugin :bundler
11
- Hoe.add_include_dirs '.'
12
11
 
13
12
  GENERATED_PARSER = "lib/nokogiri/css/parser.rb"
14
13
  GENERATED_TOKENIZER = "lib/nokogiri/css/tokenizer.rb"
@@ -128,22 +127,21 @@ HOE = Hoe.spec 'nokogiri' do
128
127
 
129
128
  unless java?
130
129
  self.extra_deps += [
131
- # Keep this version in sync with the one in extconf.rb !
132
- ["mini_portile2", "~> 2.0.0.rc2"],
130
+ ["mini_portile2", "~> 2.1.0"], # keep version in sync with extconf.rb
133
131
  ]
134
132
  end
135
133
 
136
134
  self.extra_dev_deps += [
137
- ["hoe-bundler", ">= 1.1"],
138
- ["hoe-debugging", "~> 1.2.0"],
139
- ["hoe-gemspec", ">= 1.0"],
140
- ["hoe-git", ">= 1.4"],
141
- ["minitest", "~> 2.2.2"],
142
- ["rake", ">= 0.9"],
143
- ["rake-compiler", "~> 0.9.2"],
144
- ["rake-compiler-dock", "~> 0.4.2"],
145
- ["racc", ">= 1.4.6"],
146
- ["rexical", ">= 1.0.5"]
135
+ ["hoe-bundler", "~> 1.2.0"],
136
+ ["hoe-debugging", "~> 1.2.1"],
137
+ ["hoe-gemspec", "~> 1.0.0"],
138
+ ["hoe-git", "~> 1.6.0"],
139
+ ["minitest", "~> 5.8.4"],
140
+ ["rake", "~> 10.5.0"],
141
+ ["rake-compiler", "~> 0.9.2"],
142
+ ["rake-compiler-dock", "~> 0.5.1"],
143
+ ["racc", "~> 1.4.14"],
144
+ ["rexical", "~> 1.0.5"]
147
145
  ]
148
146
 
149
147
  if java?
@@ -184,6 +182,7 @@ if java?
184
182
  ext.target_version = '1.6'
185
183
  jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
186
184
  ext.classpath = jars.map { |x| File.expand_path x }.join ':'
185
+ ext.debug = true if ENV['JAVA_DEBUG']
187
186
  end
188
187
 
189
188
  task gem_build_path => [:compile] do
@@ -206,7 +205,7 @@ else
206
205
 
207
206
  task gem_build_path do
208
207
  %w[libxml2 libxslt].each do |lib|
209
- version = dependencies[lib]
208
+ version = dependencies[lib]["version"]
210
209
  archive = File.join("ports", "archives", "#{lib}-#{version}.tar.gz")
211
210
  add_file_to_gem archive
212
211
  patchesdir = File.join("patches", lib)
@@ -231,7 +230,7 @@ else
231
230
  ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq
232
231
  ext.cross_config_options << "--enable-cross-build"
233
232
  ext.cross_compiling do |spec|
234
- libs = dependencies.map { |name, version| "#{name}-#{version}" }.join(', ')
233
+ libs = dependencies.map { |name, dep| "#{name}-#{dep["version"]}" }.join(', ')
235
234
 
236
235
  spec.required_ruby_version = [
237
236
  '>= 1.9.2',
@@ -292,10 +291,11 @@ task :debug do
292
291
  ENV['CFLAGS'] += " -DDEBUG"
293
292
  end
294
293
 
295
- require 'tasks/test'
294
+ require File.join File.dirname(__FILE__), 'tasks/test'
296
295
 
297
296
  task :java_debug do
298
- ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if java? && ENV['JAVA_DEBUG']
297
+ ENV['JRUBY_OPTS'] = "#{ENV['JRUBY_OPTS']} --debug --dev"
298
+ ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if ENV['JAVA_DEBUG']
299
299
  end
300
300
 
301
301
  if java?
@@ -316,6 +316,24 @@ if Hoe.plugins.include?(:debugging)
316
316
  end
317
317
  end
318
318
 
319
+ task "test:libxml-ruby" do
320
+ ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = "1"
321
+ warn "#{__FILE__}:#{__LINE__}: --- running tests with libxml-ruby loaded ---"
322
+ Rake::Task[:test].execute
323
+ ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = nil
324
+ end
325
+
326
+ Rake::Task["test:libxml-ruby"].prerequisites << :compile
327
+
328
+ task "test:valgrind:libxml-ruby" do
329
+ ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = "1"
330
+ warn "#{__FILE__}:#{__LINE__}: --- running tests with libxml-ruby loaded ---"
331
+ Rake::Task["test:valgrind"].execute
332
+ ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = nil
333
+ end
334
+
335
+ Rake::Task["test:valgrind:libxml-ruby"].prerequisites << :compile
336
+
319
337
  # ----------------------------------------
320
338
 
321
339
  def verify_dll(dll, cross_ruby)
data/bin/nokogiri CHANGED
@@ -41,9 +41,9 @@ opts = OptionParser.new do |opts|
41
41
  opts.define_head "Usage: nokogiri <uri|path> [options]"
42
42
  opts.separator ""
43
43
  opts.separator "Examples:"
44
- opts.separator " nokogiri http://www.ruby-lang.org/"
44
+ opts.separator " nokogiri https://www.ruby-lang.org/"
45
45
  opts.separator " nokogiri ./public/index.html"
46
- opts.separator " curl -s http://nokogiri.org | nokogiri -e'p $_.css(\"h1\").length'"
46
+ opts.separator " curl -s http://www.nokogiri.org | nokogiri -e'p $_.css(\"h1\").length'"
47
47
  opts.separator ""
48
48
  opts.separator "Options:"
49
49
 
data/build_all CHANGED
@@ -16,7 +16,7 @@ else
16
16
  fi
17
17
 
18
18
  set -o errexit
19
- set -x
19
+ #set -x
20
20
 
21
21
  rm -rf tmp pkg
22
22
  bundle exec rake clean clobber
data/dependencies.yml CHANGED
@@ -1,4 +1,29 @@
1
- libxml2: "2.9.2"
2
- libxslt: "1.1.28"
3
- zlib: "1.2.8"
4
- libiconv: "1.14"
1
+ libxml2:
2
+ version: "2.9.4"
3
+ md5: "ae249165c173b1ff386ee8ad676815f5" # manually confirmed via `gpg --verify`
4
+ # gpg: Signature made Mon 23 May 2016 04:02:13 AM EDT using DSA key ID DE95BC1F
5
+ # gpg: Good signature from "Daniel Veillard (Red Hat work email) <veillard@redhat.com>"
6
+ # gpg: aka "Daniel Veillard <Daniel.Veillard@w3.org>"
7
+ # gpg: WARNING: This key is not certified with a trusted signature!
8
+ # gpg: There is no indication that the signature belongs to the owner.
9
+ # Primary key fingerprint: C744 15BA 7C9C 7F78 F02E 1DC3 4606 B8A5 DE95 BC1F
10
+
11
+ libxslt:
12
+ version: "1.1.29"
13
+ md5: "a129d3c44c022de3b9dcf6d6f288d72e"
14
+ # gpg: Signature made Mon 23 May 2016 09:58:52 PM EDT using DSA key ID DE95BC1F
15
+ # gpg: Good signature from "Daniel Veillard (Red Hat work email) <veillard@redhat.com>"
16
+ # gpg: aka "Daniel Veillard <Daniel.Veillard@w3.org>"
17
+ # gpg: WARNING: This key is not certified with a trusted signature!
18
+ # gpg: There is no indication that the signature belongs to the owner.
19
+ # Primary key fingerprint: C744 15BA 7C9C 7F78 F02E 1DC3 4606 B8A5 DE95 BC1F
20
+
21
+ zlib:
22
+ version: "1.2.8"
23
+ md5: "44d667c142d7cda120332623eab69f40"
24
+
25
+ libiconv:
26
+ version: "1.14"
27
+ md5: "e34509b1623cec449dfeb73d7ce9c6c6"
28
+ # gpg: Signature made Sun 07 Aug 2011 01:58:18 PM EDT using DSA key ID F059B1D1
29
+ # gpg: BAD signature from "Bruno Haible (Open Source Development) <bruno@clisp.org>"