sophana wrote:
> I've just found out that request().serverURL() does not return the real
> PATH of the request.
> It replaces the http host with the server name configured in apache.
> Is this the intended behaviour?
> I can't use this, because the session is lost when returning to another url.
Actually serverURL() normally constructs the URI using HTTP_HOST which
is the hostname given by the client, not the one configured in Apache,
i.e. it does the same as your requestURL() method.
However, if SCRIPT_URI is available (i.e. when the rewrite engine is on,
as seems to be in your case), then this value is used, and the problem
seems to be that this value uses the canonical server name configured in
Apache, not the one used by the client in the request.
My suggestion is to add a boolean parameter "canonical" to the
serverURL() method which will cause SCRIPT_URI to be ignored if set to
False, and we can set canonical=False by default.
> def isSecure(self):
> return self.request().serverDictionary().get('HTTPS',None) == 'on'
Right, we should really define isSecure like that in HTTPRequest.
> def requestURL(self):
> req=self.request()
> if self.isSecure():
> url='https://'
> else:
> url='http://'
> url+=req.serverDictionary()['HTTP_HOST']+req.serverPath()
> return url
This does the same as serverURL() except for checking SCRIPT_URI, right?
-- Chris
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Webware-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/webware-discuss