Groups > Symbian > Symbian EPOC connect > Re: Adding Cookie Filter




Adding Cookie Filter

Adding Cookie Filter
Thu, 14 Sep 2006 21:04:26 +053
Hi all,

I am using the RHttpSession and RHttpTransaction classes for retrieving
web pages from the remote server. I am using Series 60 2nd Ed FP2 platform.
I want to read the "Set-Cookie" http response header value.
However, as the Cookie filter is not installed by default, the
"Set-Cookie"
values are getting suppressed and being incorrectly shown as
"Cookie".
I want to install the cookie filter so that i can read the actual cookie
values being sent down.

For this, i derive my retriever class from MHTTPFilter.
In this class  i do the following steps.
1. Open a http session handle.
   iSession.OpenL();

2. Add a cookie filter.

   // Get the filter collection.
   RHTTPFilterCollection allFilters = iSession.FilterCollection();
   RStringF filterName = iSession.StringPool().StringF(HTTP::ECookieFilter,

RHTTPSession::GetTable());
   RStringF hdrName = iSession.StringPool().OpenFStringL(KNullDesC8);
   TRAPD(err,allFilters.AddFilterL(*this,
                                                     THTTPEvent::EAll,
                                                      hdrName,
                                                      -1,
                                                     MHTTPFilter::ECookies,
                                                     filterName))

   Before the function call returns, the MHFLoad(RHTTPSession,
THTTPFilterHandle)
   function is called by the framework. (This is because the Retriever class
is derived from MHTTPFilter).

   I'm not sure what action needs to be taken in this function. Any pointers
will help.

3. After this, the err value returned is KErrNone, so i presume that the
filter is added to the
   filter queue for the current session.

4. However when i retrieve a file from say "http://news.bbc.co.uk"
the
cookies are still suppressed
   and i see a single set cookie header in the response.
   "Set-Cookie: Cookie"

Any pointers as to how to add and install a filter will be helpful.

Thanks in advance,
Shashi.





Post Reply
Re: Adding Cookie Filter
Mon, 18 Sep 2006 06:58:48 -000
See Symbian FAQ 1411 "How can I ensure a HTTP filter is implicitly loaded
in
all HTTP sessions?"
"Shashi" <nospam@nowhere.com> wrote in message
news:k4q6AQB2GHA.1380@UKCOL01WWEB01.symbian.intra...
> Hi all,
>
> I am using the RHttpSession and RHttpTransaction classes for retrieving
> web pages from the remote server. I am using Series 60 2nd Ed FP2
platform.
> I want to read the "Set-Cookie" http response header value.
> However, as the Cookie filter is not installed by default, the
"Set-Cookie"
> values are getting suppressed and being incorrectly shown as
"Cookie".
> I want to install the cookie filter so that i can read the actual cookie
> values being sent down.
>
> For this, i derive my retriever class from MHTTPFilter.
> In this class  i do the following steps.
> 1. Open a http session handle.
>    iSession.OpenL();
>
> 2. Add a cookie filter.
>
>    // Get the filter collection.
>    RHTTPFilterCollection allFilters = iSession.FilterCollection();
>    RStringF filterName =
iSession.StringPool().StringF(HTTP::ECookieFilter,
>
> RHTTPSession::GetTable());
>    RStringF hdrName = iSession.StringPool().OpenFStringL(KNullDesC8);
>    TRAPD(err,allFilters.AddFilterL(*this,
>                                                      THTTPEvent::EAll,
>                                                       hdrName,
>                                                       -1,
>
MHTTPFilter::ECookies,
>                                                      filterName))
>
>    Before the function call returns, the MHFLoad(RHTTPSession,
> THTTPFilterHandle)
>    function is called by the framework. (This is because the Retriever
class
> is derived from MHTTPFilter).
>
>    I'm not sure what action needs to be taken in this function. Any
pointers
> will help.
>
> 3. After this, the err value returned is KErrNone, so i presume that the
> filter is added to the
>    filter queue for the current session.
>
> 4. However when i retrieve a file from say
"http://news.bbc.co.uk" the
> cookies are still suppressed
>    and i see a single set cookie header in the response.
>    "Set-Cookie: Cookie"
>
> Any pointers as to how to add and install a filter will be helpful.
>
> Thanks in advance,
> Shashi.
>
>
>
>
>
>

Post Reply
about | contact