1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2026-01-26 21:41:34 +03:00
Files
libxml2/include/private/io.h
Nick Wellnhofer a78843be5e xmllint: Support compressed input from stdin
Another regression related to reading from stdin.

Making a "-" filename read from stdin was deeply baked into the core
IO code but is inherently insecure. I really want to reenable this
dangerous feature as sparingly as possible.

This now enables compressed input when using the "Fd" API functions
which wan't supported before. But XML_PARSE_NO_UNZIP will be
inverted later.

Allow compressed stdin in xmlReadFile to support xmlstarlet and older
versions of xsltproc. So far, these are the only known command-line
tools that rely on "-" meaning stdin.
2025-01-28 23:20:37 +01:00

44 lines
1.1 KiB
C

#ifndef XML_IO_H_PRIVATE__
#define XML_IO_H_PRIVATE__
#include <libxml/encoding.h>
#include <libxml/tree.h>
#include <libxml/xmlversion.h>
/*
* Initial buffer size should include
*
* - MINLEN = 4000 (I/O chunk size)
* - INPUT_CHUNK = 250 (parser prefetch)
* - LINE_LEN = 80 (shrink limit for error messages)
* - some amount for unshrunken content.
*/
#define XML_IO_BUFFER_SIZE 6000
XML_HIDDEN void
xmlInitIOCallbacks(void);
XML_HIDDEN int
xmlNoNetExists(const char *filename);
XML_HIDDEN int
xmlParserInputBufferCreateUrl(const char *URI, xmlCharEncoding enc,
int flags, xmlParserInputBufferPtr *out);
XML_HIDDEN xmlParserInputBufferPtr
xmlNewInputBufferString(const char *str, int flags);
XML_HIDDEN xmlParserInputBufferPtr
xmlNewInputBufferMemory(const void *mem, size_t size, int flags,
xmlCharEncoding enc);
XML_HIDDEN int
xmlInputFromFd(xmlParserInputBufferPtr buf, int fd, int unzip);
#ifdef LIBXML_OUTPUT_ENABLED
XML_HIDDEN void
xmlOutputBufferWriteQuotedString(xmlOutputBufferPtr buf,
const xmlChar *string);
#endif
#endif /* XML_IO_H_PRIVATE__ */