nokogiri 1.6.7.rc3-java → 1.6.7.rc4-java
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.
- checksums.yaml +4 -4
- data/CHANGELOG.ja.rdoc +29 -1
- data/CHANGELOG.rdoc +28 -0
- data/Gemfile +2 -2
- data/Rakefile +2 -1
- data/ext/java/nokogiri/XmlDocument.java +5 -0
- data/ext/java/nokogiri/XmlNode.java +4 -0
- data/ext/java/nokogiri/XmlSchema.java +20 -20
- data/ext/java/nokogiri/internals/NokogiriHandler.java +3 -5
- data/ext/nokogiri/extconf.rb +8 -3
- data/ext/nokogiri/xml_sax_parser_context.c +2 -2
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/test/html/test_document.rb +5 -0
- data/test/xml/test_schema.rb +15 -2
- data/test/xml/test_xpath.rb +15 -0
- data/test_all +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2daa390eb37d01bcc6fa00c0c6b07545667a8e1
|
4
|
+
data.tar.gz: 3c882ca3bd998e59c9961f594d82ef415ada59e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1222d2dd3fd9189cdaeee8486817a2791b4b961fdcecf09664f53be8a51fb24f44d03128b8d012a757d164ca4080b81cacabb66bdab8bf49aafd839423d90ef8
|
7
|
+
data.tar.gz: 00810db59e1bb49bbc0ef19ddcec65a0845e0d526dbb065a4450107fc94f2406241a00b0ae2776dccea411f341a1b34d0835f855cf320216850f3f48cd74b176
|
data/CHANGELOG.ja.rdoc
CHANGED
@@ -1,4 +1,32 @@
|
|
1
|
-
=== 1.6.7.
|
1
|
+
=== 1.6.7.rc4 / 2015年11月22日
|
2
|
+
|
3
|
+
==== Security patches
|
4
|
+
|
5
|
+
This version pulls in several upstream patches to the vendored libxml2 and libxslt to address:
|
6
|
+
|
7
|
+
* CVE-2015-1819
|
8
|
+
* CVE-2015-7941_1
|
9
|
+
* CVE-2015-7941_2
|
10
|
+
* CVE-2015-7942
|
11
|
+
* CVE-2015-7942-2
|
12
|
+
* CVE-2015-8035
|
13
|
+
* CVE-2015-7995
|
14
|
+
* unclosed comment uninitialized access issue (does not have a CVE assigned)
|
15
|
+
|
16
|
+
See #1374 and #1376 for details.
|
17
|
+
|
18
|
+
==== Features
|
19
|
+
|
20
|
+
* [MRI] libxml2 and libxslt `config.guess` files brought up to date. (#1326) (Thanks, @hernan-erasmo!)
|
21
|
+
* [JRuby] fix error in validating files with jruby (#1355, #1361) (Thanks, @twalpole!)
|
22
|
+
* [MRI, OSX] Patch to handle nonstandard location of `iconv.h`. (#1206, #1210, #1218, #1345) (Thanks, @neonichu!)
|
23
|
+
|
24
|
+
==== Bug Fixes
|
25
|
+
|
26
|
+
* [JRuby] reset the namespace cache when replacing the document's innerHtml (#1265) (Thanks, @mkristian!)
|
27
|
+
|
28
|
+
|
29
|
+
=== 1.6.7.rc3 / 2015年09月04日 and 1.6.7.rc2 / 2015年08月31日
|
2
30
|
|
3
31
|
Note that rc1 was not released.
|
4
32
|
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
=== 1.6.7.rc4 / 2015-11-22
|
2
|
+
|
3
|
+
==== Security patches
|
4
|
+
|
5
|
+
This version pulls in several upstream patches to the vendored libxml2 and libxslt to address:
|
6
|
+
|
7
|
+
* CVE-2015-1819
|
8
|
+
* CVE-2015-7941_1
|
9
|
+
* CVE-2015-7941_2
|
10
|
+
* CVE-2015-7942
|
11
|
+
* CVE-2015-7942-2
|
12
|
+
* CVE-2015-8035
|
13
|
+
* CVE-2015-7995
|
14
|
+
* unclosed comment uninitialized access issue (does not have a CVE assigned)
|
15
|
+
|
16
|
+
See #1374 and #1376 for details.
|
17
|
+
|
18
|
+
==== Features
|
19
|
+
|
20
|
+
* [MRI] libxml2 and libxslt `config.guess` files brought up to date. (#1326) (Thanks, @hernan-erasmo!)
|
21
|
+
* [JRuby] fix error in validating files with jruby (#1355, #1361) (Thanks, @twalpole!)
|
22
|
+
* [MRI, OSX] Patch to handle nonstandard location of `iconv.h`. (#1206, #1210, #1218, #1345) (Thanks, @neonichu!)
|
23
|
+
|
24
|
+
==== Bug Fixes
|
25
|
+
|
26
|
+
* [JRuby] reset the namespace cache when replacing the document's innerHtml (#1265) (Thanks, @mkristian!)
|
27
|
+
|
28
|
+
|
1
29
|
=== 1.6.7.rc3 / 2015-09-04 and 1.6.7.rc2 / 2015-08-31
|
2
30
|
|
3
31
|
Note that rc1 was not released.
|
data/Gemfile
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
source "https://rubygems.org/"
|
6
6
|
|
7
|
-
gem "
|
7
|
+
gem "mini_portile2", "~>2.0.0.rc2"
|
8
8
|
|
9
9
|
gem "rdoc", "~>4.0", :group => [:development, :test]
|
10
10
|
gem "hoe-bundler", ">=1.1", :group => [:development, :test]
|
@@ -17,6 +17,6 @@ gem "rake-compiler", "~>0.9.2", :group => [:development, :test]
|
|
17
17
|
gem "rake-compiler-dock", "~>0.4.2", :group => [:development, :test]
|
18
18
|
gem "racc", ">=1.4.6", :group => [:development, :test], :platform => :ruby
|
19
19
|
gem "rexical", ">=1.0.5", :group => [:development, :test], :platform => :ruby
|
20
|
-
gem "hoe", "~>3.
|
20
|
+
gem "hoe", "~>3.14", :group => [:development, :test]
|
21
21
|
|
22
22
|
# vim: syntax=ruby
|
data/Rakefile
CHANGED
@@ -1551,6 +1551,10 @@ public class XmlNode extends RubyObject {
|
|
1551
1551
|
coalesceTextNodes(context, other, scheme);
|
1552
1552
|
}
|
1553
1553
|
|
1554
|
+
if (this instanceof XmlDocument) {
|
1555
|
+
((XmlDocument) this).resetNamespaceCache(context);
|
1556
|
+
}
|
1557
|
+
|
1554
1558
|
relink_namespace(context);
|
1555
1559
|
// post_add_child(context, this, other);
|
1556
1560
|
|
@@ -17,10 +17,10 @@
|
|
17
17
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
18
18
|
* permit persons to whom the Software is furnished to do so, subject to
|
19
19
|
* the following conditions:
|
20
|
-
*
|
20
|
+
*
|
21
21
|
* The above copyright notice and this permission notice shall be
|
22
22
|
* included in all copies or substantial portions of the Software.
|
23
|
-
*
|
23
|
+
*
|
24
24
|
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
25
25
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
26
26
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
@@ -71,7 +71,7 @@ import org.xml.sax.SAXException;
|
|
71
71
|
|
72
72
|
/**
|
73
73
|
* Class for Nokogiri::XML::Schema
|
74
|
-
*
|
74
|
+
*
|
75
75
|
* @author sergio
|
76
76
|
* @author Yoko Harada <yokolet@gmail.com>
|
77
77
|
*/
|
@@ -82,7 +82,7 @@ public class XmlSchema extends RubyObject {
|
|
82
82
|
public XmlSchema(Ruby ruby, RubyClass klazz) {
|
83
83
|
super(ruby, klazz);
|
84
84
|
}
|
85
|
-
|
85
|
+
|
86
86
|
/**
|
87
87
|
* Create and return a copy of this object.
|
88
88
|
*
|
@@ -100,7 +100,7 @@ public class XmlSchema extends RubyObject {
|
|
100
100
|
schemaFactory.setErrorHandler(new IgnoreSchemaErrorsErrorHandler());
|
101
101
|
return schemaFactory.newSchema(source);
|
102
102
|
}
|
103
|
-
|
103
|
+
|
104
104
|
private void setValidator(Validator validator) {
|
105
105
|
this.validator = validator;
|
106
106
|
}
|
@@ -109,7 +109,7 @@ public class XmlSchema extends RubyObject {
|
|
109
109
|
Ruby runtime = context.getRuntime();
|
110
110
|
XmlSchema xmlSchema = (XmlSchema) NokogiriService.XML_SCHEMA_ALLOCATOR.allocate(runtime, klazz);
|
111
111
|
xmlSchema.setInstanceVariable("@errors", runtime.newEmptyArray());
|
112
|
-
|
112
|
+
|
113
113
|
try {
|
114
114
|
Schema schema = xmlSchema.getSchema(source, context.getRuntime().getCurrentDirectory(), context.getRuntime().getInstanceConfig().getScriptFileName());
|
115
115
|
xmlSchema.setValidator(schema.newValidator());
|
@@ -137,14 +137,14 @@ public class XmlSchema extends RubyObject {
|
|
137
137
|
DOMSource source = new DOMSource(doc.getDocument());
|
138
138
|
|
139
139
|
IRubyObject uri = doc.url(context);
|
140
|
-
|
140
|
+
|
141
141
|
if (!uri.isNil()) {
|
142
142
|
source.setSystemId(uri.convertToString().asJavaString());
|
143
143
|
}
|
144
|
-
|
144
|
+
|
145
145
|
return getSchema(context, (RubyClass)klazz, source);
|
146
146
|
}
|
147
|
-
|
147
|
+
|
148
148
|
private static IRubyObject getSchema(ThreadContext context, RubyClass klazz, Source source) {
|
149
149
|
String moduleName = klazz.getName();
|
150
150
|
if ("Nokogiri::XML::Schema".equals(moduleName)) {
|
@@ -165,17 +165,17 @@ public class XmlSchema extends RubyObject {
|
|
165
165
|
public IRubyObject validate_document(ThreadContext context, IRubyObject document) {
|
166
166
|
return validate_document_or_file(context, (XmlDocument)document);
|
167
167
|
}
|
168
|
-
|
168
|
+
|
169
169
|
@JRubyMethod(visibility=Visibility.PRIVATE)
|
170
170
|
public IRubyObject validate_file(ThreadContext context, IRubyObject file) {
|
171
171
|
Ruby ruby = context.getRuntime();
|
172
172
|
|
173
173
|
XmlDomParserContext ctx = new XmlDomParserContext(ruby, RubyFixnum.newFixnum(ruby, 1L));
|
174
|
-
ctx.
|
174
|
+
ctx.setInputSourceFile(context, file);
|
175
175
|
XmlDocument xmlDocument = ctx.parse(context, getNokogiriClass(ruby, "Nokogiri::XML::Document"), ruby.getNil());
|
176
176
|
return validate_document_or_file(context, xmlDocument);
|
177
177
|
}
|
178
|
-
|
178
|
+
|
179
179
|
IRubyObject validate_document_or_file(ThreadContext context, XmlDocument xmlDocument) {
|
180
180
|
RubyArray errors = (RubyArray) this.getInstanceVariable("@errors");
|
181
181
|
ErrorHandler errorHandler = new SchemaErrorHandler(context.getRuntime(), errors);
|
@@ -193,22 +193,22 @@ public class XmlSchema extends RubyObject {
|
|
193
193
|
|
194
194
|
return errors;
|
195
195
|
}
|
196
|
-
|
196
|
+
|
197
197
|
protected void setErrorHandler(ErrorHandler errorHandler) {
|
198
198
|
validator.setErrorHandler(errorHandler);
|
199
199
|
}
|
200
|
-
|
200
|
+
|
201
201
|
protected void validate(Document document) throws SAXException, IOException {
|
202
202
|
DOMSource docSource = new DOMSource(document);
|
203
203
|
validator.validate(docSource);
|
204
204
|
}
|
205
|
-
|
205
|
+
|
206
206
|
private class SchemaResourceResolver implements LSResourceResolver {
|
207
207
|
SchemaLSInput lsInput = new SchemaLSInput();
|
208
208
|
String currentDir;
|
209
209
|
String scriptFileName;
|
210
210
|
//String defaultURI;
|
211
|
-
|
211
|
+
|
212
212
|
SchemaResourceResolver(String currentDir, String scriptFileName, Object input) {
|
213
213
|
this.currentDir = currentDir;
|
214
214
|
this.scriptFileName = scriptFileName;
|
@@ -231,7 +231,7 @@ public class XmlSchema extends RubyObject {
|
|
231
231
|
return lsInput;
|
232
232
|
}
|
233
233
|
}
|
234
|
-
|
234
|
+
|
235
235
|
private class SchemaLSInput implements LSInput {
|
236
236
|
protected String fPublicId;
|
237
237
|
protected String fSystemId;
|
@@ -241,7 +241,7 @@ public class XmlSchema extends RubyObject {
|
|
241
241
|
protected String fData;
|
242
242
|
protected String fEncoding;
|
243
243
|
protected boolean fCertifiedText = false;
|
244
|
-
|
244
|
+
|
245
245
|
@Override
|
246
246
|
public String getBaseURI() {
|
247
247
|
return fBaseSystemId;
|
@@ -289,7 +289,7 @@ public class XmlSchema extends RubyObject {
|
|
289
289
|
|
290
290
|
@Override
|
291
291
|
public void setByteStream(InputStream byteStream) {
|
292
|
-
fByteStream = byteStream;
|
292
|
+
fByteStream = byteStream;
|
293
293
|
}
|
294
294
|
|
295
295
|
@Override
|
@@ -321,6 +321,6 @@ public class XmlSchema extends RubyObject {
|
|
321
321
|
public void setSystemId(String sysId) {
|
322
322
|
fSystemId = sysId;
|
323
323
|
}
|
324
|
-
|
324
|
+
|
325
325
|
}
|
326
326
|
}
|
@@ -128,12 +128,10 @@ public class NokogiriHandler extends DefaultHandler2 implements XmlDeclHandler {
|
|
128
128
|
}
|
129
129
|
|
130
130
|
/*
|
131
|
-
* This
|
132
|
-
* "start_element_namespace" depending on whether there are any
|
133
|
-
* namespace attributes.
|
131
|
+
* This calls "start_element_namespace".
|
134
132
|
*
|
135
133
|
* Attributes that define namespaces are passed in a separate
|
136
|
-
* array of
|
134
|
+
* array of <code>[:prefix, :uri]</code> arrays and are not
|
137
135
|
* passed with the other attributes.
|
138
136
|
*/
|
139
137
|
@Override
|
@@ -158,7 +156,7 @@ public class NokogiriHandler extends DefaultHandler2 implements XmlDeclHandler {
|
|
158
156
|
|
159
157
|
if (isNamespace(qn) && !fromFragmentHandler) {
|
160
158
|
// I haven't figured the reason out yet, but, in somewhere,
|
161
|
-
// namespace is converted to array in array
|
159
|
+
// namespace is converted to array in array and cause
|
162
160
|
// TypeError at line 45 in fragment_handler.rb
|
163
161
|
RubyArray ns = RubyArray.newArray(ruby, 2);
|
164
162
|
if (ln.equals("xmlns")) ln = null;
|
data/ext/nokogiri/extconf.rb
CHANGED
@@ -391,7 +391,12 @@ when using_system_libraries?
|
|
391
391
|
else
|
392
392
|
message "Building nokogiri using packaged libraries.\n"
|
393
393
|
|
394
|
-
|
394
|
+
# The gem version constraint in the Rakefile is not respected at install time.
|
395
|
+
# Keep this version in sync with the one in the Rakefile !
|
396
|
+
gem "mini_portile2", "~> 2.0.0.rc2"
|
397
|
+
require 'mini_portile2'
|
398
|
+
message "Using mini_portile version #{MiniPortile::VERSION}\n"
|
399
|
+
|
395
400
|
require 'yaml'
|
396
401
|
|
397
402
|
static_p = enable_config('static', true) or
|
@@ -448,10 +453,10 @@ else
|
|
448
453
|
]
|
449
454
|
end
|
450
455
|
else
|
451
|
-
if darwin_p && !
|
456
|
+
if darwin_p && !have_header('iconv.h')
|
452
457
|
abort <<'EOM'.chomp
|
453
458
|
-----
|
454
|
-
The file "
|
459
|
+
The file "iconv.h" is missing in your build environment,
|
455
460
|
which means you haven't installed Xcode Command Line Tools properly.
|
456
461
|
|
457
462
|
To install Command Line Tools, try running `xcode-select --install` on
|
@@ -206,7 +206,7 @@ static VALUE column(VALUE self)
|
|
206
206
|
* recovery=(boolean)
|
207
207
|
*
|
208
208
|
* Should this parser recover from structural errors? It will not stop processing
|
209
|
-
* file on structural errors if
|
209
|
+
* file on structural errors if set to true
|
210
210
|
*/
|
211
211
|
static VALUE set_recovery(VALUE self, VALUE value)
|
212
212
|
{
|
@@ -226,7 +226,7 @@ static VALUE set_recovery(VALUE self, VALUE value)
|
|
226
226
|
* recovery
|
227
227
|
*
|
228
228
|
* Should this parser recover from structural errors? It will not stop processing
|
229
|
-
* file on structural errors if
|
229
|
+
* file on structural errors if set to true
|
230
230
|
*/
|
231
231
|
static VALUE get_recovery(VALUE self)
|
232
232
|
{
|
data/lib/nokogiri/nokogiri.jar
CHANGED
Binary file
|
data/lib/nokogiri/version.rb
CHANGED
data/test/html/test_document.rb
CHANGED
@@ -14,6 +14,11 @@ module Nokogiri
|
|
14
14
|
assert @html.xpath(nil)
|
15
15
|
end
|
16
16
|
|
17
|
+
def test_does_not_fail_with_illformatted_html
|
18
|
+
doc = Nokogiri::HTML('"</html>";'.force_encoding(Encoding::BINARY))
|
19
|
+
assert_not_nil doc
|
20
|
+
end
|
21
|
+
|
17
22
|
def test_exceptions_remove_newlines
|
18
23
|
errors = @html.errors
|
19
24
|
assert errors.length > 0, 'has errors'
|
data/test/xml/test_schema.rb
CHANGED
@@ -94,9 +94,22 @@ EOF
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def test_validate_invalid_document
|
97
|
-
|
97
|
+
doc = Nokogiri::XML File.read(PO_XML_FILE)
|
98
|
+
doc.css("city").unlink
|
98
99
|
|
99
|
-
assert errors = @xsd.validate(
|
100
|
+
assert errors = @xsd.validate(doc)
|
101
|
+
assert_equal 2, errors.length
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_validate_invalid_file
|
105
|
+
tempfile = Tempfile.new("xml")
|
106
|
+
|
107
|
+
doc = Nokogiri::XML File.read(PO_XML_FILE)
|
108
|
+
doc.css("city").unlink
|
109
|
+
tempfile.write doc.to_xml
|
110
|
+
tempfile.close
|
111
|
+
|
112
|
+
assert errors = @xsd.validate(tempfile.path)
|
100
113
|
assert_equal 2, errors.length
|
101
114
|
end
|
102
115
|
|
data/test/xml/test_xpath.rb
CHANGED
@@ -425,6 +425,21 @@ END
|
|
425
425
|
assert_equal 1, xml_doc.xpath('//mods:titleInfo',ns_hash).length
|
426
426
|
assert_equal 'finnish', xml_doc.xpath('//mods:titleInfo[1]/@lang',ns_hash).first.value
|
427
427
|
end
|
428
|
+
|
429
|
+
def test_xpath_after_reset_doc_via_innerhtml
|
430
|
+
xml = <<XML
|
431
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
432
|
+
<document xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0">
|
433
|
+
<text:section name="Section1">[TEXT_INSIDE_SECTION]</text:section>
|
434
|
+
</document>
|
435
|
+
XML
|
436
|
+
|
437
|
+
doc = Nokogiri::XML(xml)
|
438
|
+
doc.inner_html = doc.inner_html
|
439
|
+
sections = doc.xpath(".//text:section[@name='Section1']")
|
440
|
+
assert_equal 1, sections.size
|
441
|
+
assert_equal "[TEXT_INSIDE_SECTION]", sections.first.text
|
442
|
+
end
|
428
443
|
end
|
429
444
|
end
|
430
445
|
end
|
data/test_all
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.7.
|
4
|
+
version: 1.6.7.rc4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-11-22 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rdoc
|
@@ -174,12 +174,12 @@ dependencies:
|
|
174
174
|
requirements:
|
175
175
|
- - ~>
|
176
176
|
- !ruby/object:Gem::Version
|
177
|
-
version: '3.
|
177
|
+
version: '3.14'
|
178
178
|
requirement: !ruby/object:Gem::Requirement
|
179
179
|
requirements:
|
180
180
|
- - ~>
|
181
181
|
- !ruby/object:Gem::Version
|
182
|
-
version: '3.
|
182
|
+
version: '3.14'
|
183
183
|
prerelease: false
|
184
184
|
type: :development
|
185
185
|
description: |-
|