[python-win32] [pywin32-bugs] ISAPI Set-Cookie Probs

Tom Wells drshade at gmail.com
Mon Feb 25 08:16:56 CET 2008


Hi Mark

Thanks for the reply - I've subscribed and copied the correct mailing list
now.

Actually there is no such fc.SetHeader() function (assuming fc is the
FILTER_CONTEXT structure) - you may be thinking about the pp.SetHeader()
function (where pp is the PREPROC notification structure). I'm aware of
this, but need to be able to set my cookie after (or during) the
SF_NOTIFY_AUTHENTICATION notification, which unfortunately is comes directly
after the preproc notification.

SendResponseHeaders() not working is odd, and maybe i'm just
misunderstanding it's use, but a call to fc.SendResponseHeaders('Set-Cookie:',
'TEST_COOKIE=VALUE') within the SEND_DATA notification produces a response
packet looking like (from memory):
HTTP/1.x Set-Cookie: TEST_COOKIE=VALUE
Content-Type: text/html
Content-Length: 237
--- SNIP ---

So it seems like the function is for writing an HTTP response value (200,
302 etc), and not for actually setting an HTTP header.

Another thought I had was keeping a reference to the PREPROC notification
structure, and then calling SetHeader() on it inside the AUTHENTICATION
notification - do you think this might work?

Thanks,
Tom

On Sat, Feb 23, 2008 at 12:44 AM, Mark Hammond <mhammond at skippinet.com.au>
wrote:

>  Actually, this is just for automated emails from the bug tracker – you
> should send them to python-win32 at python.org (I'll try and make that more
> obvious on the subscription page).  But a quick note about your problem: I'm
> not sure how I missed AddResponseHeaders(), but I will add it now, so it
> should make pywin32-211.  I'm not sure why SendResponseHeader() is failing,
> but another option is fc.SetHeader() – see the 'redirector' sample.
> Please followup via the above list
>
>
>
> *From:* pywin32-bugs-bounces at lists.sourceforge.net [mailto:
> pywin32-bugs-bounces at lists.sourceforge.net] *On Behalf Of *Tom Wells
> *Sent:* Saturday, 23 February 2008 5:29 AM
> *To:* pywin32-bugs at lists.sourceforge.net
> *Subject:* [pywin32-bugs] ISAPI Set-Cookie Probs
>
>
>
> Hi Guys
>
> Hope this is the correct mailing list for this kind of post!
>
> I've been busy busy writing an ISAPI Filter in Python using Pywin32 and
> have made loads of progress. However I've come across a bit of an issue
> while trying to set a cookie within my filter code. I'm actually porting an
> existing ISAPI Filter (written in C++) to make use of python instead, so
> have the luxury of having a good set of reference source code.
>
> My issue is that I don't have access to AddResponseHeaders() on the
> FILTER_CONTEXT object, and thus battling to actually set the cookie value.
> I've tried using fc.SendResponseHeader() within the
> SF_NOTIFY_SEND_RESPONSE event too - but this produces some 'interesting'
> results so quite sure it's the wrong approach.
>
> So my last resort is to grab the pywin32 sources and implement the
> wrapping, but i'd far prefer to be able to use pywin32 exactly as installed
> and not have to patch as this filter could quite likely be rolled out to
> multiple sites.
>
> Does anyone know or could suggest an alternate approach to setting a
> cookie?
>
> Thanks,
> Tom
>
> p.s. I have used the following page as a reference to my set-cookie issue:
> http://support.microsoft.com/kb/q168864/
>



-- 
http://www.tomwells.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080225/256ef249/attachment.htm 


More information about the python-win32 mailing list