Christoph Zwerschke a écrit : > 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. > > Yes I have a rewrite rule, but the rule does not apply in this case. This may explain that I don't get the expected result. What I don't understand is that, even if the url was rewritten, the result is simply wrong... The apache name must not be used.
> 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? > > I wouldn't have written that if the result was the same... ;-) ------------------------------------------------------------------------- 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 Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss