×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    49

    CHTTPFormEncoder and HTTP-CORE 10 Panic

    Hi there!

    I'll go straight to the point: when i try to POST something it works first time. THen, if i try to do it the second time, it crashes when trying to call "delete" on the instantiated CHTTPFormEncoder! (Panic USER 42)

    If i try to call ReleaseData and then i try to add fields to it w\o deleting it just crashes with HTTP-CORE 10 Panic...

    ... what's the correct way to do what i'm trying to do?

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: CHTTPFormEncoder and HTTP-CORE 10 Panic

    Hi,

    could you put here your source code?

    Bye
    STeN

  3. #3
    Registered User
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    49

    Re: CHTTPFormEncoder and HTTP-CORE 10 Panic

    Sure! Here we go (it crashes when deleting m_pPostForm... m_pPostForm is NULL when DoLogin is called for the first time, then, when called further on it has last form pointer! So if someone mistyped user/pass i should try again but--- crashes!):

    Code:
    void CkMyProtocol::DoLogin(const TDesC& sUsername, const TDesC& sPassword)
    {
    	if (sUsername.Length() > 0 && sPassword.Length() > 0)
    	{
    		LOG(_L("Called do login"));
    
    		TBuf8<255>	sTemp;
    
                    if(m_pPostForm)    
                            delete m_pPostForm; // CRASH CRASH CRASH HERE!!!
    
    		m_pPostForm = CHTTPFormEncoder::NewL();
    		LOG(_L("newForm created"));
    		
    		sTemp.Copy(sUsername);
    		newForm->AddFieldL(KUsername, sTemp);
    		
    		sTemp.Copy(sPassword);
    		newForm->AddFieldL(KPassword, sTemp);
    	
    		LOG(_L("Form encoded"));
    
    		// We connect using default outgoing connection
    		m_pNetwork->SetURL(_L("http://my.url.com"));
    
    		LOG(_L("Connecting & sending form"));
    		// We connect using default outgoing connection
    		m_pNetwork->Connect();
    		m_pNetwork->PostForm();
    	}
    }

  4. #4
    Registered User
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    49

    Re: CHTTPFormEncoder and HTTP-CORE 10 Panic

    Nobody knows?

  5. #5
    Registered User
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    49

    Re: CHTTPFormEncoder and HTTP-CORE 10 Panic

    I started to do some tests. Ripping the "delete" part everything works perfectly except that it generates a memory leak :|

    No nokia gurus here? Am i missing something?

  6. #6
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: CHTTPFormEncoder and HTTP-CORE 10 Panic

    Hi,

    I have no idea whats wrong with your code, becuse I use own HTTP stack, but if removing "delete" part helps, it usually a problem with releasing data, I mean mat be you forget calling function like "Close()", "Release" or "Reset". Could this be a problem??

    Did you check httpexampleclient.cpp example file in 8.0a FP2 SDK? It also uses
    CHTTPFormEncoder class.

    Bye STeN

  7. #7
    Registered User
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    49

    Re: CHTTPFormEncoder and HTTP-CORE 10 Panic

    I tried also to do this instead of just calling delete ...

    Code:
    void CkNetworkEngine::SetForm(MHTTPDataSupplier *pForm)
    {
    	if(m_pHttpForm) 
    	{
    		//m_Transaction.Request().RemoveBody(); 
    		m_pHttpForm->Reset();
    		m_pHttpForm->ReleaseData();	
    		delete m_pHttpForm; 
    	}
    
    	m_pHttpForm = pForm;
    }
    I had to comment out m_Transaction.Request().RemoveBody() as when SetForm gets called previous instance of m_Transaction had already been closed with "Close()" from "MHFRunL"...

    Yes, i've already checked that example :|

  8. #8
    Registered User
    Join Date
    Nov 2005
    Location
    Oregon
    Posts
    40

    Re: CHTTPFormEncoder and HTTP-CORE 10 Panic

    probably too late, but you can't delete the CHTTPFormEncoder until your transaction is completely done processing. I'm guessing that subsequent requests were made to the method. Issue then is that they need to use their own instances of CHTTPFormEncoder.

    I ended up having to create a complete rest-style web services framework just to handle simultaneous requests, and dependent, transaction-ish requests. Maybe someday my employer will let me open source the engine so that the rest of the world doesn't have to experience the enormous headache of dealing with S60/Symbian crazy and only partially documented HTTP framework.

Similar Threads

  1. bug in 6600 http implementation?
    By iburger in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2004-11-19, 07:44

Posting Permissions

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