×

Discussion Board

Results 1 to 14 of 14

Hybrid View

  1. #1
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    HTTP-Core 4 panic while reading cookies

    Hi,

    Please consider this code:

    Code:
    			RHTTPResponse resp1 = aTransaction.Response();
    			RStringPool strP = aTransaction.Session().StringPool();
    			RHTTPHeaders hdr = resp1.GetHeaderCollection();
    			THTTPHdrFieldIter it = hdr.Fields();
    			TBuf<512> fieldName16;
    			TBuf<512> fieldVal16;
    
    			while (it.AtEnd() == EFalse)
    				{
    				// Get the name of the next header field <br>
    				RStringTokenF fieldName = it();
    				RStringF fieldNameStr = strP.StringF(fieldName);
    
    				// Check it does indeed exist
    				THTTPHdrVal fieldVal;
    				if (hdr.GetField(fieldNameStr, 0, fieldVal) == KErrNone)
    					{
    					RStringF wwwCookie = strP.StringF(HTTP::ESetCookie,	RHTTPSession::GetTable());
    					TInt mycookieCount = hdr.FieldPartsL(wwwCookie);
    
    					if (fieldNameStr == wwwCookie)
    						{
    						RStringF nameValStr;
    						RStringF valueValStr;
    
    						// Check the cookie name and value
    						RStringF name = strP.StringF(HTTP::ECookieName,	RHTTPSession::GetTable());
    						RStringF value = strP.StringF(HTTP::ECookieValue, RHTTPSession::GetTable());
    
    						THTTPHdrVal nameVal, valueVal;
    						
    						if (hdr.GetParam(wwwCookie, name, nameVal) == KErrNone)
    							{
    							nameValStr = strP.StringF(nameVal.StrF());
    							fieldName16.Copy(nameValStr.DesC());
    							}
    						if (hdr.GetParam(wwwCookie, value, valueVal) == KErrNone)
    							{
    							valueValStr = strP.StringF(valueVal.StrF());
    							fieldVal16.Copy(valueValStr.DesC());
    							}
    
    						// Create a cookie object with name, value and URI and save
    						// it as a file (for example, to app. private directory)
    						// URI can be obtained with:						
    						 //const TUriC8& requestUri = aTransaction.Request().URI();
    						}
    					}
    				// Advance the iterator
    				++it;
    				}
    			break;
    I am using this code to read incoming cookies. The application crashes at the pointed line. No idea what is going wrong in here.

    Please suggest.

    Thanks

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: HTTP-Core 4 panic while reading cookies

    You may want to find out which part of the line fails (nameVal.StrF() may or may not die already in itself).
    Unfortunately the on-line documentation is no more, but according to http://www.developer.nokia.com/Commu...P-CORE-6-Panic, it seems to be a very different panic than what happens in the red line.
    Ah, yes, SymLab still has the docs: http://www.symlab.org/main/documenta...B9652A172.html, based on that you may want to check if MHFRunError gets invoked, and how.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: HTTP-Core 4 panic while reading cookies

    I know HTTP Core 4 means Mismatch between header's type and its attempted use. But can't figure out what is wrong. The response is for a http GET request. Do we have to set the appropriate headers before making the http request?
    Right now the following headers are set:

    SetHeaderL( hdr, HTTP::EUserAgent, KUserAgent );
    SetHeaderL( hdr, HTTP::EAccept, KAccept );

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: HTTP-Core 4 panic while reading cookies

    Sorry, I absolutely misread the title for 6. My only excuse is that the sun recently started shining on my display.
    Are you following some existing code? Like http://www.developer.nokia.com/Commu...ymbian_C%2B%2B? Are there any modifications?

  5. #5
    Registered User
    Join Date
    Sep 2008
    Location
    Vancouver, Canada
    Posts
    588

    Re: HTTP-Core 4 panic while reading cookies

    Yes i am following the same without any modification. The same code is giving this panic. And
    My only excuse is that the sun recently started shining on my display.
    was funny. Certainly brought smile on my face

    pavarang also suggested good links. I will try them as well and will get back.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: HTTP-Core 4 panic while reading cookies

    Quote Originally Posted by raj8nokiaforum View Post

    pavarang also suggested good links. I will try them as well and will get back.
    i have a new one! :-D
    in this article
    http://www.developer.nokia.com/Commu...ymbian_C%2B%2B

    they check the http header val type:

    Code:
    if (nameVal.Type() == THTTPHdrVal::KStrFVal)
                            {
                                strF = nameVal.StrF();
                                nameValStr = strP.StringF(strF); // this is the cookie's name
                            }
                            else if (nameVal.Type() == THTTPHdrVal::KStrVal)
                            {
                                str = nameVal.Str(); // this is the cookie's name
                            }

  7. #7
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: HTTP-Core 4 panic while reading cookies

    raj8nokiaforum asked about HTTP-Core-4, so "Mismatch between header's type and its attempted use. " :-)
    maybe something related to Str() and StrF() ?
    http://www.developer.nokia.com/Commu...request-header
    http://www.developer.nokia.com/Commu...99-HTTP-core-4

    anyway we should do something for missing online symbian docs... so that we don't redirect people on external links....

    regards
    pg

    EDIT: sorry, posted just after raj8nokiaforum reply

Similar Threads

  1. HTTP CORE 6 Panic
    By yanamaddinaveen in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2011-12-05, 11:39
  2. HTTP - CORE 6 error
    By rati2010 in forum Symbian
    Replies: 6
    Last Post: 2009-09-03, 09:34
  3. [moved] 3rd Party Application reading cookies
    By tej007 in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2008-10-16, 13:32
  4. CHTTPFormEncoder and HTTP-CORE 10 Panic
    By Dexterp37 in forum Symbian Networking & Messaging (Closed)
    Replies: 7
    Last Post: 2006-08-11, 18:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×