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
This commit is contained in:
Daniel Veillard 2002-03-15 07:57:50 +00:00
parent 9be6586ca9
commit 5c39654822
6 changed files with 93 additions and 59 deletions

View File

@ -1,3 +1,10 @@
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

9
c14n.c
View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -245,6 +245,7 @@ xmlOutputBufferCreateOwn(FILE *file, xmlCharEncodingHandlerPtr encoder) {
} </pre>

View File

@ -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;
h = gethostbyname(host);
if (h == NULL) {
#if defined(HAVE_NETDB_H) && defined(HOST_NOT_FOUND)
const char *h_err_txt = "";
case NO_RECOVERY:
h_err_txt =
"Non-recoverable errors: FORMERR, REFUSED, or NOTIMP.";
break;
switch (h_errno) {
case HOST_NOT_FOUND:
h_err_txt = "Authoritive host not found";
break;
case NO_ADDRESS:
h_err_txt = "Valid name, no data record of requested type.";
break;
case TRY_AGAIN:
h_err_txt =
"Non-authoritive host not found or server failure.";
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);
}
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;
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
} else
break; /* for */
s = xmlNanoHTTPConnectAttempt(addr);
if (s != -1)
return(s);
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;
#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;
#endif
} 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);
}