This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5421 - URI resolution doesn't take <base href> into account
Summary: URI resolution doesn't take <base href> into account
Status: RESOLVED FIXED
Alias: None
Product: mobileOK Basic checker
Classification: Unclassified
Component: Java Library (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Dominique Hazael-Massieux
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-25 13:49 UTC by Dominique Hazael-Massieux
Modified: 2008-07-29 10:44 UTC (History)
1 user (show)

See Also:


Attachments

Description Dominique Hazael-Massieux 2008-01-25 13:49:42 UTC
I don't think we're taking into account when the base URI for relative URIs resolution is set in the <base href> element in XHTML.

(I haven't had the time to create a test for it, but thought I would record now rather than forgetting it later)

I know for sure that some of the XSLTs tests I edited didn't take it into account, but I suspect this actually affects also some pieces of the Java code.
Comment 1 Sean Owen 2008-04-01 04:13:19 UTC
I can provide Java hooks for handling this, but need to consult with Roland on how this is done in XSLT.
Comment 2 Dominique Hazael-Massieux 2008-04-01 08:46:21 UTC
I can deal with the XSLT part - I don't think Roland can spend any time on this project for the time being. My concern was primarily for links resolutions that are done inside the Java code (e.g. for retrieving style sheets, images, etc)
Comment 3 Roland G 2008-04-01 10:15:50 UTC
(In reply to comment #2)
> I can deal with the XSLT part - I don't think Roland can spend any time on this
> project for the time being. My concern was primarily for links resolutions that
> are done inside the Java code (e.g. for retrieving style sheets, images, etc)

Should we convert the base href into an xml:base and let the Java code handle the xml base?
Comment 4 Sean Owen 2008-04-05 01:27:09 UTC
This is fixed unless there are remaining XSL changes still needed. The HTTPResource.parse() method now takes both a String *and a URI*, which is the base URI against which to resolve the String. It can be null.
Comment 5 Dominique Hazael-Massieux 2008-07-01 15:45:36 UTC
Done for ImagesSpecifySizeTest.xsl and TablesLayout.xsl, but may need to be applied to ObjectsOrScript, includedResources.xsl depending on the way we implement the object processing (bug #5774).

I also fixed a bug where the base URI wasn't correctly calculated after a redirect.
Comment 6 fd 2008-07-22 11:54:00 UTC
Given that the ImagesSpecifySizeTest.xsl stylesheet template that checks the image starts with:

<xsl:template match="html:img">
 <!-- Check the image exists on moki -->
 <xsl:if test="/moki/images/image[URI[text() = moki:resolve-uri(current()/@src,/moki/primaryDoc/retrieval/retrievedURI)]]">

... which does not take into account the <base> element, and given that tests are only applied if this condition is met, it is not done in ImagesSpecifySizeTest.xsl

At least, the checker fails to raise a FAIL for the following test:
 IMAGES_SPECIFY_SIZE 8
Comment 7 Dominique Hazael-Massieux 2008-07-22 12:02:22 UTC
fixed for ImagesSpecifySize; I haven't checked whether this needs to apply to ObjectsOrScripts and co yet.
Comment 8 fd 2008-07-29 10:44:11 UTC
On my trip to fix the Object Processing rules, I also cleaned the part that resolves relative URIs against either the one of the primary document OR the one defined in a <base> element in the XSLT stylesheets.

To do that, I defined a moki:get-retrieved-resource function in functions.xsl, that is now being called in all places that needed to get the resource that was retrieved in the moki from its URI (which typically happens when the HTML code is being parsed for objects and images).

I think that closes the bug. Let me know if I missed something.