Commit 5c396548 authored by Daniel Veillard's avatar Daniel Veillard

applied patch from Aleksey Sanin fixing a problem in the canonicalization

* c14n.c: applied patch from Aleksey Sanin fixing a problem in the
  canonicalization algorithm
* doc/xml.html doc/index.html: added the C14N references on the
  index page.
Daniel
parent 9be6586c
Fri Mar 15 08:55:55 CET 2002 Daniel Veillard <daniel@veillard.com>
* c14n.c: applied patch from Aleksey Sanin fixing a problem in the
canonicalization algorithm
* doc/xml.html doc/index.html: added the C14N references on the
index page.
2002-03-13 jacob berkman <jacob@ximian.com>
* python/Makefile.am: remove LDADD and CFLAGS as this is broken
......
......@@ -266,8 +266,9 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur)
xmlNsPtr ns;
xmlListPtr list;
xmlNodePtr visible_parent;
xmlNodePtr node;
xmlNsPtr prev;
if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
#ifdef DEBUG_C14N
xmlGenericError(xmlGenericErrorContext,
......@@ -302,6 +303,7 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur)
* defined in node parents). By this we need to now walk thru
* all namespace in current node and all invisible ancesstors
*/
node = cur;
while (cur != visible_parent) {
for (ns = cur->nsDef; ns != NULL; ns = ns->next) {
/*
......@@ -311,6 +313,11 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur)
if ((xmlC14NIsXmlNs(ns)) || (xmlListSearch(list, ns) != NULL)) {
continue;
}
prev = xmlSearchNs(ctx->doc, node, ns->prefix);
if(prev != ns) {
/* we already processed a namespace with this name */
continue;
}
/*
* Lookup nearest namespace after visible parent having
......
......@@ -116,6 +116,11 @@ languages:</p>
<li>part of SGML Open Technical Resolution TR9401:1997</li>
<li>XML Catalogs Working Draft 06 August 2001: <a href="http://www.oasis-open.org/committees/entity/spec-2001-08-06.html">http://www.oasis-open.org/committees/entity/spec-2001-08-06.html</a>
</li>
<li>Canonical XML Version 1.0: <a href="http://www.w3.org/TR/xml-c14n">http://www.w3.org/TR/xml-c14n</a>
and the
<p>Exclusive XML Canonicalization CR draft <a href="http://www.w3.org/TR/xml-exc-c14n">http://www.w3.org/TR/xml-exc-c14n</a>
</p>
</li>
</ul>
<p>In most cases libxml tries to implement the specifications in a relatively
strict way. As of release 2.4.16, libxml2 passes all 1800+ tests from the <a href="http://www.oasis-open.org/committees/xml-conformance/">OASIS XML Tests
......
......@@ -50,6 +50,12 @@ languages:</p>
<li>part of SGML Open Technical Resolution TR9401:1997</li>
<li>XML Catalogs Working Draft 06 August 2001: <a
href="http://www.oasis-open.org/committees/entity/spec-2001-08-06.html">http://www.oasis-open.org/committees/entity/spec-2001-08-06.html</a></li>
<li>Canonical XML Version 1.0: <a
href="http://www.w3.org/TR/xml-c14n">http://www.w3.org/TR/xml-c14n</a>
and the
<p>Exclusive XML Canonicalization CR draft <a
href="http://www.w3.org/TR/xml-exc-c14n">http://www.w3.org/TR/xml-exc-c14n</a></p>
</li>
</ul>
<p>In most cases libxml tries to implement the specifications in a relatively
......@@ -2543,6 +2549,7 @@ xmlOutputBufferCreateOwn(FILE *file, xmlCharEncodingHandlerPtr encoder) {
} </pre>
......
......@@ -245,6 +245,7 @@ xmlOutputBufferCreateOwn(FILE *file, xmlCharEncodingHandlerPtr encoder) {
} </pre>
......
......@@ -846,83 +846,90 @@ xmlNanoHTTPConnectHost(const char *host, int port)
struct sockaddr *addr;
struct in_addr ia;
struct sockaddr_in sockin;
#ifdef SUPPORT_IP6
struct in6_addr ia6;
struct sockaddr_in6 sockin6;
#endif
int i;
int s;
#if defined(SUPPORT_IP6) && defined(RES_USE_INET6)
if (!(_res.options & RES_INIT))
res_init();
res_init();
_res.options |= RES_USE_INET6;
#endif
h=gethostbyname(host);
if (h==NULL)
{
const char * h_err_txt = "";
switch ( h_errno )
{
case HOST_NOT_FOUND:
h_err_txt = "Authoritive host not found";
break;
case TRY_AGAIN:
h_err_txt =
"Non-authoritive host not found or server failure.";
break;
case NO_RECOVERY:
h_err_txt =
"Non-recoverable errors: FORMERR, REFUSED, or NOTIMP.";
break;
case NO_ADDRESS:
h_err_txt = "Valid name, no data record of requested type.";
break;
default:
h_err_txt = "No error text defined.";
break;
}
xmlGenericError( xmlGenericErrorContext,
"xmlNanoHTTPConnectHost: %s '%s' - %s",
"Failed to resolve host", host, h_err_txt );
return(-1);
h = gethostbyname(host);
if (h == NULL) {
#if defined(HAVE_NETDB_H) && defined(HOST_NOT_FOUND)
const char *h_err_txt = "";
switch (h_errno) {
case HOST_NOT_FOUND:
h_err_txt = "Authoritive host not found";
break;
case TRY_AGAIN:
h_err_txt =
"Non-authoritive host not found or server failure.";
break;
case NO_RECOVERY:
h_err_txt =
"Non-recoverable errors: FORMERR, REFUSED, or NOTIMP.";
break;
case NO_ADDRESS:
h_err_txt =
"Valid name, no data record of requested type.";
break;
default:
h_err_txt = "No error text defined.";
break;
}
xmlGenericError(xmlGenericErrorContext,
"xmlNanoHTTPConnectHost: %s '%s' - %s",
"Failed to resolve host", host, h_err_txt);
#else
xmlGenericError(xmlGenericErrorContext,
"xmlNanoHTTPConnectHost: %s '%s'",
"Failed to resolve host", host);
#endif
return (-1);
}
for(i=0; h->h_addr_list[i]; i++)
{
if (h->h_addrtype == AF_INET) {
/* A records (IPv4) */
memcpy(&ia, h->h_addr_list[i], h->h_length);
sockin.sin_family = h->h_addrtype;
sockin.sin_addr = ia;
sockin.sin_port = htons(port);
addr = (struct sockaddr *)&sockin;
for (i = 0; h->h_addr_list[i]; i++) {
if (h->h_addrtype == AF_INET) {
/* A records (IPv4) */
memcpy(&ia, h->h_addr_list[i], h->h_length);
sockin.sin_family = h->h_addrtype;
sockin.sin_addr = ia;
sockin.sin_port = htons(port);
addr = (struct sockaddr *) &sockin;
#ifdef SUPPORT_IP6
} else if (h->h_addrtype == AF_INET6) {
/* AAAA records (IPv6) */
memcpy(&ia6, h->h_addr_list[i], h->h_length);
sockin6.sin_family = h->h_addrtype;
sockin6.sin_addr = ia6;
sockin6.sin_port = htons(port);
addr = (struct sockaddr *)&sockin6;
} else if (h->h_addrtype == AF_INET6) {
/* AAAA records (IPv6) */
memcpy(&ia6, h->h_addr_list[i], h->h_length);
sockin6.sin_family = h->h_addrtype;
sockin6.sin_addr = ia6;
sockin6.sin_port = htons(port);
addr = (struct sockaddr *) &sockin6;
#endif
} else
break; /* for */
s = xmlNanoHTTPConnectAttempt(addr);
if (s != -1)
return(s);
} else
break; /* for */
s = xmlNanoHTTPConnectAttempt(addr);
if (s != -1)
return (s);
}
#ifdef DEBUG_HTTP
xmlGenericError(xmlGenericErrorContext,
"xmlNanoHTTPConnectHost: unable to connect to '%s'.\n", host);
"xmlNanoHTTPConnectHost: unable to connect to '%s'.\n",
host);
#endif
return(-1);
return (-1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment