nokogiri 1.11.0-x86-linux → 1.11.1-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d1976c09bf456fba53439d4e45e24e42341cc22d891600ad9732a0e77c728da
4
- data.tar.gz: 334a2a56e23f813e52e75a28659f1ef09b69972ccc4956ddd5ec3b257a4ccfae
3
+ metadata.gz: 59f84db1e9fc9830e5d944f6dcb726969eb9f4f19b47e6a2bf9837575859e8c0
4
+ data.tar.gz: 94efed916a65c193c8819e1e42c484da77e4dc7a76c5b398feceebfc1ac2a9d7
5
5
  SHA512:
6
- metadata.gz: c631bede17614addda390a00a8a552cd99fb6b0451684169fa58cc14383fe2e2af11f2e1bf7e20effb7ce7f5eb3f65a095ae77ee02c6dd84c55c72ef79f3d266
7
- data.tar.gz: e2eb955b5bb57871af845e6db531436ca70cf9e7c20b64cc18c6efbc22dd28b1df01e3cbebfd41a95ce7ffe76828efe4eb7d0f5ce2dfeb8e4352af93b30d31c8
6
+ metadata.gz: 9d46b193f21983ebcfcec85ddf8b82a8256e551e69f8d53f1e558b42f6f7965d597a70c0f350ffbaa577e98d3b2e7bd247473b0a6d8a868bf04dae9021f218ad
7
+ data.tar.gz: 316c4d564caecfdd54a472eb3b2c343040fca7a71a0fafb8df32f4fd3970c5b4362eba0020e45cc758c90915419e62106220ce3b22d0bfd1901d2decd5d3a9a0
@@ -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 = NULL;
13
- int size = 0;
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
- if(htmlParseChunk(ctx, chunk, size, Qtrue == _last_chunk ? 1 : 0)) {
24
- if (!(ctx->options & XML_PARSE_RECOVER)) {
25
- xmlErrorPtr e = xmlCtxtGetLastError(ctx);
26
- Nokogiri_error_raise(NULL, e);
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;
@@ -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 * ctx, xmlErrorPtr error);
9
- NORETURN(void Nokogiri_error_raise(void * ctx, xmlErrorPtr error));
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Nokogiri
3
3
  # The version of Nokogiri you are using
4
- VERSION = "1.11.0"
4
+ VERSION = "1.11.1"
5
5
  end
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.0
4
+ version: 1.11.1
5
5
  platform: x86-linux
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-04 00:00:00.000000000 Z
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: '0.88'
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: '0.88'
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