version 1.20, 2000/02/13 19:56:23
|
version 1.21, 2000/04/03 18:45:48
|
Line 34
|
Line 34
|
#include <zlib.h> |
#include <zlib.h> |
#endif |
#endif |
|
|
#include "xmlmemory.h" |
#include <libxml/xmlmemory.h> |
#include "parser.h" |
#include <libxml/parser.h> |
#include "parserInternals.h" |
#include <libxml/parserInternals.h> |
#include "xmlIO.h" |
#include <libxml/xmlIO.h> |
#include "nanohttp.h" |
#include <libxml/nanohttp.h> |
#include "nanoftp.h" |
#include <libxml/nanoftp.h> |
|
|
/* #define DEBUG_INPUT */ |
/* #define DEBUG_INPUT */ |
/* #define VERBOSE_FAILURE */ |
/* #define VERBOSE_FAILURE */ |
Line 99 xmlFreeParserInputBuffer(xmlParserInputB
|
Line 99 xmlFreeParserInputBuffer(xmlParserInputB
|
if (in->gzfile != NULL) |
if (in->gzfile != NULL) |
gzclose(in->gzfile); |
gzclose(in->gzfile); |
#endif |
#endif |
|
#ifdef LIBXML_HTTP_ENABLED |
if (in->httpIO != NULL) |
if (in->httpIO != NULL) |
xmlNanoHTTPClose(in->httpIO); |
xmlNanoHTTPClose(in->httpIO); |
|
#endif |
|
#ifdef LIBXML_FTP_ENABLED |
if (in->ftpIO != NULL) |
if (in->ftpIO != NULL) |
xmlNanoFTPClose(in->ftpIO); |
xmlNanoFTPClose(in->ftpIO); |
|
#endif |
if (in->fd >= 0) |
if (in->fd >= 0) |
close(in->fd); |
close(in->fd); |
memset(in, 0xbe, (size_t) sizeof(xmlParserInputBuffer)); |
memset(in, 0xbe, (size_t) sizeof(xmlParserInputBuffer)); |
Line 135 xmlParserInputBufferCreateFilename(const
|
Line 139 xmlParserInputBufferCreateFilename(const
|
|
|
if (filename == NULL) return(NULL); |
if (filename == NULL) return(NULL); |
|
|
|
#ifdef LIBXML_HTTP_ENABLED |
if (!strncmp(filename, "http://", 7)) { |
if (!strncmp(filename, "http://", 7)) { |
httpIO = xmlNanoHTTPOpen(filename, NULL); |
httpIO = xmlNanoHTTPOpen(filename, NULL); |
if (httpIO == NULL) { |
if (httpIO == NULL) { |
Line 144 xmlParserInputBufferCreateFilename(const
|
Line 149 xmlParserInputBufferCreateFilename(const
|
#endif |
#endif |
return(NULL); |
return(NULL); |
} |
} |
} else if (!strncmp(filename, "ftp://", 6)) { |
} else |
|
#endif /* LIBXML_HTTP_ENABLED */ |
|
#ifdef LIBXML_FTP_ENABLED |
|
if (!strncmp(filename, "ftp://", 6)) { |
ftpIO = xmlNanoFTPOpen(filename); |
ftpIO = xmlNanoFTPOpen(filename); |
if (ftpIO == NULL) { |
if (ftpIO == NULL) { |
#ifdef VERBOSE_FAILURE |
#ifdef VERBOSE_FAILURE |
Line 153 xmlParserInputBufferCreateFilename(const
|
Line 161 xmlParserInputBufferCreateFilename(const
|
#endif |
#endif |
return(NULL); |
return(NULL); |
} |
} |
} else if (!strcmp(filename, "-")) { |
} else |
|
#endif /* LIBXML_FTP_ENABLED */ |
|
if (!strcmp(filename, "-")) { |
#ifdef HAVE_ZLIB_H |
#ifdef HAVE_ZLIB_H |
input = gzdopen (fileno(stdin), "r"); |
input = gzdopen (fileno(stdin), "r"); |
if (input == NULL) { |
if (input == NULL) { |
Line 362 xmlParserInputBufferGrow(xmlParserInputB
|
Line 372 xmlParserInputBufferGrow(xmlParserInputB
|
fprintf(stderr, "xmlParserInputBufferGrow : out of memory !\n"); |
fprintf(stderr, "xmlParserInputBufferGrow : out of memory !\n"); |
return(-1); |
return(-1); |
} |
} |
|
#ifdef LIBXML_HTTP_ENABLED |
if (in->httpIO != NULL) { |
if (in->httpIO != NULL) { |
res = xmlNanoHTTPRead(in->httpIO, &buffer[0], len); |
res = xmlNanoHTTPRead(in->httpIO, &buffer[0], len); |
} else if (in->ftpIO != NULL) { |
} else |
|
#endif |
|
#ifdef LIBXML_FTP_ENABLED |
|
if (in->ftpIO != NULL) { |
res = xmlNanoFTPRead(in->ftpIO, &buffer[0], len); |
res = xmlNanoFTPRead(in->ftpIO, &buffer[0], len); |
} else if (in->file != NULL) { |
} else |
|
#endif |
|
if (in->file != NULL) { |
res = fread(&buffer[0], 1, len, in->file); |
res = fread(&buffer[0], 1, len, in->file); |
#ifdef HAVE_ZLIB_H |
#ifdef HAVE_ZLIB_H |
} else if (in->gzfile != NULL) { |
} else if (in->gzfile != NULL) { |