Hi,
I (and probably other) have struggled a nasty problem occurred when WebKit used as an application server behind a IIS. Here I'd like to give a simple solution for those interested and (may be) to be included in the next Webware release.
Problem description: When you put some data on your session object and redirects to another WebKit page you don't find the data. In fact, you could discover that you have another (brand new) session object!
Explanation: This is due to the fact how WebKit implements session support and how IIS handles redirects (HTTP 303). When new session is created, WebKit sets cookie _SID_ and pass it along with response (which happened to be a redirect). But unfortunately, IIS don't pass the redirect to browser. It does "internal redirect" and goes for the url specified in it. While doing this the _SID_ cookie is lost and WebKit starts another new session as it doesn't see the SID.
Solution: Pass _SID_ in a URL instead of a cookie so that it wont lost. WebKit would check the query string as well when looking for SID.
Here is how I do it (in my custom Page class):
def injectIntoUrl(url, name, value): "Injects a parameter with specified name and value into URL." if '?' in url: return "%s&%s=%s" % (url, name, value) else: return "%s?%s=%s" % (url, name, value)
class SitePage(Page):
# ...
def sendRedirectAndEnd(self, url):
sid = self.session().identifier()
url = injectIntoUrl(url, '_SID_', sid)
Page.sendRedirectAndEnd(self, url)Hmm. Just realized that is not a perfect solution if redirect can go outside WebKit, so an improvement is wellcomed.
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
