Re: [xslt] document() implementation: unquoting
- From: Daniel Veillard <veillard redhat com>
- To: xslt gnome org
- Cc: zack cs unibo it, Glen Nakamura <gen flex com>
- Subject: Re: [xslt] document() implementation: unquoting
- Date: Wed, 4 Dec 2002 06:45:11 -0500
On Wed, Dec 04, 2002 at 11:53:18AM +0100, Stefano Zacchiroli wrote:
> [ Please Cc: me answers because I'm not subscribed to this list ]
>
> As already reported by Glen Nakamura in 18 January 2002 and 21 March
> 2002 on this list (who recevied no answers), document() libxslt's
> implementation perform an unquoting before trying to access the
> specified resource.
http://mail.gnome.org/archives/xslt/2002-March/msg00069.html
<xsl:apply-templates select="document('http://xslt.org/escape%20space.xml')"/>
ends up as
GET /escape space.xml HTTP/1.0
instead of
GET /escape%20space.xml HTTP/1.0
> Is this supposed to be a bug?
sounds like it, yes.
> I've looked at the XSLT specifications and there is no mention about
> quotingness of the document argument.
no because it's handled at another level of the specification stack, i.e.
the HTTP RFCs and URI ones.
> Anyway it seems to be a bit strange, user is expected document to fetch
> the URI as it was passed, not unquoted.
that's not quoting, it is escaping.
The unescaping is done as part of the URI reference analysis. What's missing
is that once passed to the HTTP layer, the resulting URL should be escaped
before being pushed down the socket.
> I would only like to know if this is supposed to be a bug or a desired
> feature (and so meaning that it wont be changed in the future).
I think it should be fixed, i.e. it's a bug. The enclosed patch does this,
thanks for the report,
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Index: nanohttp.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/nanohttp.c,v
retrieving revision 1.57
diff -c -r1.57 nanohttp.c
*** nanohttp.c 14 Jun 2002 17:07:09 -0000 1.57
--- nanohttp.c 4 Dec 2002 11:41:09 -0000
***************
*** 76,81 ****
--- 76,82 ----
#include <libxml/parser.h> /* for xmlStr(n)casecmp() */
#include <libxml/nanohttp.h>
#include <libxml/globals.h>
+ #include <libxml/uri.h>
/**
* A couple portability macros
***************
*** 371,376 ****
--- 372,378 ----
static xmlNanoHTTPCtxtPtr
xmlNanoHTTPNewCtxt(const char *URL) {
xmlNanoHTTPCtxtPtr ret;
+ xmlChar *escaped;
ret = (xmlNanoHTTPCtxtPtr) xmlMalloc(sizeof(xmlNanoHTTPCtxt));
if (ret == NULL) return(NULL);
***************
*** 381,387 ****
ret->fd = -1;
ret->ContentLength = -1;
! xmlNanoHTTPScanURL(ret, URL);
return(ret);
}
--- 383,395 ----
ret->fd = -1;
ret->ContentLength = -1;
! escaped = xmlURIEscapeStr(BAD_CAST URL, BAD_CAST"@/:=?;#%&");
! if (escaped != NULL) {
! xmlNanoHTTPScanURL(ret, (const char *) escaped);
! xmlFree(escaped);
! } else {
! xmlNanoHTTPScanURL(ret, URL);
! }
return(ret);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]