nokogiri 1.12.0.rc1-x86-linux → 1.12.3-x86-linux
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/ext/nokogiri/extconf.rb +4 -0
- data/ext/nokogiri/gumbo.c +13 -40
- data/ext/nokogiri/html4_element_description.c +1 -1
- data/ext/nokogiri/html4_sax_parser_context.c +2 -1
- data/ext/nokogiri/nokogiri.c +1 -1
- data/ext/nokogiri/nokogiri.h +3 -0
- data/ext/nokogiri/xml_document.c +1 -1
- data/ext/nokogiri/xml_namespace.c +2 -2
- data/ext/nokogiri/xml_node.c +2 -2
- data/lib/nokogiri/2.5/nokogiri.so +0 -0
- data/lib/nokogiri/2.6/nokogiri.so +0 -0
- data/lib/nokogiri/2.7/nokogiri.so +0 -0
- data/lib/nokogiri/3.0/nokogiri.so +0 -0
- data/lib/nokogiri/extension.rb +6 -1
- data/lib/nokogiri/html5.rb +10 -10
- data/lib/nokogiri/version/constant.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f06988d2236043a4d6aaab6acd483202b709ed99d43c00110407d9fd69190fad
|
4
|
+
data.tar.gz: 00aeaa27d7f10ed21b44110794e6a6900fedb7bf188d9f4a3459211c77e25faf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a248a7879afeaffc4fa2b7afc8b48cf0b063035109a0c184256db987a15f9113356f065ffbfb2db824e27e262784a8cba8f7ad4fc8812970f3b9fe1b75234abe
|
7
|
+
data.tar.gz: ecfb051d099760d8fb795a63bf711a7d8865e4e94ff3e8180e5d80dad52fd02af2e7e7806d18f6e1743d9ebc924340286508711233b33bb796aa038a1592ff4f
|
data/ext/nokogiri/extconf.rb
CHANGED
@@ -594,6 +594,10 @@ append_cppflags(ENV["CPPFLAGS"].split) unless ENV["CPPFLAGS"].nil?
|
|
594
594
|
append_ldflags(ENV["LDFLAGS"].split) unless ENV["LDFLAGS"].nil?
|
595
595
|
$LIBS = concat_flags($LIBS, ENV["LIBS"])
|
596
596
|
|
597
|
+
# nokogumbo code uses C90/C99 features, let's make sure older compilers won't give
|
598
|
+
# errors/warnings. see #2302
|
599
|
+
append_cflags(["-std=c99", "-Wno-declaration-after-statement"])
|
600
|
+
|
597
601
|
# always include debugging information
|
598
602
|
append_cflags("-g")
|
599
603
|
|
data/ext/nokogiri/gumbo.c
CHANGED
@@ -75,7 +75,7 @@ new_html_doc(const char *dtd_name, const char *system, const char *public)
|
|
75
75
|
htmlDocPtr doc = htmlNewDocNoDtD(/* URI */ NULL, /* ExternalID */NULL);
|
76
76
|
assert(doc);
|
77
77
|
if (dtd_name) {
|
78
|
-
xmlCreateIntSubset(doc,
|
78
|
+
xmlCreateIntSubset(doc, (const xmlChar *)dtd_name, (const xmlChar *)public, (const xmlChar *)system);
|
79
79
|
}
|
80
80
|
return doc;
|
81
81
|
}
|
@@ -120,11 +120,11 @@ lookup_or_add_ns(
|
|
120
120
|
const char *prefix
|
121
121
|
)
|
122
122
|
{
|
123
|
-
xmlNsPtr ns = xmlSearchNs(doc, root,
|
123
|
+
xmlNsPtr ns = xmlSearchNs(doc, root, (const xmlChar *)prefix);
|
124
124
|
if (ns) {
|
125
125
|
return ns;
|
126
126
|
}
|
127
|
-
return xmlNewNs(root,
|
127
|
+
return xmlNewNs(root, (const xmlChar *)href, (const xmlChar *)prefix);
|
128
128
|
}
|
129
129
|
|
130
130
|
static void
|
@@ -181,20 +181,20 @@ build_tree(
|
|
181
181
|
|
182
182
|
case GUMBO_NODE_TEXT:
|
183
183
|
case GUMBO_NODE_WHITESPACE:
|
184
|
-
xml_child = xmlNewDocText(doc,
|
184
|
+
xml_child = xmlNewDocText(doc, (const xmlChar *)gumbo_child->v.text.text);
|
185
185
|
set_line(xml_child, gumbo_child->v.text.start_pos.line);
|
186
186
|
xmlAddChild(xml_node, xml_child);
|
187
187
|
break;
|
188
188
|
|
189
189
|
case GUMBO_NODE_CDATA:
|
190
|
-
xml_child = xmlNewCDataBlock(doc,
|
190
|
+
xml_child = xmlNewCDataBlock(doc, (const xmlChar *)gumbo_child->v.text.text,
|
191
191
|
(int) strlen(gumbo_child->v.text.text));
|
192
192
|
set_line(xml_child, gumbo_child->v.text.start_pos.line);
|
193
193
|
xmlAddChild(xml_node, xml_child);
|
194
194
|
break;
|
195
195
|
|
196
196
|
case GUMBO_NODE_COMMENT:
|
197
|
-
xml_child = xmlNewDocComment(doc,
|
197
|
+
xml_child = xmlNewDocComment(doc, (const xmlChar *)gumbo_child->v.text.text);
|
198
198
|
set_line(xml_child, gumbo_child->v.text.start_pos.line);
|
199
199
|
xmlAddChild(xml_node, xml_child);
|
200
200
|
break;
|
@@ -202,7 +202,7 @@ build_tree(
|
|
202
202
|
case GUMBO_NODE_TEMPLATE:
|
203
203
|
// XXX: Should create a template element and a new DocumentFragment
|
204
204
|
case GUMBO_NODE_ELEMENT: {
|
205
|
-
xml_child = xmlNewDocNode(doc, NULL,
|
205
|
+
xml_child = xmlNewDocNode(doc, NULL, (const xmlChar *)gumbo_child->v.element.name, NULL);
|
206
206
|
set_line(xml_child, gumbo_child->v.element.start_pos.line);
|
207
207
|
if (xml_root == NULL) {
|
208
208
|
xml_root = xml_child;
|
@@ -244,7 +244,7 @@ build_tree(
|
|
244
244
|
default:
|
245
245
|
ns = NULL;
|
246
246
|
}
|
247
|
-
xmlNewNsProp(xml_child, ns,
|
247
|
+
xmlNewNsProp(xml_child, ns, (const xmlChar *)attr->name, (const xmlChar *)attr->value);
|
248
248
|
}
|
249
249
|
|
250
250
|
// Add children for this element.
|
@@ -300,35 +300,10 @@ typedef struct {
|
|
300
300
|
xmlDocPtr doc;
|
301
301
|
} ParseArgs;
|
302
302
|
|
303
|
-
static void
|
304
|
-
parse_args_mark(void *parse_args)
|
305
|
-
{
|
306
|
-
ParseArgs *args = parse_args;
|
307
|
-
rb_gc_mark_maybe(args->input);
|
308
|
-
rb_gc_mark_maybe(args->url_or_frag);
|
309
|
-
}
|
310
|
-
|
311
|
-
// Wrap a ParseArgs pointer. The underlying ParseArgs must outlive the
|
312
|
-
// wrapper.
|
313
|
-
static VALUE
|
314
|
-
wrap_parse_args(ParseArgs *args)
|
315
|
-
{
|
316
|
-
return Data_Wrap_Struct(rb_cObject, parse_args_mark, RUBY_NEVER_FREE, args);
|
317
|
-
}
|
318
|
-
|
319
|
-
// Returnsd the underlying ParseArgs wrapped by wrap_parse_args.
|
320
|
-
static ParseArgs *
|
321
|
-
unwrap_parse_args(VALUE obj)
|
322
|
-
{
|
323
|
-
ParseArgs *args;
|
324
|
-
Data_Get_Struct(obj, ParseArgs, args);
|
325
|
-
return args;
|
326
|
-
}
|
327
|
-
|
328
303
|
static VALUE
|
329
304
|
parse_cleanup(VALUE parse_args)
|
330
305
|
{
|
331
|
-
ParseArgs *args =
|
306
|
+
ParseArgs *args = (ParseArgs *)parse_args;
|
332
307
|
gumbo_destroy_output(args->output);
|
333
308
|
// Make sure garbage collection doesn't mark the objects as being live based
|
334
309
|
// on references from the ParseArgs. This may be unnecessary.
|
@@ -360,15 +335,14 @@ parse(VALUE self, VALUE input, VALUE url, VALUE max_attributes, VALUE max_errors
|
|
360
335
|
.url_or_frag = url,
|
361
336
|
.doc = NULL,
|
362
337
|
};
|
363
|
-
VALUE parse_args = wrap_parse_args(&args);
|
364
338
|
|
365
|
-
return rb_ensure(parse_continue,
|
339
|
+
return rb_ensure(parse_continue, (VALUE)(&args), parse_cleanup, (VALUE)(&args));
|
366
340
|
}
|
367
341
|
|
368
342
|
static VALUE
|
369
343
|
parse_continue(VALUE parse_args)
|
370
344
|
{
|
371
|
-
ParseArgs *args =
|
345
|
+
ParseArgs *args = (ParseArgs *)parse_args;
|
372
346
|
GumboOutput *output = args->output;
|
373
347
|
xmlDocPtr doc;
|
374
348
|
if (output->document->v.document.has_doctype) {
|
@@ -571,15 +545,14 @@ error:
|
|
571
545
|
.url_or_frag = doc_fragment,
|
572
546
|
.doc = (xmlDocPtr)extract_xml_node(doc),
|
573
547
|
};
|
574
|
-
VALUE
|
575
|
-
rb_ensure(fragment_continue, parse_args, parse_cleanup, parse_args);
|
548
|
+
rb_ensure(fragment_continue, (VALUE)(&args), parse_cleanup, (VALUE)(&args));
|
576
549
|
return Qnil;
|
577
550
|
}
|
578
551
|
|
579
552
|
static VALUE
|
580
553
|
fragment_continue(VALUE parse_args)
|
581
554
|
{
|
582
|
-
ParseArgs *args =
|
555
|
+
ParseArgs *args = (ParseArgs *)parse_args;
|
583
556
|
GumboOutput *output = args->output;
|
584
557
|
VALUE doc_fragment = args->url_or_frag;
|
585
558
|
xmlDocPtr xml_doc = args->doc;
|
@@ -266,7 +266,7 @@ get_description(VALUE klass, VALUE tag_name)
|
|
266
266
|
);
|
267
267
|
|
268
268
|
if (NULL == description) { return Qnil; }
|
269
|
-
return Data_Wrap_Struct(klass, 0, 0, (void
|
269
|
+
return Data_Wrap_Struct(klass, 0, 0, DISCARD_CONST_QUAL(void *, description));
|
270
270
|
}
|
271
271
|
|
272
272
|
void
|
@@ -110,7 +110,8 @@ void
|
|
110
110
|
noko_init_html_sax_parser_context()
|
111
111
|
{
|
112
112
|
assert(cNokogiriXmlSaxParserContext);
|
113
|
-
cNokogiriHtml4SaxParserContext = rb_define_class_under(mNokogiriHtml4Sax, "ParserContext",
|
113
|
+
cNokogiriHtml4SaxParserContext = rb_define_class_under(mNokogiriHtml4Sax, "ParserContext",
|
114
|
+
cNokogiriXmlSaxParserContext);
|
114
115
|
|
115
116
|
rb_define_singleton_method(cNokogiriHtml4SaxParserContext, "memory", parse_memory, 2);
|
116
117
|
rb_define_singleton_method(cNokogiriHtml4SaxParserContext, "file", parse_file, 2);
|
data/ext/nokogiri/nokogiri.c
CHANGED
@@ -220,7 +220,7 @@ Init_nokogiri()
|
|
220
220
|
xmlInitParser();
|
221
221
|
exsltRegisterAll();
|
222
222
|
|
223
|
-
if (xsltExtModuleFunctionLookup((xmlChar*)"date-time", EXSLT_DATE_NAMESPACE)) {
|
223
|
+
if (xsltExtModuleFunctionLookup((const xmlChar *)"date-time", EXSLT_DATE_NAMESPACE)) {
|
224
224
|
rb_const_set(mNokogiri, rb_intern("LIBXSLT_DATETIME_ENABLED"), Qtrue);
|
225
225
|
} else {
|
226
226
|
rb_const_set(mNokogiri, rb_intern("LIBXSLT_DATETIME_ENABLED"), Qfalse);
|
data/ext/nokogiri/nokogiri.h
CHANGED
@@ -197,6 +197,9 @@ NOKOPUBFUN VALUE Nokogiri_wrap_xml_document(VALUE klass,
|
|
197
197
|
#define NOKOGIRI_SAX_TUPLE_NEW(_ctxt, _self) nokogiri_sax_tuple_new(_ctxt, _self)
|
198
198
|
#define NOKOGIRI_SAX_TUPLE_DESTROY(_tuple) free(_tuple)
|
199
199
|
|
200
|
+
#define DISCARD_CONST_QUAL(t, v) ((t)(uintptr_t)(v))
|
201
|
+
#define DISCARD_CONST_QUAL_XMLCHAR(v) DISCARD_CONST_QUAL(xmlChar *, v)
|
202
|
+
|
200
203
|
void Nokogiri_structured_error_func_save(libxmlStructuredErrorHandlerState *handler_state);
|
201
204
|
void Nokogiri_structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state, void *user_data,
|
202
205
|
xmlStructuredErrorFunc handler);
|
data/ext/nokogiri/xml_document.c
CHANGED
@@ -213,7 +213,7 @@ set_encoding(VALUE self, VALUE encoding)
|
|
213
213
|
Data_Get_Struct(self, xmlDoc, doc);
|
214
214
|
|
215
215
|
if (doc->encoding) {
|
216
|
-
|
216
|
+
xmlFree(DISCARD_CONST_QUAL_XMLCHAR(doc->encoding));
|
217
217
|
}
|
218
218
|
|
219
219
|
doc->encoding = xmlStrdup((xmlChar *)StringValueCStr(encoding));
|
@@ -33,10 +33,10 @@ dealloc_namespace(xmlNsPtr ns)
|
|
33
33
|
*/
|
34
34
|
NOKOGIRI_DEBUG_START(ns) ;
|
35
35
|
if (ns->href) {
|
36
|
-
xmlFree((
|
36
|
+
xmlFree(DISCARD_CONST_QUAL_XMLCHAR(ns->href));
|
37
37
|
}
|
38
38
|
if (ns->prefix) {
|
39
|
-
xmlFree((
|
39
|
+
xmlFree(DISCARD_CONST_QUAL_XMLCHAR(ns->prefix));
|
40
40
|
}
|
41
41
|
xmlFree(ns);
|
42
42
|
NOKOGIRI_DEBUG_END(ns) ;
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -304,7 +304,7 @@ ok:
|
|
304
304
|
* issue #391, where new node's prefix may become the string "default"
|
305
305
|
* see libxml2 tree.c xmlNewReconciliedNs which implements this behavior.
|
306
306
|
*/
|
307
|
-
xmlFree((
|
307
|
+
xmlFree(DISCARD_CONST_QUAL_XMLCHAR(reparentee->ns->prefix));
|
308
308
|
reparentee->ns->prefix = NULL;
|
309
309
|
}
|
310
310
|
}
|
@@ -934,7 +934,7 @@ get(VALUE self, VALUE rattribute)
|
|
934
934
|
Data_Get_Struct(self, xmlNode, node);
|
935
935
|
attribute = xmlCharStrdup(StringValueCStr(rattribute));
|
936
936
|
|
937
|
-
colon = (
|
937
|
+
colon = DISCARD_CONST_QUAL_XMLCHAR(xmlStrchr(attribute, (const xmlChar)':'));
|
938
938
|
if (colon) {
|
939
939
|
/* split the attribute string into separate prefix and name by
|
940
940
|
* null-terminating the prefix at the colon */
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/nokogiri/extension.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# load the C or Java extension
|
4
4
|
begin
|
5
|
+
# native precompiled gems package shared libraries in <gem_dir>/lib/nokogiri/<ruby_version>
|
5
6
|
::RUBY_VERSION =~ /(\d+\.\d+)/
|
6
7
|
require_relative "#{Regexp.last_match(1)}/nokogiri"
|
7
8
|
rescue LoadError => e
|
@@ -22,5 +23,9 @@ rescue LoadError => e
|
|
22
23
|
EOM
|
23
24
|
raise e
|
24
25
|
end
|
25
|
-
|
26
|
+
|
27
|
+
# use "require" instead of "require_relative" because non-native gems will place C extension files
|
28
|
+
# in Gem::BasicSpecification#extension_dir after compilation (during normal installation), which
|
29
|
+
# is in $LOAD_PATH but not necessarily relative to this file (see #2300)
|
30
|
+
require "nokogiri/nokogiri"
|
26
31
|
end
|
data/lib/nokogiri/html5.rb
CHANGED
@@ -53,9 +53,9 @@ module Nokogiri
|
|
53
53
|
#
|
54
54
|
# === Error reporting
|
55
55
|
#
|
56
|
-
#
|
57
|
-
# are reported but this can be configured by passing the +:max_errors+ option to
|
58
|
-
# {HTML5.fragment}.
|
56
|
+
# Nokogiri contains an experimental HTML5 parse error reporting facility. By default, no parse
|
57
|
+
# errors are reported but this can be configured by passing the +:max_errors+ option to
|
58
|
+
# {HTML5.parse} or {HTML5.fragment}.
|
59
59
|
#
|
60
60
|
# For example, this script:
|
61
61
|
#
|
@@ -88,7 +88,7 @@ module Nokogiri
|
|
88
88
|
# parsing HTML. The parse errors in the "tree construction" stage do not have standardized error
|
89
89
|
# codes (yet).
|
90
90
|
#
|
91
|
-
# As a convenience to
|
91
|
+
# As a convenience to Nokogiri users, the defined error codes are available via
|
92
92
|
# {Nokogiri::XML::SyntaxError#str1} method.
|
93
93
|
#
|
94
94
|
# doc = Nokogiri::HTML5.parse('<span/>Hi there!</span foo=bar />', max_errors: 10)
|
@@ -104,7 +104,7 @@ module Nokogiri
|
|
104
104
|
# stage and doesn't have a standardized error code.
|
105
105
|
#
|
106
106
|
# For the purposes of semantic versioning, the error messages, error locations, and error codes
|
107
|
-
# are not part of
|
107
|
+
# are not part of Nokogiri's public API. That is, these are subject to change without Nokogiri's
|
108
108
|
# major version number changing. These may be stabilized in the future.
|
109
109
|
#
|
110
110
|
# === Maximum tree depth
|
@@ -113,8 +113,8 @@ module Nokogiri
|
|
113
113
|
# +:max_tree_depth+ option. If the depth of the tree would exceed this limit, then an
|
114
114
|
# {::ArgumentError} is thrown.
|
115
115
|
#
|
116
|
-
# This limit (which defaults to <tt>
|
117
|
-
# by giving the option <tt>max_tree_depth: -1</tt>.
|
116
|
+
# This limit (which defaults to <tt>Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH = 400</tt>) can be
|
117
|
+
# removed by giving the option <tt>max_tree_depth: -1</tt>.
|
118
118
|
#
|
119
119
|
# html = '<!DOCTYPE html>' + '<div>' * 1000
|
120
120
|
# doc = Nokogiri.HTML5(html)
|
@@ -126,8 +126,8 @@ module Nokogiri
|
|
126
126
|
# The maximum number of attributes per DOM element is configurable by the +:max_attributes+
|
127
127
|
# option. If a given element would exceed this limit, then an {::ArgumentError} is thrown.
|
128
128
|
#
|
129
|
-
# This limit (which defaults to <tt>
|
130
|
-
# by giving the option <tt>max_attributes: -1</tt>.
|
129
|
+
# This limit (which defaults to <tt>Nokogiri::Gumbo::DEFAULT_MAX_ATTRIBUTES = 400</tt>) can be
|
130
|
+
# removed by giving the option <tt>max_attributes: -1</tt>.
|
131
131
|
#
|
132
132
|
# html = '<!DOCTYPE html><div ' + (1..1000).map { |x| "attr-#{x}" }.join(' ') + '>'
|
133
133
|
# # "<!DOCTYPE html><div attr-1 attr-2 attr-3 ... attr-1000>"
|
@@ -182,7 +182,7 @@ module Nokogiri
|
|
182
182
|
#
|
183
183
|
# == Encodings
|
184
184
|
#
|
185
|
-
#
|
185
|
+
# Nokogiri always parses HTML5 using {https://en.wikipedia.org/wiki/UTF-8 UTF-8}; however, the
|
186
186
|
# encoding of the input can be explicitly selected via the optional +encoding+ parameter. This is
|
187
187
|
# most useful when the input comes not from a string but from an IO object.
|
188
188
|
#
|
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.12.
|
4
|
+
version: 1.12.3
|
5
5
|
platform: x86-linux
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
@@ -20,7 +20,7 @@ authors:
|
|
20
20
|
autorequire:
|
21
21
|
bindir: bin
|
22
22
|
cert_chain: []
|
23
|
-
date: 2021-
|
23
|
+
date: 2021-08-10 00:00:00.000000000 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: racc
|
@@ -456,9 +456,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
456
456
|
version: 3.1.dev
|
457
457
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
458
458
|
requirements:
|
459
|
-
- - "
|
459
|
+
- - ">="
|
460
460
|
- !ruby/object:Gem::Version
|
461
|
-
version:
|
461
|
+
version: '0'
|
462
462
|
requirements: []
|
463
463
|
rubygems_version: 3.2.3
|
464
464
|
signing_key:
|