nokogiri 1.11.0-x64-mingw32 → 1.11.1-x64-mingw32
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/html_sax_parser_context.c +2 -0
- data/ext/nokogiri/html_sax_push_parser.c +14 -8
- data/ext/nokogiri/nokogiri.c +3 -0
- data/ext/nokogiri/test_global_handlers.c +41 -0
- data/ext/nokogiri/xml_sax_parser_context.c +2 -0
- data/ext/nokogiri/xml_sax_push_parser.c +2 -0
- data/ext/nokogiri/xml_syntax_error.c +23 -0
- data/ext/nokogiri/xml_syntax_error.h +15 -3
- 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/version/constant.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9f36f2ec9650e5f3cfc4bee5e531cf0e46e0aa084591f30d442bff9adb5b485
|
4
|
+
data.tar.gz: 371cb26870ff8bc5970d5d8b06ced66d685c0c9a712c503ece440a9b0eae6610
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fd20339664d3dd51f07bf83aa548d5963930cbd61139ebd129781105cc7affde9b9c4d011f6132d1966aac8a6c57cff1c9bcf55c025bb50e0b0103c7e8273e2
|
7
|
+
data.tar.gz: fa55ca1bc12f96b652a91acdbde5c4c01aed8ee3ace35da77087fe8c432c46d21d8fc104df709c204c44d56ac6f78394963233a22b460438611149c99294aaaa
|
@@ -92,6 +92,8 @@ parse_with(VALUE self, VALUE sax_handler)
|
|
92
92
|
ctxt->sax = sax;
|
93
93
|
ctxt->userData = (void *)NOKOGIRI_SAX_TUPLE_NEW(ctxt, sax_handler);
|
94
94
|
|
95
|
+
xmlSetStructuredErrorFunc(NULL, NULL);
|
96
|
+
|
95
97
|
rb_ensure(parse_doc, (VALUE)ctxt, parse_doc_finalize, (VALUE)ctxt);
|
96
98
|
|
97
99
|
return self;
|
@@ -9,9 +9,10 @@
|
|
9
9
|
static VALUE native_write(VALUE self, VALUE _chunk, VALUE _last_chunk)
|
10
10
|
{
|
11
11
|
xmlParserCtxtPtr ctx;
|
12
|
-
const char * chunk
|
13
|
-
int size
|
14
|
-
|
12
|
+
const char * chunk = NULL;
|
13
|
+
int size = 0;
|
14
|
+
int status = 0;
|
15
|
+
libxmlStructuredErrorHandlerState handler_state;
|
15
16
|
|
16
17
|
Data_Get_Struct(self, xmlParserCtxt, ctx);
|
17
18
|
|
@@ -20,11 +21,16 @@ static VALUE native_write(VALUE self, VALUE _chunk, VALUE _last_chunk)
|
|
20
21
|
size = (int)RSTRING_LEN(_chunk);
|
21
22
|
}
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
Nokogiri_structured_error_func_save_and_set(&handler_state, NULL, NULL);
|
25
|
+
|
26
|
+
status = htmlParseChunk(ctx, chunk, size, Qtrue == _last_chunk ? 1 : 0);
|
27
|
+
|
28
|
+
Nokogiri_structured_error_func_restore(&handler_state);
|
29
|
+
|
30
|
+
if ((status != 0) && !(ctx->options & XML_PARSE_RECOVER)) {
|
31
|
+
// TODO: there appear to be no tests for this block
|
32
|
+
xmlErrorPtr e = xmlCtxtGetLastError(ctx);
|
33
|
+
Nokogiri_error_raise(NULL, e);
|
28
34
|
}
|
29
35
|
|
30
36
|
return self;
|
data/ext/nokogiri/nokogiri.c
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#include <nokogiri.h>
|
2
2
|
|
3
|
+
void init_test_global_handlers(); /* in lieu of test_global_handlers.h */
|
4
|
+
|
3
5
|
VALUE mNokogiri ;
|
4
6
|
VALUE mNokogiriXml ;
|
5
7
|
VALUE mNokogiriHtml ;
|
@@ -132,4 +134,5 @@ void Init_nokogiri()
|
|
132
134
|
init_xml_relax_ng();
|
133
135
|
init_nokogiri_io();
|
134
136
|
init_xml_encoding_handler();
|
137
|
+
init_test_global_handlers();
|
135
138
|
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#include <nokogiri.h>
|
2
|
+
#include "libxml/xmlerror.h"
|
3
|
+
|
4
|
+
static VALUE foreign_error_handler_block = Qnil;
|
5
|
+
|
6
|
+
static void foreign_error_handler(void* user_data, xmlErrorPtr c_error)
|
7
|
+
{
|
8
|
+
rb_funcall(foreign_error_handler_block, rb_intern("call"), 0);
|
9
|
+
}
|
10
|
+
|
11
|
+
/*
|
12
|
+
* call-seq:
|
13
|
+
* __foreign_error_handler { ... } -> nil
|
14
|
+
*
|
15
|
+
* Override libxml2's global error handlers to call the block. This method thus has very little
|
16
|
+
* value except to test that Nokogiri is properly setting error handlers elsewhere in the code. See
|
17
|
+
* test/helper.rb for how this is being used.
|
18
|
+
*/
|
19
|
+
static VALUE
|
20
|
+
rb_foreign_error_handler(VALUE klass)
|
21
|
+
{
|
22
|
+
rb_need_block();
|
23
|
+
foreign_error_handler_block = rb_block_proc();
|
24
|
+
xmlSetStructuredErrorFunc(NULL, foreign_error_handler);
|
25
|
+
return Qnil;
|
26
|
+
}
|
27
|
+
|
28
|
+
/*
|
29
|
+
* Document-module: Nokogiri::Test
|
30
|
+
*
|
31
|
+
* The Nokogiri::Test module should only be used for testing Nokogiri.
|
32
|
+
* Do NOT use this outside of the Nokogiri test suite.
|
33
|
+
*/
|
34
|
+
void
|
35
|
+
init_test_global_handlers()
|
36
|
+
{
|
37
|
+
VALUE mNokogiri = rb_define_module("Nokogiri");
|
38
|
+
VALUE mNokogiriTest = rb_define_module_under(mNokogiri, "Test");
|
39
|
+
|
40
|
+
rb_define_singleton_method(mNokogiriTest, "__foreign_error_handler", rb_foreign_error_handler, 0);
|
41
|
+
}
|
@@ -120,6 +120,8 @@ parse_with(VALUE self, VALUE sax_handler)
|
|
120
120
|
ctxt->sax = sax;
|
121
121
|
ctxt->userData = (void *)NOKOGIRI_SAX_TUPLE_NEW(ctxt, sax_handler);
|
122
122
|
|
123
|
+
xmlSetStructuredErrorFunc(NULL, NULL);
|
124
|
+
|
123
125
|
rb_ensure(parse_doc, (VALUE)ctxt, parse_doc_finalize, (VALUE)ctxt);
|
124
126
|
|
125
127
|
return Qnil;
|
@@ -35,6 +35,8 @@ static VALUE native_write(VALUE self, VALUE _chunk, VALUE _last_chunk)
|
|
35
35
|
size = (int)RSTRING_LEN(_chunk);
|
36
36
|
}
|
37
37
|
|
38
|
+
xmlSetStructuredErrorFunc(NULL, NULL);
|
39
|
+
|
38
40
|
if (xmlParseChunk(ctx, chunk, size, Qtrue == _last_chunk ? 1 : 0)) {
|
39
41
|
if (!(ctx->options & XML_PARSE_RECOVER)) {
|
40
42
|
xmlErrorPtr e = xmlCtxtGetLastError(ctx);
|
@@ -1,5 +1,28 @@
|
|
1
1
|
#include <xml_syntax_error.h>
|
2
2
|
|
3
|
+
void
|
4
|
+
Nokogiri_structured_error_func_save(libxmlStructuredErrorHandlerState *handler_state)
|
5
|
+
{
|
6
|
+
/* this method is tightly coupled to the implementation of xmlSetStructuredErrorFunc */
|
7
|
+
handler_state->user_data = xmlStructuredErrorContext;
|
8
|
+
handler_state->handler = xmlStructuredError;
|
9
|
+
}
|
10
|
+
|
11
|
+
void
|
12
|
+
Nokogiri_structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state,
|
13
|
+
void *user_data,
|
14
|
+
xmlStructuredErrorFunc handler)
|
15
|
+
{
|
16
|
+
Nokogiri_structured_error_func_save(handler_state);
|
17
|
+
xmlSetStructuredErrorFunc(user_data, handler);
|
18
|
+
}
|
19
|
+
|
20
|
+
void
|
21
|
+
Nokogiri_structured_error_func_restore(libxmlStructuredErrorHandlerState *handler_state)
|
22
|
+
{
|
23
|
+
xmlSetStructuredErrorFunc(handler_state->user_data, handler_state->handler);
|
24
|
+
}
|
25
|
+
|
3
26
|
void Nokogiri_error_array_pusher(void * ctx, xmlErrorPtr error)
|
4
27
|
{
|
5
28
|
VALUE list = (VALUE)ctx;
|
@@ -3,11 +3,23 @@
|
|
3
3
|
|
4
4
|
#include <nokogiri.h>
|
5
5
|
|
6
|
+
typedef struct _libxmlStructuredErrorHandlerState {
|
7
|
+
void *user_data;
|
8
|
+
xmlStructuredErrorFunc handler;
|
9
|
+
} libxmlStructuredErrorHandlerState ;
|
10
|
+
|
6
11
|
void init_xml_syntax_error();
|
12
|
+
|
13
|
+
void Nokogiri_structured_error_func_save(libxmlStructuredErrorHandlerState *handler_state);
|
14
|
+
void Nokogiri_structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state,
|
15
|
+
void *user_data,
|
16
|
+
xmlStructuredErrorFunc handler);
|
17
|
+
void Nokogiri_structured_error_func_restore(libxmlStructuredErrorHandlerState *handler_state);
|
18
|
+
|
7
19
|
VALUE Nokogiri_wrap_xml_syntax_error(xmlErrorPtr error);
|
8
|
-
void Nokogiri_error_array_pusher(void *
|
9
|
-
NORETURN(void Nokogiri_error_raise(void *
|
20
|
+
void Nokogiri_error_array_pusher(void *ctx, xmlErrorPtr error);
|
21
|
+
NORETURN(void Nokogiri_error_raise(void *ctx, xmlErrorPtr error));
|
10
22
|
|
11
23
|
extern VALUE cNokogiriXmlSyntaxError;
|
12
|
-
#endif
|
13
24
|
|
25
|
+
#endif /* NOKOGIRI_XML_SYNTAX_ERROR */
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
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.11.
|
4
|
+
version: 1.11.1
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date: 2021-01-
|
20
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: racc
|
@@ -165,14 +165,14 @@ dependencies:
|
|
165
165
|
requirements:
|
166
166
|
- - "~>"
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version: '
|
168
|
+
version: '1.7'
|
169
169
|
type: :development
|
170
170
|
prerelease: false
|
171
171
|
version_requirements: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
173
|
- - "~>"
|
174
174
|
- !ruby/object:Gem::Version
|
175
|
-
version: '
|
175
|
+
version: '1.7'
|
176
176
|
- !ruby/object:Gem::Dependency
|
177
177
|
name: simplecov
|
178
178
|
requirement: !ruby/object:Gem::Requirement
|
@@ -237,6 +237,7 @@ extra_rdoc_files:
|
|
237
237
|
- ext/nokogiri/html_sax_push_parser.c
|
238
238
|
- ext/nokogiri/xml_relax_ng.c
|
239
239
|
- ext/nokogiri/xml_entity_decl.c
|
240
|
+
- ext/nokogiri/test_global_handlers.c
|
240
241
|
- ext/nokogiri/xml_node.c
|
241
242
|
- ext/nokogiri/xml_entity_reference.c
|
242
243
|
- ext/nokogiri/xslt_stylesheet.c
|
@@ -337,6 +338,7 @@ files:
|
|
337
338
|
- ext/nokogiri/include/libxslt/xsltutils.h
|
338
339
|
- ext/nokogiri/nokogiri.c
|
339
340
|
- ext/nokogiri/nokogiri.h
|
341
|
+
- ext/nokogiri/test_global_handlers.c
|
340
342
|
- ext/nokogiri/xml_attr.c
|
341
343
|
- ext/nokogiri/xml_attr.h
|
342
344
|
- ext/nokogiri/xml_attribute_decl.c
|