[pmwiki-users] Suggestion: $PostTargetUrl-Variable

Patrick R. Michaud pmichaud at pobox.com
Thu Sep 21 10:37:55 CDT 2006

On Thu, Sep 21, 2006 at 05:04:06PM +0200, Nils Knappmeier wrote:
> the latest bugfix of the AddDeleteLine-recipe made me think, if it 
> wouldn't be good to have something like a $PostTargetUrl-Variable. This 
> should contain the target URL to be used for POST-forms. Usually the 
> contents should be the same as $ScriptUrl, but if cleanurls are used, 
> especially with mod_rewrite, it should contain the real URL of 
> pmwiki.php, which is not subject to redirection.

For now, I think that if we have a $PostTargetUrl, it should be
established by convention as opposed to being designated in the core.
I.e., recipes can easily do:

    SDV($PostTargetUrl, $ScriptUrl);

But I really don't think we need or should have a separate variable for
this -- see below...

> The reason is simple: A lot of recipes (at least my AddDeleteLine and 
> MailForm) use POST-requests, then process the data and perform a 
> redirect back to  the BrowseHandler of the page. When you use CleanUrls, 
> it does not work, e.g. on pmwiki.org, to do a
>  <form target='http://pmwiki.org/wiki' method='post'>...</form>
> because the rewrite engine will redirect the request to something like 
> http://pmwiki.org/wiki/pmwiki.php, which results in the loss of all 
> POST-variables.

Actually, this isn't precisely true in many respects.  First, 
using mod_rewrite with CleanUrls (as described in the Cookbook)
does *not* cause a redirect or lose POST variables.  If it did, then
nobody would be able to post edits or enter passwords when using
CleanUrls, and clearly that's not the case.  

There may be some sites that have mod_rewrite configured to do
things using browser redirects instead of local rewrites, but I think 
those ought to be the exception and not the rule, and then I'm 
very curious to know how they're getting other things in PmWiki to

I also want to note in passing that

   <form action='http://www.pmwiki.org/wiki' method='post'>...</form>

works just fine with pmwiki.org.  (pmwiki.org isn't using mod_rewrite.
Even if it were, the above would work.)

> Since such a variable might be of use for a number of recipes, I would 
> suggest adding it to the core of PmWiki.

It seems to me that a recipe that wants to do POST should be able
to do exactly what PmWiki does when it performs POST operations.
If that's not the case, then I'm curious to know why things are
different for the recipe.

Lastly, we already have at least five PITS items open that are trying 
to "fix" perceived problems with $ScriptUrl:


I'd much prefer to come up with a solution that addresses all of
the problems, rather than come up with separate variables that
has to be set and maintained for each.


More information about the pmwiki-users mailing list