mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-01 10:06:59 +03:00
starting work to fix the HTTP/XML parser integration. Daniel
* nanohttp.c xmlIO.c include/libxml/nanohttp.h: starting work to fix the HTTP/XML parser integration. Daniel
This commit is contained in:
22
xmlIO.c
22
xmlIO.c
@ -2108,6 +2108,7 @@ xmlOutputBufferClose(xmlOutputBufferPtr out)
|
||||
xmlParserInputBufferPtr
|
||||
xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
|
||||
xmlParserInputBufferPtr ret;
|
||||
int is_http = 0;
|
||||
int i = 0;
|
||||
void *context = NULL;
|
||||
|
||||
@ -2125,8 +2126,11 @@ xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
|
||||
if ((xmlInputCallbackTable[i].matchcallback != NULL) &&
|
||||
(xmlInputCallbackTable[i].matchcallback(URI) != 0)) {
|
||||
context = xmlInputCallbackTable[i].opencallback(URI);
|
||||
if (context != NULL)
|
||||
if (context != NULL) {
|
||||
if (xmlInputCallbackTable[i].opencallback == xmlIOHTTPOpen)
|
||||
is_http = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3080,6 +3084,22 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID,
|
||||
xmlLoaderErr(ctxt, "failed to load external entity \"%s\"\n",
|
||||
(const char *) resource);
|
||||
}
|
||||
if ((ret->buf != NULL) && (ret->buf->readcallback == xmlIOHTTPRead)) {
|
||||
const char *encoding;
|
||||
const char *redir;
|
||||
|
||||
encoding = xmlNanoHTTPEncoding(ret->buf->context);
|
||||
redir = xmlNanoHTTPRedir(ret->buf->context);
|
||||
if (redir != NULL) {
|
||||
if (ret->filename != NULL)
|
||||
xmlFree((xmlChar *) ret->filename);
|
||||
if (ret->directory != NULL) {
|
||||
xmlFree((xmlChar *) ret->directory);
|
||||
ret->directory = NULL;
|
||||
}
|
||||
ret->filename = (char *) xmlStrdup((const xmlChar *)redir);
|
||||
}
|
||||
}
|
||||
if ((resource != NULL) && (resource != (xmlChar *) URL))
|
||||
xmlFree(resource);
|
||||
return(ret);
|
||||
|
Reference in New Issue
Block a user