1
0
mirror of https://github.com/GNOME/libxml2.git synced 2025-05-07 20:39:30 +08:00

http: Remove built-in HTTP client

Stubs are retained for ABI compatibility.

Fixes #631.
Obsoletes #160.
This commit is contained in:
Nick Wellnhofer 2025-04-20 14:31:24 +02:00
parent 85dce1800d
commit b85d77d156
22 changed files with 210 additions and 1996 deletions

View File

@ -27,7 +27,7 @@ option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(LIBXML2_WITH_CATALOG "Add the Catalog support" ON)
option(LIBXML2_WITH_DEBUG "Add the debugging module" ON)
option(LIBXML2_WITH_HTML "Add the HTML support" ON)
option(LIBXML2_WITH_HTTP "Add the HTTP support" OFF)
option(LIBXML2_WITH_HTTP "ABI compatibility for removed HTTP support" OFF)
option(LIBXML2_WITH_ICONV "Add ICONV support" ON)
option(LIBXML2_WITH_ICU "Add ICU support" OFF)
option(LIBXML2_WITH_ISO8859X "Add ISO8859X support if no iconv" ON)
@ -146,10 +146,6 @@ if(LIBXML2_WITH_READLINE)
endif()
endif()
if(LIBXML2_WITH_HTTP)
check_include_files(poll.h HAVE_POLL_H)
endif()
if(LIBXML2_WITH_TLS)
check_c_source_compiles(
"_Thread_local int v; int main(){return 0;}"
@ -347,10 +343,6 @@ endif()
if(WIN32)
target_link_libraries(LibXml2 PRIVATE bcrypt)
set(CRYPTO_LIBS "-lbcrypt")
if(LIBXML2_WITH_HTTP)
target_link_libraries(LibXml2 PRIVATE ws2_32)
set(WINSOCK_LIBS "-lws2_32")
endif()
endif()
if(LIBXML2_WITH_ICONV)

4
NEWS
View File

@ -6,6 +6,10 @@ v2.15.0: not released yet
The Python bindings are disabled by default now.
### Removals
The built-in HTTP client was removed.
### Planned removals
The Python bindings are planned to be removed in the 2.16 release.

View File

@ -50,7 +50,7 @@ The following options disable or enable code modules and relevant symbols:
--with-history history support for xmllint shell (off)
--with-readline[=DIR] use readline in DIR for shell (off)
--with-html HTML parser (on)
--with-http HTTP support (off)
--with-http ABI compatibility for removed HTTP support (off)
--with-iconv[=DIR] iconv support (on)
--with-icu ICU support (off)
--with-iso8859x ISO-8859-X support if no iconv (on)
@ -133,7 +133,6 @@ See the `meson_options.txt` file for options. For example:
-Dprefix=$prefix
-Dhistory=enabled
-Dhttp=enabled
-Dschematron=disabled
-Dzlib=enabled

View File

@ -22,9 +22,6 @@
/* Define if readline library is there (-lreadline) */
#cmakedefine HAVE_LIBREADLINE 1
/* Define to 1 if you have the <poll.h> header file. */
#cmakedefine HAVE_POLL_H 1
/* Have shl_load based dso */
#cmakedefine HAVE_SHLLOAD 1

View File

@ -80,7 +80,7 @@ AC_ARG_WITH(readline,
AC_ARG_WITH(html,
[ --with-html HTML parser (on)])
AC_ARG_WITH(http,
[ --with-http HTTP support (off)])
[ --with-http ABI compatibility for removed HTTP support (off)])
AC_ARG_WITH(iconv,
[ --with-iconv[[=DIR]] iconv support (on)])
AC_ARG_WITH(icu,
@ -312,36 +312,6 @@ AC_CHECK_DECLS([mmap], [], [], [#include <sys/mman.h>])
AM_CONDITIONAL(WITH_GLOB, test "$ac_cv_have_decl_glob" = "yes")
dnl
dnl Checks for inet libraries
dnl
if test "$with_http" = "yes"; then
AC_CHECK_HEADERS([poll.h])
case "$host" in
*-*-mingw*)
dnl AC_SEARCH_LIBS doesn't work because of non-standard calling
dnl conventions on 32-bit Windows.
NET_LIBS="$NET_LIBS -lws2_32"
;;
*)
_libs=$LIBS
AC_SEARCH_LIBS(gethostbyname, [nsl], [
if test "$ac_cv_search_gethostbyname" != "none required"; then
NET_LIBS="$NET_LIBS $ac_cv_search_gethostbyname"
fi], [:], [$NET_LIBS])
AC_SEARCH_LIBS(connect, [bsd socket inet], [
if test "$ac_cv_search_connect" != "none required"; then
NET_LIBS="$NET_LIBS $ac_cv_search_connect"
fi], [:], [$NET_LIBS])
LIBS=$_libs
;;
esac
XML_PRIVATE_LIBS="${XML_PRIVATE_LIBS} ${NET_LIBS}"
XML_PC_LIBS="${XML_PC_LIBS} ${NET_LIBS}"
fi
dnl Thread-local storage
if test "$with_tls" = "yes"; then
AC_COMPILE_IFELSE([
@ -416,7 +386,7 @@ dnl
if test "$with_http" != "yes" ; then
WITH_HTTP=0
else
echo Enabling HTTP support
echo Enabling ABI compatibility stubs for removed HTTP support
WITH_HTTP=1
fi
AC_SUBST(WITH_HTTP)

View File

@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in
SUBDIRS=libxml private
EXTRA_DIST = wsockcompat.h meson.build
EXTRA_DIST = meson.build

View File

@ -13,7 +13,7 @@
#include <libxml/xmlversion.h>
#ifdef LIBXML_HTTP_ENABLED
#ifdef LIBXML_HTTP_STUBS_ENABLED
#ifdef __cplusplus
extern "C" {
@ -94,5 +94,5 @@ XMLPUBFUN void
}
#endif
#endif /* LIBXML_HTTP_ENABLED */
#endif /* LIBXML_HTTP_STUBS_ENABLED */
#endif /* __NANO_HTTP_H__ */

View File

@ -324,12 +324,11 @@ xmlOutputBufferPtr
xmlCharEncodingHandlerPtr encoder,
int compression);
#ifdef LIBXML_HTTP_ENABLED
/* This function only exists if HTTP support built into the library */
#ifdef LIBXML_HTTP_STUBS_ENABLED
XML_DEPRECATED
XMLPUBFUN void
xmlRegisterHTTPPostCallbacks (void );
#endif /* LIBXML_HTTP_ENABLED */
#endif /* LIBXML_HTTP_STUBS_ENABLED */
#endif /* LIBXML_OUTPUT_ENABLED */
@ -338,9 +337,7 @@ XMLPUBFUN xmlParserInputPtr
xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr ret);
/*
* A predefined entity loader disabling network accesses
*/
XML_DEPRECATED
XMLPUBFUN xmlParserInputPtr
xmlNoNetExternalEntityLoader (const char *URL,
const char *ID,
@ -374,7 +371,7 @@ XMLPUBFUN int
/**
* Default 'http://' protocol callbacks
*/
#ifdef LIBXML_HTTP_ENABLED
#ifdef LIBXML_HTTP_STUBS_ENABLED
XML_DEPRECATED
XMLPUBFUN int
xmlIOHTTPMatch (const char *filename);
@ -395,7 +392,7 @@ XMLPUBFUN int
XML_DEPRECATED
XMLPUBFUN int
xmlIOHTTPClose (void * context);
#endif /* LIBXML_HTTP_ENABLED */
#endif /* LIBXML_HTTP_STUBS_ENABLED */
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
xmlParserInputBufferCreateFilenameDefault(

View File

@ -126,12 +126,12 @@
#endif
/**
* LIBXML_HTTP_ENABLED:
* LIBXML_HTTP_STUBS_ENABLED:
*
* Whether the HTTP support is configured in
* HTTP support was removed in 2.15
*/
#if @WITH_HTTP@
#define LIBXML_HTTP_ENABLED
#define LIBXML_HTTP_STUBS_ENABLED
#endif
/**

View File

@ -1,49 +0,0 @@
/* include/wsockcompat.h
* Windows -> Berkeley Sockets compatibility things.
*/
#if !defined __XML_WSOCKCOMPAT_H__
#define __XML_WSOCKCOMPAT_H__
#include <errno.h>
#include <winsock2.h>
/* Fix for old MinGW. */
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
#endif
/* the following is a workaround a problem for 'inline' keyword in said
header when compiled with Borland C++ 6 */
#if defined(__BORLANDC__) && !defined(__cplusplus)
#define inline __inline
#define _inline __inline
#endif
#include <ws2tcpip.h>
/* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */
#if defined(GetAddrInfo)
#include <wspiapi.h>
#ifndef SUPPORT_IP6
#define SUPPORT_IP6
#endif
#endif
#ifndef ECONNRESET
#define ECONNRESET WSAECONNRESET
#endif
#ifndef EINPROGRESS
#define EINPROGRESS WSAEINPROGRESS
#endif
#ifndef EINTR
#define EINTR WSAEINTR
#endif
#ifndef ESHUTDOWN
#define ESHUTDOWN WSAESHUTDOWN
#endif
#ifndef EWOULDBLOCK
#define EWOULDBLOCK WSAEWOULDBLOCK
#endif
#endif /* __XML_WSOCKCOMPAT_H__ */

View File

@ -97,7 +97,6 @@ set(LIBXML2_WITH_THREADS @LIBXML2_WITH_THREADS@)
set(LIBXML2_WITH_ICU @LIBXML2_WITH_ICU@)
set(LIBXML2_WITH_LZMA @LIBXML2_WITH_LZMA@)
set(LIBXML2_WITH_ZLIB @LIBXML2_WITH_ZLIB@)
set(LIBXML2_WITH_HTTP @LIBXML2_WITH_HTTP@)
if(LIBXML2_WITH_ICONV)
find_dependency(Iconv)
@ -159,9 +158,6 @@ if(NOT LIBXML2_SHARED)
if(WIN32)
list(APPEND LIBXML2_LIBRARIES Bcrypt)
if(LIBXML2_WITH_HTTP)
list(APPEND LIBXML2_LIBRARIES ws2_32)
endif()
endif()
endif()

View File

@ -50,7 +50,6 @@ set(LIBXML2_WITH_THREADS @WITH_THREADS@)
set(LIBXML2_WITH_ICU @WITH_ICU@)
set(LIBXML2_WITH_LZMA @WITH_LZMA@)
set(LIBXML2_WITH_ZLIB @WITH_ZLIB@)
set(LIBXML2_WITH_HTTP @WITH_HTTP@)
if(LIBXML2_WITH_ICONV)
find_dependency(Iconv)
@ -116,10 +115,6 @@ endif()
if(WIN32)
list(APPEND LIBXML2_LIBRARIES Bcrypt)
list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Bcrypt>")
if(LIBXML2_WITH_HTTP)
list(APPEND LIBXML2_LIBRARIES ws2_32)
list(APPEND LIBXML2_INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:ws2_32>")
endif()
endif()
# whether libxml2 has dso support

View File

@ -256,7 +256,6 @@ config_h.set_quoted('XML_SYSCONFDIR',
# header files
xml_check_headers = [
[ 'stdint.h', true ],
[ 'poll.h', want_http ],
]
foreach header : xml_check_headers
@ -361,30 +360,6 @@ if sys_windows == true
xml_deps += bcrypt_dep
endif
### inet
if want_http == true
if sys_windows == true
net_dep = cc.find_library('ws2_32', required: true)
xml_deps += net_dep
else
net_dep = dependency('', required: false)
has_in_libc = cc.has_function('gethostbyname')
if has_in_libc == false
net_dep = cc.find_library('nsl', required: true)
if net_dep.found()
has_in_nsl = cc.has_function(
'gethostbyname',
dependencies: net_dep,
required: false,
)
if has_in_nsl == true
xml_deps += net_dep
endif
endif
endif
endif
endif
### zlib
if want_zlib
xml_deps += dependency('zlib')
@ -598,7 +573,6 @@ config_cmake.set('LIBXML_MAJOR_VERSION', v_maj)
config_cmake.set('LIBXML_MINOR_VERSION', v_min)
config_cmake.set('LIBXML_MICRO_VERSION', v_mic)
config_cmake.set('VERSION', meson.project_version())
config_cmake.set('WITH_HTTP', want_http.to_int().to_string())
config_cmake.set('WITH_ICONV', want_iconv.to_int().to_string())
config_cmake.set('WITH_ICU', want_icu.to_int().to_string())
config_cmake.set('WITH_LZMA', want_lzma.to_int().to_string())

View File

@ -61,7 +61,7 @@ option('html',
option('http',
type: 'feature',
description: 'HTTP support'
description: 'ABI compatibility for removed HTTP support'
)
# TODO meson custom dependency

1770
nanohttp.c

File diff suppressed because it is too large Load Diff

View File

@ -557,11 +557,7 @@ xmlHasFeature(xmlFeature feature)
return(0);
#endif
case XML_WITH_HTTP:
#ifdef LIBXML_HTTP_ENABLED
return(1);
#else
return(0);
#endif
case XML_WITH_VALID:
#ifdef LIBXML_VALID_ENABLED
return(1);
@ -13583,7 +13579,11 @@ xmlCtxtSetOptionsInternal(xmlParserCtxtPtr ctxt, int options, int keepMask)
*
* XML_PARSE_NONET
*
* Disable network access with the builtin HTTP client.
* Disable network access with the built-in HTTP or FTP clients.
*
* After the last built-in network client was removed in 2.15,
* this option has no effect expect for being passed on to custom
* resource loaders.
*
* XML_PARSE_NODICT
*

View File

@ -35,7 +35,6 @@
#include <libxml/catalog.h>
#endif
#include <libxml/chvalid.h>
#include <libxml/nanohttp.h>
#define CUR(ctxt) ctxt->input->cur
#define END(ctxt) ctxt->input->end
@ -2374,53 +2373,6 @@ xmlResolveResourceFromCatalog(const char *URL, const char *ID,
#endif
#ifdef LIBXML_HTTP_ENABLED
static xmlParserErrors
xmlCheckHTTPInputInternal(xmlParserInputPtr input) {
const char *encoding;
const char *redir;
const char *mime;
int code;
if ((input == NULL) || (input->buf == NULL) ||
(input->buf->readcallback != xmlIOHTTPRead) ||
(input->buf->context == NULL))
return(XML_ERR_OK);
code = xmlNanoHTTPReturnCode(input->buf->context);
if (code >= 400) {
/* fatal error */
return(XML_IO_LOAD_ERROR);
}
mime = xmlNanoHTTPMimeType(input->buf->context);
if ((xmlStrstr(BAD_CAST mime, BAD_CAST "/xml")) ||
(xmlStrstr(BAD_CAST mime, BAD_CAST "+xml"))) {
encoding = xmlNanoHTTPEncoding(input->buf->context);
if (encoding != NULL) {
xmlCharEncodingHandlerPtr handler;
xmlParserErrors res;
res = xmlOpenCharEncodingHandler(encoding, /* output */ 0,
&handler);
if (res == 0)
xmlInputSetEncodingHandler(input, handler);
}
}
redir = xmlNanoHTTPRedir(input->buf->context);
if (redir != NULL) {
if (input->filename != NULL)
xmlFree((xmlChar *) input->filename);
input->filename = xmlMemStrdup(redir);
if (input->filename == NULL)
return(XML_ERR_NO_MEMORY);
}
return(XML_ERR_OK);
}
#endif /* LIBXML_HTTP_ENABLED */
/**
* xmlCheckHTTPInput:
* @ctxt: an XML parser context
@ -2428,34 +2380,12 @@ xmlCheckHTTPInputInternal(xmlParserInputPtr input) {
*
* DEPRECATED: Internal function, don't use.
*
* Check an input in case it was created from an HTTP stream, in that
* case it will handle encoding and update of the base URL in case of
* redirection. It also checks for HTTP errors in which case the input
* is cleanly freed up and an appropriate error is raised in context
*
* Returns the input or NULL in case of HTTP error.
* Returns NULL.
*/
xmlParserInputPtr
xmlCheckHTTPInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr ret) {
/* Avoid unused variable warning if features are disabled. */
(void) ctxt;
#ifdef LIBXML_HTTP_ENABLED
{
int code = xmlCheckHTTPInputInternal(ret);
if (code != XML_ERR_OK) {
if (ret->filename != NULL)
xmlCtxtErrIO(ctxt, XML_IO_LOAD_ERROR, ret->filename);
else
xmlCtxtErrIO(ctxt, XML_IO_LOAD_ERROR, "<null>");
xmlFreeInputStream(ret);
return(NULL);
}
}
#endif
return(ret);
xmlCheckHTTPInput(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
xmlParserInputPtr ret ATTRIBUTE_UNUSED) {
return(NULL);
}
/**
@ -2478,7 +2408,6 @@ xmlCheckHTTPInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr ret) {
* - the default loader which will return
* - the result from a matching global input callback set with
* xmlRegisterInputCallbacks (deprecated)
* - a HTTP resource if support is compiled in.
* - a file opened from the filesystem, with automatic detection
* of compressed files if support is compiled in.
*
@ -2515,14 +2444,6 @@ xmlNewInputFromUrl(const char *filename, xmlParserInputFlags flags,
if (input == NULL)
return(XML_ERR_NO_MEMORY);
#ifdef LIBXML_HTTP_ENABLED
code = xmlCheckHTTPInputInternal(input);
if (code != XML_ERR_OK) {
xmlFreeInputStream(input);
return(code);
}
#endif
*out = input;
return(XML_ERR_OK);
}
@ -2589,6 +2510,10 @@ xmlDefaultExternalEntityLoader(const char *url, const char *ID,
url = resource;
#endif
/*
* Several downstream test suites expect this error whenever
* an http URI is passed and NONET is set.
*/
if ((ctxt != NULL) &&
(ctxt->options & XML_PARSE_NONET) &&
(xmlStrncasecmp(BAD_CAST url, BAD_CAST "http://", 7) == 0)) {
@ -2773,7 +2698,6 @@ xmlLoadResource(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
* - the default loader which will return
* - the result from a matching global input callback set with
* xmlRegisterInputCallbacks (deprecated)
* - a HTTP resource if support is compiled in.
* - a file opened from the filesystem, with automatic detection
* of compressed files if support is compiled in.
*

View File

@ -669,7 +669,7 @@ static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr v
}
#endif
#ifdef LIBXML_HTTP_ENABLED
#ifdef LIBXML_HTTP_STUBS_ENABLED
#define gen_nb_xmlNanoHTTPCtxtPtr 1
static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL));
@ -862,7 +862,7 @@ static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
}
#endif
#ifdef LIBXML_HTTP_ENABLED
#ifdef LIBXML_HTTP_STUBS_ENABLED
static void desret_xmlNanoHTTPCtxtPtr(void *val) {
xmlNanoHTTPClose(val);
}
@ -11184,7 +11184,7 @@ static int
test_xmlNanoHTTPAuthHeader(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
const char * ret_val;
void * ctx; /* the HTTP context */
@ -11218,7 +11218,7 @@ static int
test_xmlNanoHTTPCleanup(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
mem_base = xmlMemBlocks();
@ -11243,7 +11243,7 @@ static int
test_xmlNanoHTTPContentLength(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
int ret_val;
void * ctx; /* the HTTP context */
@ -11277,7 +11277,7 @@ static int
test_xmlNanoHTTPEncoding(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
const char * ret_val;
void * ctx; /* the HTTP context */
@ -11315,7 +11315,7 @@ static int
test_xmlNanoHTTPFetch(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
int ret_val;
const char * URL; /* The URL to load */
@ -11363,7 +11363,7 @@ static int
test_xmlNanoHTTPInit(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
mem_base = xmlMemBlocks();
@ -11388,7 +11388,7 @@ static int
test_xmlNanoHTTPMimeType(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
const char * ret_val;
void * ctx; /* the HTTP context */
@ -11422,7 +11422,7 @@ static int
test_xmlNanoHTTPOpen(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
void * ret_val;
const char * URL; /* The URL to load */
@ -11463,7 +11463,7 @@ static int
test_xmlNanoHTTPOpenRedir(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
void * ret_val;
const char * URL; /* The URL to load */
@ -11511,7 +11511,7 @@ static int
test_xmlNanoHTTPRead(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
int ret_val;
void * ctx; /* the HTTP context */
@ -11569,7 +11569,7 @@ static int
test_xmlNanoHTTPReturnCode(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
int ret_val;
void * ctx; /* the HTTP context */
@ -11603,7 +11603,7 @@ static int
test_xmlNanoHTTPSave(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
int mem_base;
int ret_val;
void * ctxt; /* the HTTP context */
@ -11644,7 +11644,7 @@ static int
test_xmlNanoHTTPScanProxy(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
const char * URL; /* The proxy URL used to initialize the proxy context */
int n_URL;
@ -28511,7 +28511,7 @@ static int
test_xmlIOHTTPClose(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
int ret_val;
void * context; /* the I/O context */
@ -28545,7 +28545,7 @@ static int
test_xmlIOHTTPMatch(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
int ret_val;
const char * filename; /* the URI for matching */
@ -28579,7 +28579,7 @@ static int
test_xmlIOHTTPOpen(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
void * ret_val;
const char * filename; /* the URI for matching */
@ -28613,7 +28613,7 @@ static int
test_xmlIOHTTPRead(void) {
int test_ret = 0;
#if defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
int ret_val;
void * context; /* the I/O context */
@ -29563,7 +29563,7 @@ static int
test_xmlRegisterHTTPPostCallbacks(void) {
int test_ret = 0;
#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_STUBS_ENABLED)
int mem_base;
mem_base = xmlMemBlocks();

View File

@ -75,9 +75,6 @@ LIBS = $(LIBS) cw32i.lib
!else
LIBS = $(LIBS) cw32.lib
!endif
!if "$(WITH_HTTP)" == "1"
LIBS = $(LIBS) wsock32.lib ws2_32.lib
!endif
!if "$(WITH_ICONV)" == "1"
LIBS = $(LIBS) iconvomf.lib
!endif

View File

@ -49,9 +49,6 @@ LDFLAGS += -Wl,--major-image-version,$(LIBXML_MAJOR_VERSION)
LDFLAGS += -Wl,--minor-image-version,$(LIBXML_MINOR_VERSION)
LDFLAGS += -Wl,-L,$(BINDIR) -Wl,-L,$(LIBPREFIX)
LIBS =
ifeq ($(WITH_HTTP),1)
LIBS += -lwsock32 -lws2_32
endif
ifeq ($(WITH_ICONV),1)
LIBS += -liconv
endif

View File

@ -52,9 +52,6 @@ LD = link.exe
LDFLAGS = /nologo /VERSION:$(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION)
LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX)
LIBS =
!if "$(WITH_HTTP)" == "1"
LIBS = $(LIBS) wsock32.lib ws2_32.lib
!endif
!if "$(WITH_ICONV)" == "1"
LIBS = $(LIBS) iconv.lib
!endif

120
xmlIO.c
View File

@ -35,7 +35,6 @@
#include <libxml/xmlIO.h>
#include <libxml/xmlmemory.h>
#include <libxml/uri.h>
#include <libxml/nanohttp.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlerror.h>
#ifdef LIBXML_CATALOG_ENABLED
@ -929,98 +928,6 @@ xmlXzfileClose (void * context) {
}
#endif /* LIBXML_LZMA_ENABLED */
/************************************************************************
* *
* I/O for HTTP file accesses *
* *
************************************************************************/
#ifdef LIBXML_HTTP_ENABLED
/**
* xmlIOHTTPMatch:
* @filename: the URI for matching
*
* DEPRECATED: Internal function, don't use.
*
* check if the URI matches an HTTP one
*
* Returns 1 if matches, 0 otherwise
*/
int
xmlIOHTTPMatch (const char *filename) {
if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "http://", 7))
return(1);
return(0);
}
/**
* xmlIOHTTPOpen:
* @filename: the URI for matching
*
* DEPRECATED: Internal function, don't use.
*
* open an HTTP I/O channel
*
* Returns an I/O context or NULL in case of error
*/
void *
xmlIOHTTPOpen (const char *filename) {
return(xmlNanoHTTPOpen(filename, NULL));
}
#ifdef LIBXML_OUTPUT_ENABLED
/**
* xmlIOHTTPOpenW:
* @post_uri: The destination URI for the document
* @compression: The compression desired for the document.
*
* DEPRECATED: Support for HTTP POST has been removed.
*
* Returns NULL.
*/
void *
xmlIOHTTPOpenW(const char *post_uri ATTRIBUTE_UNUSED,
int compression ATTRIBUTE_UNUSED)
{
return(NULL);
}
#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlIOHTTPRead:
* @context: the I/O context
* @buffer: where to drop data
* @len: number of bytes to write
*
* DEPRECATED: Internal function, don't use.
*
* Read @len bytes to @buffer from the I/O channel.
*
* Returns the number of bytes written
*/
int
xmlIOHTTPRead(void * context, char * buffer, int len) {
if ((buffer == NULL) || (len < 0)) return(-1);
return(xmlNanoHTTPRead(context, &buffer[0], len));
}
/**
* xmlIOHTTPClose:
* @context: the I/O context
*
* DEPRECATED: Internal function, don't use.
*
* Close an HTTP I/O channel
*
* Returns 0
*/
int
xmlIOHTTPClose (void * context) {
xmlNanoHTTPClose(context);
return 0;
}
#endif /* LIBXML_HTTP_ENABLED */
/************************************************************************
* *
* Input/output buffers *
@ -1161,21 +1068,6 @@ xmlInputDefaultOpen(xmlParserInputBufferPtr buf, const char *filename,
xmlParserErrors ret;
int fd;
#ifdef LIBXML_HTTP_ENABLED
if (xmlIOHTTPMatch(filename)) {
if ((flags & XML_INPUT_NETWORK) == 0)
return(XML_IO_NETWORK_ATTEMPT);
buf->context = xmlIOHTTPOpen(filename);
if (buf->context != NULL) {
buf->readcallback = xmlIOHTTPRead;
buf->closecallback = xmlIOHTTPClose;
return(XML_ERR_OK);
}
}
#endif /* LIBXML_HTTP_ENABLED */
if (!xmlFileMatch(filename))
return(XML_IO_ENOENT);
@ -2886,17 +2778,5 @@ xmlCleanupOutputCallbacks(void)
xmlOutputCallbackNr = 0;
}
#ifdef LIBXML_HTTP_ENABLED
/**
* xmlRegisterHTTPPostCallbacks:
*
* DEPRECATED: Support for HTTP POST has been removed.
*/
void
xmlRegisterHTTPPostCallbacks(void) {
xmlRegisterDefaultOutputCallbacks();
}
#endif
#endif /* LIBXML_OUTPUT_ENABLED */