nokogiri 1.11.0-java → 1.11.1-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/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/lib/nokogiri/nokogiri.jar +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: 7d85f8024902ba0c8e8000b2e697368ccd2b5f3cb24daa6d2696baf09ca8efeb
|
4
|
+
data.tar.gz: a34653303414cf3670c64ba5e820d804efa566575b6e6fd0372c587da253e96f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d402f90c16cfbecb8746b9afa8b918735c083b1d6363a86d313911a3329fc936ac9fc2ac12122d2fe21c49d212ba95d7b09d2309dd69ea713afb16e7e5f79814
|
7
|
+
data.tar.gz: ec647fdf9fe11f57374ed845cd5cafded912b3ec239cf72cf7a08621772166bb5c9386b271e5513925f0d6ee63d0877629d0c83b721a66fa872df3500c548c69
|
@@ -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;
|
data/lib/nokogiri/nokogiri.jar
CHANGED
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: java
|
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
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,7 +164,7 @@ dependencies:
|
|
164
164
|
requirements:
|
165
165
|
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version: '
|
167
|
+
version: '1.7'
|
168
168
|
name: rubocop
|
169
169
|
type: :development
|
170
170
|
prerelease: false
|
@@ -172,7 +172,7 @@ dependencies:
|
|
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
|
requirement: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
@@ -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
|
@@ -347,6 +348,7 @@ files:
|
|
347
348
|
- ext/nokogiri/html_sax_parser_context.c
|
348
349
|
- ext/nokogiri/html_sax_push_parser.c
|
349
350
|
- ext/nokogiri/nokogiri.c
|
351
|
+
- ext/nokogiri/test_global_handlers.c
|
350
352
|
- ext/nokogiri/xml_attr.c
|
351
353
|
- ext/nokogiri/xml_attribute_decl.c
|
352
354
|
- ext/nokogiri/xml_cdata.c
|