[pmwiki-users] strange site behavior

Patrick R. Michaud pmichaud at pobox.com
Sun Jun 10 13:22:21 CDT 2007


On Sun, Jun 10, 2007 at 08:07:32PM +0200, jdd wrote:
> Patrick R. Michaud wrote:
> > On Sun, Jun 10, 2007 at 04:30:45PM +0200, jdd wrote:
> >> jdd wrote:
> >>
> >>> http://claire.dodin.net/claire.dodin.net/data/index.php
> >> seems like using
> >>
> >> $ScriptUrl = '/data/';
> >> $PubDirUrl = '/data/pub';
> >>
> >> fixes the problem. hope this don't add an other
> > 
> > Normally $ScriptUrl should be set to a fully-qualified url,
> > not a relative one.  Otherwise things such as RSS feeds and
> > other items that require full urls won't work properly.
> 
> I thought so, but what can be the problem qoted? I have no more 
> problem since I used these urls... ???

PmWiki uses $ScriptUrl whenever it issues a HTTP redirect, and to
generate the links to individual items in RSS feeds.  

For example, PmWiki uses the value of $ScriptUrl to generate
the url that is part of the Location: header in a HTTP 302 redirect.
Normally this becomes something like:

    Location: http://claire.dodin.net/data/Group/PageName

However, if $ScriptUrl is set to a relative url, the Location:
header ends up as

    Location: /data/Group/PageName

which isn't a valid HTTP Location header [1].  Some webservers 
and browsers are nice enough to automatically do the expected
thing with an improper Location field, but others are not.  So,
even if it looks like things are working properly on your system,
they might not work properly for others.

Similarly, in an RSS feed the <link> element provides the url
for an <item> in the feed.  Normally this would be:

    <link>http://claire.dodin.net/data/Group/PageName</link>

However, if $ScriptUrl is set to a relative value, then
the <link> element becomes

    <link>/data/Group/PageName</link>

which doesn't follow the spec, and many feed aggregators will not
be able to handle relative urls such as this.

There are probably other examples where a relative value for
$ScriptUrl causes things to work improperly -- these are the
two that always come to my mind when asked about it.

Pm

[1] From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30:

    The Location response-header field is used to redirect the 
    recipient to a location other than the Request-URI for 
    completion of the request or identification of a new resource. 
    [...] The field value consists of a single absolute URI.





More information about the pmwiki-users mailing list