×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    33

    [moved] HTTP & SSL

    Hi,

    I have an app that interfaces with a webserver over HTTP. It worked perfectly until we installed an SSL cert and tried to talk using https.

    Now I get error 9 in the MHFRunL callback - which is transaction failed. Is there something different I need to do here?

    This only occurs over a GPRS IAP - it works fine over WLAN.

    Below is an example where we start a session to do a simple form POST (yes - its straight from all those sample apps out there )

    if(!iSessionActive){
    User::LeaveIfError(StartConnection());

    iSession.OpenL();
    iSession.ConnectionInfo().SetPropertyL(iSession.StringPool().StringF(HTTP::EHttpSocketServ,
    RHTTPSession::GetTable()),
    THTTPHdrVal(iSocketServ.Handle()));

    TInt connectionPtr = reinterpret_cast<TInt>(&iConnection);
    iSession.ConnectionInfo().SetPropertyL(iSession.StringPool().StringF(HTTP::EHttpSocketConnection,
    RHTTPSession::GetTable()),
    THTTPHdrVal(connectionPtr));
    iSessionActive = ETrue;
    }
    iTransaction = iSession.OpenTransactionL(iUriParser, *this, iSession.StringPool().StringF(HTTP::EPOST, RHTTPSession::GetTable()));

    // Set transaction headers
    RHTTPHeaders headers = iTransaction.Request().GetHeaderCollection();
    AddHeaderL(headers, HTTP::EUserAgent, KUserAgent);
    AddHeaderL(headers, HTTP::EAccept, KAccept);
    AddHeaderL(headers, HTTP::EContentType, KPostContentType);

    iTransaction.Request().SetBody(*iFormEncoder);
    iTransaction.SubmitL();

    Thanks

    Sam

  2. #2
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122

    Re: HTTP & SSL

    Next thing to check could be to check what other errors you get in your MHFRunL() before the transaction failure. Just add some logging or the like to the default: label in the switch.

    Lauri

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    33

    Re: HTTP & SSL

    Thanks - I was just seeing if there was anything obvious before I tried to fix something that shouldn't even have been broken.

    OK - for those of you wondering what happened here, I found a number of threads that hint at a solution but nothing that explains it. However the workaround is below.

    Basically the implementation of CHTTPFormEncoder fails on an HTTP POST over SSL with a -7370 error. This is a Symbian HTTP API error indicating that the data supplier needed to reset but that the client did not support this. If you are using the form encoder you can't do anything about that and for a while I threw things around the house in frustration at YASFU.

    Then I remembered that I'd written an HTTP uploader for file uploads. They worked over SSL or over plain connections.

    So the solution is to use your own class that implements the MHTTPDataSupplier interface and build the POST yourself. Mine was based on examples I found on FN earlier this year.

    This is effectively an HTTP POST with extra stuff. This worked straight away. Job done.

    Summary - a solution that worked perfectly for 18 months failed when we switched to SSL. One some phones it worked regardless (like the E63) but on others (N82, 6120 etc) it failed everytime. Workaround was to do the HTTP POST yourself - remember its just text strings so it was pretty easy.

    Typically, the hardest part is trying to track down which part of the Symbian ecosystem your problem wasn't documented in.

    Can't wait for the signing process....

Similar Threads

  1. [moved] Http Get not working in nokia 3600 Slide!!!
    By ZaidShah in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2009-09-04, 06:21
  2. [moved] Urgent: HTTP POST NOT WORKING!!!
    By ZaidShah in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2009-07-14, 12:44
  3. Providing SSL certificate in HTTP filter
    By metalim in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2009-06-01, 11:59
  4. Replies: 0
    Last Post: 2002-05-09, 12:07

Posting Permissions

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