nokogiri 1.10.3 → 1.11.4

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.

Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/LICENSE-DEPENDENCIES.md +1015 -947
  4. data/LICENSE.md +1 -1
  5. data/README.md +173 -94
  6. data/dependencies.yml +28 -26
  7. data/ext/nokogiri/depend +37 -358
  8. data/ext/nokogiri/extconf.rb +611 -391
  9. data/ext/nokogiri/html_document.c +78 -82
  10. data/ext/nokogiri/html_element_description.c +84 -71
  11. data/ext/nokogiri/html_entity_lookup.c +21 -16
  12. data/ext/nokogiri/html_sax_parser_context.c +69 -66
  13. data/ext/nokogiri/html_sax_push_parser.c +42 -34
  14. data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
  15. data/ext/nokogiri/nokogiri.c +192 -87
  16. data/ext/nokogiri/nokogiri.h +181 -89
  17. data/ext/nokogiri/test_global_handlers.c +40 -0
  18. data/ext/nokogiri/xml_attr.c +15 -15
  19. data/ext/nokogiri/xml_attribute_decl.c +18 -18
  20. data/ext/nokogiri/xml_cdata.c +13 -18
  21. data/ext/nokogiri/xml_comment.c +19 -26
  22. data/ext/nokogiri/xml_document.c +255 -183
  23. data/ext/nokogiri/xml_document_fragment.c +13 -15
  24. data/ext/nokogiri/xml_dtd.c +54 -48
  25. data/ext/nokogiri/xml_element_content.c +30 -27
  26. data/ext/nokogiri/xml_element_decl.c +22 -22
  27. data/ext/nokogiri/xml_encoding_handler.c +17 -11
  28. data/ext/nokogiri/xml_entity_decl.c +32 -30
  29. data/ext/nokogiri/xml_entity_reference.c +16 -18
  30. data/ext/nokogiri/xml_namespace.c +56 -49
  31. data/ext/nokogiri/xml_node.c +387 -316
  32. data/ext/nokogiri/xml_node_set.c +168 -156
  33. data/ext/nokogiri/xml_processing_instruction.c +17 -19
  34. data/ext/nokogiri/xml_reader.c +195 -172
  35. data/ext/nokogiri/xml_relax_ng.c +52 -28
  36. data/ext/nokogiri/xml_sax_parser.c +118 -118
  37. data/ext/nokogiri/xml_sax_parser_context.c +103 -86
  38. data/ext/nokogiri/xml_sax_push_parser.c +36 -27
  39. data/ext/nokogiri/xml_schema.c +111 -34
  40. data/ext/nokogiri/xml_syntax_error.c +42 -21
  41. data/ext/nokogiri/xml_text.c +13 -17
  42. data/ext/nokogiri/xml_xpath_context.c +206 -123
  43. data/ext/nokogiri/xslt_stylesheet.c +158 -165
  44. data/lib/nokogiri/css/node.rb +1 -0
  45. data/lib/nokogiri/css/parser.rb +63 -62
  46. data/lib/nokogiri/css/parser.y +2 -2
  47. data/lib/nokogiri/css/parser_extras.rb +39 -36
  48. data/lib/nokogiri/css/syntax_error.rb +1 -0
  49. data/lib/nokogiri/css/tokenizer.rb +105 -103
  50. data/lib/nokogiri/css/xpath_visitor.rb +73 -43
  51. data/lib/nokogiri/css.rb +1 -0
  52. data/lib/nokogiri/decorators/slop.rb +1 -0
  53. data/lib/nokogiri/extension.rb +26 -0
  54. data/lib/nokogiri/html/builder.rb +1 -0
  55. data/lib/nokogiri/html/document.rb +13 -26
  56. data/lib/nokogiri/html/document_fragment.rb +16 -15
  57. data/lib/nokogiri/html/element_description.rb +1 -0
  58. data/lib/nokogiri/html/element_description_defaults.rb +1 -0
  59. data/lib/nokogiri/html/entity_lookup.rb +1 -0
  60. data/lib/nokogiri/html/sax/parser.rb +1 -0
  61. data/lib/nokogiri/html/sax/parser_context.rb +1 -0
  62. data/lib/nokogiri/html/sax/push_parser.rb +1 -0
  63. data/lib/nokogiri/html.rb +1 -0
  64. data/lib/nokogiri/jruby/dependencies.rb +20 -0
  65. data/lib/nokogiri/syntax_error.rb +1 -0
  66. data/lib/nokogiri/version/constant.rb +5 -0
  67. data/lib/nokogiri/version/info.rb +205 -0
  68. data/lib/nokogiri/version.rb +3 -109
  69. data/lib/nokogiri/xml/attr.rb +1 -0
  70. data/lib/nokogiri/xml/attribute_decl.rb +1 -0
  71. data/lib/nokogiri/xml/builder.rb +36 -32
  72. data/lib/nokogiri/xml/cdata.rb +1 -0
  73. data/lib/nokogiri/xml/character_data.rb +1 -0
  74. data/lib/nokogiri/xml/document.rb +92 -41
  75. data/lib/nokogiri/xml/document_fragment.rb +5 -6
  76. data/lib/nokogiri/xml/dtd.rb +1 -0
  77. data/lib/nokogiri/xml/element_content.rb +1 -0
  78. data/lib/nokogiri/xml/element_decl.rb +1 -0
  79. data/lib/nokogiri/xml/entity_decl.rb +1 -0
  80. data/lib/nokogiri/xml/entity_reference.rb +1 -0
  81. data/lib/nokogiri/xml/namespace.rb +1 -0
  82. data/lib/nokogiri/xml/node/save_options.rb +1 -0
  83. data/lib/nokogiri/xml/node.rb +625 -290
  84. data/lib/nokogiri/xml/node_set.rb +1 -0
  85. data/lib/nokogiri/xml/notation.rb +1 -0
  86. data/lib/nokogiri/xml/parse_options.rb +10 -3
  87. data/lib/nokogiri/xml/pp/character_data.rb +1 -0
  88. data/lib/nokogiri/xml/pp/node.rb +1 -0
  89. data/lib/nokogiri/xml/pp.rb +1 -0
  90. data/lib/nokogiri/xml/processing_instruction.rb +1 -0
  91. data/lib/nokogiri/xml/reader.rb +9 -12
  92. data/lib/nokogiri/xml/relax_ng.rb +7 -2
  93. data/lib/nokogiri/xml/sax/document.rb +1 -0
  94. data/lib/nokogiri/xml/sax/parser.rb +1 -0
  95. data/lib/nokogiri/xml/sax/parser_context.rb +1 -0
  96. data/lib/nokogiri/xml/sax/push_parser.rb +1 -0
  97. data/lib/nokogiri/xml/sax.rb +1 -0
  98. data/lib/nokogiri/xml/schema.rb +13 -4
  99. data/lib/nokogiri/xml/searchable.rb +25 -16
  100. data/lib/nokogiri/xml/syntax_error.rb +1 -0
  101. data/lib/nokogiri/xml/text.rb +1 -0
  102. data/lib/nokogiri/xml/xpath/syntax_error.rb +2 -1
  103. data/lib/nokogiri/xml/xpath.rb +2 -3
  104. data/lib/nokogiri/xml/xpath_context.rb +1 -0
  105. data/lib/nokogiri/xml.rb +1 -0
  106. data/lib/nokogiri/xslt/stylesheet.rb +1 -0
  107. data/lib/nokogiri/xslt.rb +1 -0
  108. data/lib/nokogiri.rb +6 -27
  109. data/lib/xsd/xmlparser/nokogiri.rb +1 -0
  110. data/patches/libxml2/{0002-Remove-script-macro-support.patch → 0001-Remove-script-macro-support.patch} +0 -0
  111. data/patches/libxml2/{0003-Update-entities-to-remove-handling-of-ssi.patch → 0002-Update-entities-to-remove-handling-of-ssi.patch} +0 -0
  112. data/patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch +25 -0
  113. data/patches/libxml2/0004-use-glibc-strlen.patch +53 -0
  114. data/patches/libxml2/0005-avoid-isnan-isinf.patch +81 -0
  115. data/patches/libxml2/0006-update-automake-files-for-arm64.patch +2511 -0
  116. data/patches/libxslt/0001-update-automake-files-for-arm64.patch +2511 -0
  117. data/patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch +19 -0
  118. data/ports/archives/libxml2-2.9.12.tar.gz +0 -0
  119. data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
  120. metadata +102 -147
  121. data/ext/nokogiri/html_document.h +0 -10
  122. data/ext/nokogiri/html_element_description.h +0 -10
  123. data/ext/nokogiri/html_entity_lookup.h +0 -8
  124. data/ext/nokogiri/html_sax_parser_context.h +0 -11
  125. data/ext/nokogiri/html_sax_push_parser.h +0 -9
  126. data/ext/nokogiri/xml_attr.h +0 -9
  127. data/ext/nokogiri/xml_attribute_decl.h +0 -9
  128. data/ext/nokogiri/xml_cdata.h +0 -9
  129. data/ext/nokogiri/xml_comment.h +0 -9
  130. data/ext/nokogiri/xml_document.h +0 -23
  131. data/ext/nokogiri/xml_document_fragment.h +0 -10
  132. data/ext/nokogiri/xml_dtd.h +0 -10
  133. data/ext/nokogiri/xml_element_content.h +0 -10
  134. data/ext/nokogiri/xml_element_decl.h +0 -9
  135. data/ext/nokogiri/xml_encoding_handler.h +0 -8
  136. data/ext/nokogiri/xml_entity_decl.h +0 -10
  137. data/ext/nokogiri/xml_entity_reference.h +0 -9
  138. data/ext/nokogiri/xml_io.c +0 -61
  139. data/ext/nokogiri/xml_io.h +0 -11
  140. data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
  141. data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
  142. data/ext/nokogiri/xml_namespace.h +0 -14
  143. data/ext/nokogiri/xml_node.h +0 -13
  144. data/ext/nokogiri/xml_node_set.h +0 -12
  145. data/ext/nokogiri/xml_processing_instruction.h +0 -9
  146. data/ext/nokogiri/xml_reader.h +0 -10
  147. data/ext/nokogiri/xml_relax_ng.h +0 -9
  148. data/ext/nokogiri/xml_sax_parser.h +0 -39
  149. data/ext/nokogiri/xml_sax_parser_context.h +0 -10
  150. data/ext/nokogiri/xml_sax_push_parser.h +0 -9
  151. data/ext/nokogiri/xml_schema.h +0 -9
  152. data/ext/nokogiri/xml_syntax_error.h +0 -13
  153. data/ext/nokogiri/xml_text.h +0 -9
  154. data/ext/nokogiri/xml_xpath_context.h +0 -10
  155. data/ext/nokogiri/xslt_stylesheet.h +0 -14
  156. data/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch +0 -78
  157. data/patches/libxslt/0001-Fix-security-framework-bypass.patch +0 -120
  158. data/ports/archives/libxml2-2.9.9.tar.gz +0 -0
  159. data/ports/archives/libxslt-1.1.33.tar.gz +0 -0
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ELEMENT_CONTENT
2
- #define NOKOGIRI_XML_ELEMENT_CONTENT
3
-
4
- #include <nokogiri.h>
5
-
6
-
7
- VALUE Nokogiri_wrap_element_content(VALUE doc, xmlElementContentPtr element);
8
- void init_xml_element_content();
9
-
10
- #endif
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ELEMENT_DECL
2
- #define NOKOGIRI_XML_ELEMENT_DECL
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_element_decl();
7
-
8
- extern VALUE cNokogiriXmlElementDecl;
9
- #endif
@@ -1,8 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ENCODING_HANDLER
2
- #define NOKOGIRI_XML_ENCODING_HANDLER
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_encoding_handler();
7
-
8
- #endif
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ENTITY_DECL
2
- #define NOKOGIRI_XML_ENTITY_DECL
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_entity_decl();
7
-
8
- extern VALUE cNokogiriXmlEntityDecl;
9
- #endif
10
-
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_ENTITY_REFERENCE
2
- #define NOKOGIRI_XML_ENTITY_REFERENCE
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_entity_reference();
7
-
8
- extern VALUE cNokogiriXmlEntityReference;
9
- #endif
@@ -1,61 +0,0 @@
1
- #include <xml_io.h>
2
-
3
- static ID id_read, id_write;
4
-
5
- VALUE read_check(VALUE *args) {
6
- return rb_funcall(args[0], id_read, 1, args[1]);
7
- }
8
-
9
- VALUE read_failed(void) {
10
- return Qundef;
11
- }
12
-
13
- int io_read_callback(void * ctx, char * buffer, int len) {
14
- VALUE string, args[2];
15
- size_t str_len, safe_len;
16
-
17
- args[0] = (VALUE)ctx;
18
- args[1] = INT2NUM(len);
19
-
20
- string = rb_rescue(read_check, (VALUE)args, read_failed, 0);
21
-
22
- if (NIL_P(string)) return 0;
23
- if (string == Qundef) return -1;
24
- if (TYPE(string) != T_STRING) return -1;
25
-
26
- str_len = (size_t)RSTRING_LEN(string);
27
- safe_len = str_len > (size_t)len ? (size_t)len : str_len;
28
- memcpy(buffer, StringValuePtr(string), safe_len);
29
-
30
- return (int)safe_len;
31
- }
32
-
33
- VALUE write_check(VALUE *args) {
34
- return rb_funcall(args[0], id_write, 1, args[1]);
35
- }
36
-
37
- VALUE write_failed(void) {
38
- return Qundef;
39
- }
40
-
41
- int io_write_callback(void * ctx, char * buffer, int len) {
42
- VALUE args[2], size;
43
-
44
- args[0] = (VALUE)ctx;
45
- args[1] = rb_str_new(buffer, (long)len);
46
-
47
- size = rb_rescue(write_check, (VALUE)args, write_failed, 0);
48
-
49
- if (size == Qundef) return -1;
50
-
51
- return NUM2INT(size);
52
- }
53
-
54
- int io_close_callback(void * ctx) {
55
- return 0;
56
- }
57
-
58
- void init_nokogiri_io() {
59
- id_read = rb_intern("read");
60
- id_write = rb_intern("write");
61
- }
@@ -1,11 +0,0 @@
1
- #ifndef NOKOGIRI_XML_IO
2
- #define NOKOGIRI_XML_IO
3
-
4
- #include <nokogiri.h>
5
-
6
- int io_read_callback(void * ctx, char * buffer, int len);
7
- int io_write_callback(void * ctx, char * buffer, int len);
8
- int io_close_callback(void * ctx);
9
- void init_nokogiri_io();
10
-
11
- #endif
@@ -1,112 +0,0 @@
1
- #ifndef HAVE_XMLFIRSTELEMENTCHILD
2
- #include <libxml/tree.h>
3
- /**
4
- * xmlFirstElementChild:
5
- * @parent: the parent node
6
- *
7
- * Finds the first child node of that element which is a Element node
8
- * Note the handling of entities references is different than in
9
- * the W3C DOM element traversal spec since we don't have back reference
10
- * from entities content to entities references.
11
- *
12
- * Returns the first element child or NULL if not available
13
- */
14
- xmlNodePtr
15
- xmlFirstElementChild(xmlNodePtr parent) {
16
- xmlNodePtr cur = NULL;
17
-
18
- if (parent == NULL)
19
- return(NULL);
20
- switch (parent->type) {
21
- case XML_ELEMENT_NODE:
22
- case XML_ENTITY_NODE:
23
- case XML_DOCUMENT_NODE:
24
- case XML_HTML_DOCUMENT_NODE:
25
- cur = parent->children;
26
- break;
27
- default:
28
- return(NULL);
29
- }
30
- while (cur != NULL) {
31
- if (cur->type == XML_ELEMENT_NODE)
32
- return(cur);
33
- cur = cur->next;
34
- }
35
- return(NULL);
36
- }
37
-
38
- /**
39
- * xmlNextElementSibling:
40
- * @node: the current node
41
- *
42
- * Finds the first closest next sibling of the node which is an
43
- * element node.
44
- * Note the handling of entities references is different than in
45
- * the W3C DOM element traversal spec since we don't have back reference
46
- * from entities content to entities references.
47
- *
48
- * Returns the next element sibling or NULL if not available
49
- */
50
- xmlNodePtr
51
- xmlNextElementSibling(xmlNodePtr node) {
52
- if (node == NULL)
53
- return(NULL);
54
- switch (node->type) {
55
- case XML_ELEMENT_NODE:
56
- case XML_TEXT_NODE:
57
- case XML_CDATA_SECTION_NODE:
58
- case XML_ENTITY_REF_NODE:
59
- case XML_ENTITY_NODE:
60
- case XML_PI_NODE:
61
- case XML_COMMENT_NODE:
62
- case XML_DTD_NODE:
63
- case XML_XINCLUDE_START:
64
- case XML_XINCLUDE_END:
65
- node = node->next;
66
- break;
67
- default:
68
- return(NULL);
69
- }
70
- while (node != NULL) {
71
- if (node->type == XML_ELEMENT_NODE)
72
- return(node);
73
- node = node->next;
74
- }
75
- return(NULL);
76
- }
77
-
78
- /**
79
- * xmlLastElementChild:
80
- * @parent: the parent node
81
- *
82
- * Finds the last child node of that element which is a Element node
83
- * Note the handling of entities references is different than in
84
- * the W3C DOM element traversal spec since we don't have back reference
85
- * from entities content to entities references.
86
- *
87
- * Returns the last element child or NULL if not available
88
- */
89
- xmlNodePtr
90
- xmlLastElementChild(xmlNodePtr parent) {
91
- xmlNodePtr cur = NULL;
92
-
93
- if (parent == NULL)
94
- return(NULL);
95
- switch (parent->type) {
96
- case XML_ELEMENT_NODE:
97
- case XML_ENTITY_NODE:
98
- case XML_DOCUMENT_NODE:
99
- case XML_HTML_DOCUMENT_NODE:
100
- cur = parent->last;
101
- break;
102
- default:
103
- return(NULL);
104
- }
105
- while (cur != NULL) {
106
- if (cur->type == XML_ELEMENT_NODE)
107
- return(cur);
108
- cur = cur->prev;
109
- }
110
- return(NULL);
111
- }
112
- #endif
@@ -1,12 +0,0 @@
1
- #ifndef HAVE_XMLFIRSTELEMENTCHILD
2
-
3
- #ifndef XML_LIBXML2_HACKS
4
- #define XML_LIBXML2_HACKS
5
-
6
- xmlNodePtr xmlFirstElementChild(xmlNodePtr parent);
7
- xmlNodePtr xmlNextElementSibling(xmlNodePtr node);
8
- xmlNodePtr xmlLastElementChild(xmlNodePtr parent);
9
-
10
- #endif
11
-
12
- #endif
@@ -1,14 +0,0 @@
1
- #ifndef NOKOGIRI_XML_NAMESPACE
2
- #define NOKOGIRI_XML_NAMESPACE
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_namespace();
7
-
8
- extern VALUE cNokogiriXmlNamespace ;
9
-
10
- VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node);
11
-
12
- #define NOKOGIRI_NAMESPACE_EH(node) ((node)->type == XML_NAMESPACE_DECL)
13
-
14
- #endif
@@ -1,13 +0,0 @@
1
- #ifndef NOKOGIRI_XML_NODE
2
- #define NOKOGIRI_XML_NODE
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_node();
7
-
8
- extern VALUE cNokogiriXmlNode ;
9
- extern VALUE cNokogiriXmlElement ;
10
-
11
- VALUE Nokogiri_wrap_xml_node(VALUE klass, xmlNodePtr node) ;
12
- void Nokogiri_xml_node_properties(xmlNodePtr node, VALUE attr_hash) ;
13
- #endif
@@ -1,12 +0,0 @@
1
- #ifndef NOKOGIRI_XML_NODE_SET
2
- #define NOKOGIRI_XML_NODE_SET
3
-
4
- #include <nokogiri.h>
5
- void init_xml_node_set();
6
-
7
- extern VALUE cNokogiriXmlNodeSet ;
8
- VALUE Nokogiri_wrap_xml_node_set(xmlNodeSetPtr node_set, VALUE document) ;
9
- VALUE Nokogiri_wrap_xml_node_set_node(xmlNodePtr node, VALUE node_set) ;
10
- VALUE Nokogiri_wrap_xml_node_set_namespace(xmlNsPtr node, VALUE node_set) ;
11
-
12
- #endif
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_PROCESSING_INSTRUCTION
2
- #define NOKOGIRI_XML_PROCESSING_INSTRUCTION
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_processing_instruction();
7
-
8
- extern VALUE cNokogiriXmlProcessingInstruction;
9
- #endif
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_XML_READER
2
- #define NOKOGIRI_XML_READER
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_reader();
7
-
8
- extern VALUE cNokogiriXmlReader;
9
-
10
- #endif
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_RELAX_NG
2
- #define NOKOGIRI_XML_RELAX_NG
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_relax_ng();
7
-
8
- extern VALUE cNokogiriXmlRelaxNG;
9
- #endif
@@ -1,39 +0,0 @@
1
- #ifndef NOKOGIRI_XML_SAX_PARSER
2
- #define NOKOGIRI_XML_SAX_PARSER
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_sax_parser();
7
-
8
- extern VALUE cNokogiriXmlSaxParser ;
9
-
10
- typedef struct _nokogiriSAXTuple {
11
- xmlParserCtxtPtr ctxt;
12
- VALUE self;
13
- } nokogiriSAXTuple;
14
-
15
- typedef nokogiriSAXTuple * nokogiriSAXTuplePtr;
16
-
17
- #define NOKOGIRI_SAX_SELF(_ctxt) \
18
- ((nokogiriSAXTuplePtr)(_ctxt))->self
19
-
20
- #define NOKOGIRI_SAX_CTXT(_ctxt) \
21
- ((nokogiriSAXTuplePtr)(_ctxt))->ctxt
22
-
23
- #define NOKOGIRI_SAX_TUPLE_NEW(_ctxt, _self) \
24
- nokogiri_sax_tuple_new(_ctxt, _self)
25
-
26
- static inline nokogiriSAXTuplePtr
27
- nokogiri_sax_tuple_new(xmlParserCtxtPtr ctxt, VALUE self)
28
- {
29
- nokogiriSAXTuplePtr tuple = malloc(sizeof(nokogiriSAXTuple));
30
- tuple->self = self;
31
- tuple->ctxt = ctxt;
32
- return tuple;
33
- }
34
-
35
- #define NOKOGIRI_SAX_TUPLE_DESTROY(_tuple) \
36
- free(_tuple) \
37
-
38
- #endif
39
-
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_XML_SAX_PARSER_CONTEXT
2
- #define NOKOGIRI_XML_SAX_PARSER_CONTEXT
3
-
4
- #include <nokogiri.h>
5
-
6
- extern VALUE cNokogiriXmlSaxParserContext;
7
-
8
- void init_xml_sax_parser_context();
9
-
10
- #endif
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_SAX_PUSH_PARSER
2
- #define NOKOGIRI_XML_SAX_PUSH_PARSER
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_sax_push_parser();
7
-
8
- extern VALUE cNokogiriXmlSaxPushParser ;
9
- #endif
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_SCHEMA
2
- #define NOKOGIRI_XML_SCHEMA
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_schema();
7
-
8
- extern VALUE cNokogiriXmlSchema;
9
- #endif
@@ -1,13 +0,0 @@
1
- #ifndef NOKOGIRI_XML_SYNTAX_ERROR
2
- #define NOKOGIRI_XML_SYNTAX_ERROR
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_syntax_error();
7
- 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));
10
-
11
- extern VALUE cNokogiriXmlSyntaxError;
12
- #endif
13
-
@@ -1,9 +0,0 @@
1
- #ifndef NOKOGIRI_XML_TEXT
2
- #define NOKOGIRI_XML_TEXT
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_text();
7
-
8
- extern VALUE cNokogiriXmlText ;
9
- #endif
@@ -1,10 +0,0 @@
1
- #ifndef NOKOGIRI_XML_XPATH_CONTEXT
2
- #define NOKOGIRI_XML_XPATH_CONTEXT
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_xpath_context();
7
- void Nokogiri_marshal_xpath_funcall_and_return_values(xmlXPathParserContextPtr ctx, int nargs, VALUE handler, const char* function_name) ;
8
-
9
- extern VALUE cNokogiriXmlXpathContext;
10
- #endif
@@ -1,14 +0,0 @@
1
- #ifndef NOKOGIRI_XSLT_STYLESHEET
2
- #define NOKOGIRI_XSLT_STYLESHEET
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xslt_stylesheet();
7
-
8
- extern VALUE cNokogiriXsltStylesheet ;
9
-
10
- typedef struct _nokogiriXsltStylesheetTuple {
11
- xsltStylesheetPtr ss;
12
- VALUE func_instances;
13
- } nokogiriXsltStylesheetTuple;
14
- #endif
@@ -1,78 +0,0 @@
1
- From c5538465c08a8ea248a370bf55bc39cd3385e4af Mon Sep 17 00:00:00 2001
2
- From: Mike Dalessio <mike.dalessio@gmail.com>
3
- Date: Thu, 29 Mar 2018 14:09:00 -0400
4
- Subject: [PATCH] Revert "Do not URI escape in server side includes"
5
-
6
- This reverts commit 960f0e275616cadc29671a218d7fb9b69eb35588.
7
- ---
8
- HTMLtree.c | 49 +++++++++++--------------------------------------
9
- 1 file changed, 11 insertions(+), 38 deletions(-)
10
-
11
- diff --git a/HTMLtree.c b/HTMLtree.c
12
- index 2fd0c9c..67160c5 100644
13
- --- a/HTMLtree.c
14
- +++ b/HTMLtree.c
15
- @@ -717,49 +717,22 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur,
16
- (!xmlStrcasecmp(cur->name, BAD_CAST "src")) ||
17
- ((!xmlStrcasecmp(cur->name, BAD_CAST "name")) &&
18
- (!xmlStrcasecmp(cur->parent->name, BAD_CAST "a"))))) {
19
- + xmlChar *escaped;
20
- xmlChar *tmp = value;
21
- - /* xmlURIEscapeStr() escapes '"' so it can be safely used. */
22
- - xmlBufCCat(buf->buffer, "\"");
23
-
24
- while (IS_BLANK_CH(*tmp)) tmp++;
25
-
26
- - /* URI Escape everything, except server side includes. */
27
- - for ( ; ; ) {
28
- - xmlChar *escaped;
29
- - xmlChar endChar;
30
- - xmlChar *end = NULL;
31
- - xmlChar *start = (xmlChar *)xmlStrstr(tmp, BAD_CAST "<!--");
32
- - if (start != NULL) {
33
- - end = (xmlChar *)xmlStrstr(tmp, BAD_CAST "-->");
34
- - if (end != NULL) {
35
- - *start = '\0';
36
- - }
37
- - }
38
- -
39
- - /* Escape the whole string, or until start (set to '\0'). */
40
- - escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+");
41
- - if (escaped != NULL) {
42
- - xmlBufCat(buf->buffer, escaped);
43
- - xmlFree(escaped);
44
- - } else {
45
- - xmlBufCat(buf->buffer, tmp);
46
- - }
47
- -
48
- - if (end == NULL) { /* Everything has been written. */
49
- - break;
50
- - }
51
- -
52
- - /* Do not escape anything within server side includes. */
53
- - *start = '<'; /* Restore the first character of "<!--". */
54
- - end += 3; /* strlen("-->") */
55
- - endChar = *end;
56
- - *end = '\0';
57
- - xmlBufCat(buf->buffer, start);
58
- - *end = endChar;
59
- - tmp = end;
60
- + /*
61
- + * the < and > have already been escaped at the entity level
62
- + * And doing so here breaks server side includes
63
- + */
64
- + escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+<>");
65
- + if (escaped != NULL) {
66
- + xmlBufWriteQuotedString(buf->buffer, escaped);
67
- + xmlFree(escaped);
68
- + } else {
69
- + xmlBufWriteQuotedString(buf->buffer, value);
70
- }
71
- -
72
- - xmlBufCCat(buf->buffer, "\"");
73
- } else {
74
- xmlBufWriteQuotedString(buf->buffer, value);
75
- }
76
- --
77
- 2.9.5
78
-
@@ -1,120 +0,0 @@
1
- From e03553605b45c88f0b4b2980adfbbb8f6fca2fd6 Mon Sep 17 00:00:00 2001
2
- From: Nick Wellnhofer <wellnhofer@aevum.de>
3
- Date: Sun, 24 Mar 2019 09:51:39 +0100
4
- Subject: [PATCH] Fix security framework bypass
5
-
6
- xsltCheckRead and xsltCheckWrite return -1 in case of error but callers
7
- don't check for this condition and allow access. With a specially
8
- crafted URL, xsltCheckRead could be tricked into returning an error
9
- because of a supposedly invalid URL that would still be loaded
10
- succesfully later on.
11
-
12
- Fixes #12.
13
-
14
- Thanks to Felix Wilhelm for the report.
15
- ---
16
- libxslt/documents.c | 18 ++++++++++--------
17
- libxslt/imports.c | 9 +++++----
18
- libxslt/transform.c | 9 +++++----
19
- libxslt/xslt.c | 9 +++++----
20
- 4 files changed, 25 insertions(+), 20 deletions(-)
21
-
22
- diff --git a/libxslt/documents.c b/libxslt/documents.c
23
- index 3f3a731..4aad11b 100644
24
- --- a/libxslt/documents.c
25
- +++ b/libxslt/documents.c
26
- @@ -296,10 +296,11 @@ xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
27
- int res;
28
-
29
- res = xsltCheckRead(ctxt->sec, ctxt, URI);
30
- - if (res == 0) {
31
- - xsltTransformError(ctxt, NULL, NULL,
32
- - "xsltLoadDocument: read rights for %s denied\n",
33
- - URI);
34
- + if (res <= 0) {
35
- + if (res == 0)
36
- + xsltTransformError(ctxt, NULL, NULL,
37
- + "xsltLoadDocument: read rights for %s denied\n",
38
- + URI);
39
- return(NULL);
40
- }
41
- }
42
- @@ -372,10 +373,11 @@ xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) {
43
- int res;
44
-
45
- res = xsltCheckRead(sec, NULL, URI);
46
- - if (res == 0) {
47
- - xsltTransformError(NULL, NULL, NULL,
48
- - "xsltLoadStyleDocument: read rights for %s denied\n",
49
- - URI);
50
- + if (res <= 0) {
51
- + if (res == 0)
52
- + xsltTransformError(NULL, NULL, NULL,
53
- + "xsltLoadStyleDocument: read rights for %s denied\n",
54
- + URI);
55
- return(NULL);
56
- }
57
- }
58
- diff --git a/libxslt/imports.c b/libxslt/imports.c
59
- index 874870c..3783b24 100644
60
- --- a/libxslt/imports.c
61
- +++ b/libxslt/imports.c
62
- @@ -130,10 +130,11 @@ xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur) {
63
- int secres;
64
-
65
- secres = xsltCheckRead(sec, NULL, URI);
66
- - if (secres == 0) {
67
- - xsltTransformError(NULL, NULL, NULL,
68
- - "xsl:import: read rights for %s denied\n",
69
- - URI);
70
- + if (secres <= 0) {
71
- + if (secres == 0)
72
- + xsltTransformError(NULL, NULL, NULL,
73
- + "xsl:import: read rights for %s denied\n",
74
- + URI);
75
- goto error;
76
- }
77
- }
78
- diff --git a/libxslt/transform.c b/libxslt/transform.c
79
- index 1379391..0636dbd 100644
80
- --- a/libxslt/transform.c
81
- +++ b/libxslt/transform.c
82
- @@ -3493,10 +3493,11 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
83
- */
84
- if (ctxt->sec != NULL) {
85
- ret = xsltCheckWrite(ctxt->sec, ctxt, filename);
86
- - if (ret == 0) {
87
- - xsltTransformError(ctxt, NULL, inst,
88
- - "xsltDocumentElem: write rights for %s denied\n",
89
- - filename);
90
- + if (ret <= 0) {
91
- + if (ret == 0)
92
- + xsltTransformError(ctxt, NULL, inst,
93
- + "xsltDocumentElem: write rights for %s denied\n",
94
- + filename);
95
- xmlFree(URL);
96
- xmlFree(filename);
97
- return;
98
- diff --git a/libxslt/xslt.c b/libxslt/xslt.c
99
- index 780a5ad..a234eb7 100644
100
- --- a/libxslt/xslt.c
101
- +++ b/libxslt/xslt.c
102
- @@ -6763,10 +6763,11 @@ xsltParseStylesheetFile(const xmlChar* filename) {
103
- int res;
104
-
105
- res = xsltCheckRead(sec, NULL, filename);
106
- - if (res == 0) {
107
- - xsltTransformError(NULL, NULL, NULL,
108
- - "xsltParseStylesheetFile: read rights for %s denied\n",
109
- - filename);
110
- + if (res <= 0) {
111
- + if (res == 0)
112
- + xsltTransformError(NULL, NULL, NULL,
113
- + "xsltParseStylesheetFile: read rights for %s denied\n",
114
- + filename);
115
- return(NULL);
116
- }
117
- }
118
- --
119
- 2.17.1
120
-
Binary file
Binary file