×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    30

    Proxies, the HTTP stack and Series 60 v2.0

    I'm using RHTTPSession in Series 60 v2.0 and can't get the proxy functionality to work.

    According to the documentation, you install CHttpFilterProxyInterface using:

    CHttpFilterProxyInterface::InstallFilterL(iHttpSession);

    after the session has been opened. Then, before creating the first transaction set two session properties:

    SetPropertyL(HTTP::EProxyUsage, HTTP::EUseProxy);
    SetPropertyL(HTTP::EProxyAddress, proxyAddress);

    However, the transactions still attempt to connect directly rather than going through the proxy. I'm at my wit's end as I've tried everything I can think of. proxyAddress is the proxy server in the form "<ipaddress>:<port>" and it simply is not hit by the emulator at all.

    If the filter isn't installed and the properties are used, then the session freezes for a while and then comes back with -36 error and then THTTPEvent::EFailed so I'm sure the properties are being set properly.

    Any clues?

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    30
    Answering my own question again.

    I cannot get the HTTP proxy filter to work on Series 60 v2.0. I don't know what I'm doing wrong but I have tried everything and the client always makes a direct connection to the server.

    Similarly, and presumably for similar reasons, switching on WSP with RHTTPSession also doesn't work - it also connects direct to the server with the HTTP protocol.

    Consequently, I have reverted to using the old WSP classes RWAPServ and friends. These work perfectly on the 6600 but not on the emulator.

    This is naturally not an ideal solution as I wanted to convert to using the wizzy RHTTPSession and RConnection but at least I have a workaround for the time being.

    It would be nice to see an example that uses RHTTPSession and the proxy filter! CHttpClient is part of the Symbian 7.0s SDK - it is not GUI and it doesn't use the proxy.

    TIA

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    30
    I've since discovered that the HTTP proxy does work provided you don't try and configure it manually.

    just install the filter using:


    SetPropertyIntL(HTTP::EMaxNumTransportHandlers, 10); //(not sure if this is necessary)

    CHttpFilterProxyInterface::InstallFilterL(iHttpSession);

    and don't fiddle with HTTP::EProxyAddress

    and as if my magic the proxy works. Presumably the filter gets the proxy data from commsDB itself.

    i.e ignore the SDK document describing how to use the filter - it appears to be unecessary.

  4. #4
    Registered User
    Join Date
    Jun 2004
    Posts
    18
    Hi xiddesign

    I am having the same problem. It would be great if you could share some sample code.

    Thanks in advance

    Harsh

  5. #5
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    393

    HTTP Proxy Filter Usage

    Hi All,

    The HTTP Proxy Filter can be used for a session (i.e. for all transactions in that session) or on a per transaction basis.

    1. When using proxy for a session:

    //This automatically uses the proxy settings from the CommDb
    //when the APN is chosen by the end user
    Install proxy filter using CHttpFilterProxyInterface::InstallFilterL(iSession);

    OR

    Set session properties BEFORE opening a transaction:
    TBuf8<20> aProxy8(_L8("<proxy addr:port>"));
    RStringF prxAddr = iSession.StringPool().OpenFStringL(aProxy8);
    CleanupClosePushL(prxAddr);
    THTTPHdrVal prxUsage(iSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));
    iSession.ConnectionInfo().SetPropertyL(iSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), prxUsage);
    iSession.ConnectionInfo().SetPropertyL(iSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr);
    CleanupStack::PopAndDestroy(); // prxAddr

    2. When using proxy for an individual transaction:

    //Open transaction first
    iTransaction = iSession.OpenTransactionL(uri, *this, method);

    RHTTPTransactionPropertySet transactionProperties = iTransaction.PropertySet();
    TBuf8<20> aProxy8(_L8("<proxyaddr:port>"));
    RStringF prxAddr = iSession.StringPool().OpenFStringL(aProxy8);
    CleanupClosePushL(prxAddr);
    THTTPHdrVal prxUsage(iSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));
    transactionProperties.SetPropertyL(iSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), prxUsage);
    transactionProperties.SetPropertyL(iSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr);
    CleanupStack::PopAndDestroy(); // prxAddr


    Note that when setting proxy properties for individual transactions, the proxy filter installion is allowed but when setting proxy properties for session then it cannot be installed.

    Regards,
    [N]
    Forum Nokia
    Last edited by nmittal; 2004-08-03 at 15:05.

  6. #6
    Registered User
    Join Date
    Jun 2004
    Posts
    18
    Thanks nmittal for such a detailed reply.

    But CHttpFilterProxyInterface::InstallFilterL(iSession) does not seem to be working for me. e.g. in the following code snippet, the values of fields EProxyUsage and EProxyAddress do not change after calling InstallFilterL

    iSess.OpenL();

    RHTTPConnectionInfo connInfo = iSess.ConnectionInfo();
    RStringPool pool = iSess.StringPool();

    THTTPHdrVal hdrProxyUsage;
    THTTPHdrVal hdrProxyAddress;
    connInfo.Property(pool.StringF(HTTP::EProxyUsage, RHTTPSession::GetTable()), hdrProxyUsage);
    connInfo.Property(pool.StringF(HTTP::EProxyAddress, RHTTPSession::GetTable()), hdrProxyAddress);

    TInt iProxyUsage( hdrProxyUsage );
    TInt iProxyAddress( hdrProxyAddress );

    char str[200];
    sprintf(str, "ProxyUsage - %d, ProxyAddress - %d", iProxyUsage, iProxyAddress);
    Logger("Before InstallFilterL");
    Logger(str);

    // Install Proxy Filter - Probably not working
    TRAPD( error, CHttpFilterProxyInterface::InstallFilterL( iSess ) );
    if ( error != KErrNone ) {
    char str[10];
    sprintf( str, "%d", error);
    Logger("InstallFilter Failed");
    Logger(str);
    }

    Logger("After InstallFilterL");
    // properties dont change
    connInfo.Property(pool.StringF(HTTP::EProxyUsage, RHTTPSession::GetTable()), hdrProxyUsage);
    connInfo.Property(pool.StringF(HTTP::EProxyAddress, RHTTPSession::GetTable()), hdrProxyAddress);

    iProxyUsage = (TInt)hdrProxyUsage;
    iProxyAddress = (TInt)hdrProxyAddress;

    sprintf(str, "ProxyUsage - %d, ProxyAddress - %d", iProxyUsage, iProxyAddress);
    Logger(str);

    Kindly help
    Harshdeep

  7. #7
    Registered User
    Join Date
    Sep 2004
    Posts
    12
    Hi,
    Im Trying to use the CHttpFilterProxyInterface, it works fine with. But the problem when i attemp to close the application it fires the (AppName : app closed) error message. this message is caused by calling the statement
    CHttpFilterProxyInterface::InstallFilterL(iSess);

    Is there any idea to solve it ??

  8. #8
    Regular Contributor
    Join Date
    Oct 2004
    Posts
    54

    http proxy usernmae and password

    Hi everyone

    Has anyone so far faced problems regarding using proxy that requires a username and password.

    Precisely the problem is. I access net on my machine from a proxy that asks for a username and password. When i configure my ethernet it asks for the proxy server and port only but i don't understand where shall i put the username and password.
    The problem will be only when i try to run my app on the emulator. As in actual it will be using my network provider's proxy whne run on the target.

    I usually get error -34 or -5120.

    Any help would be very very valuable.

    cheerio

  9. #9
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    70

    Works on 7610 but not 6630

    I added the CHttpFilterProxyInterface::InstallFilterL(iSession)
    to the HTTP client example,
    after a session is established. Compiled with SDK 2nd version feature pack 2 and installed on both 7610 and 6630. It works on 7610. But on 6630, after I input a URL and click the OK button, the application closes without any message. Same problem of HTTP client with proxy for 6630 is reported here:

    http://discussion.forum.nokia.com/<b...ht=%2Aproxy%2A

    Can experts here shed some lights on this? Thanks.

  10. #10
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    70
    Sorry, the URL is

    CHttpFilterProxyInterface::InstallFilterL(iSession)

  11. #11
    Registered User
    Join Date
    Mar 2003
    Location
    Rennes; France
    Posts
    38

    Re: Proxies, the HTTP stack and Series 60 v2.0

    I have exactly the same kind of problem.
    Code:
       TRAPD(err, iSession.OpenL()); 
       if(err != KErrNone)
       {
          // Most common error; no access point configured, and session creation
          // leaves with KErrNotFound.
          User::Leave(KErrNotFound);
       }
       //Filters for HTTP proxy.
       CHttpFilterProxyInterface::InstallFilterL(iSession);
    This works fine on 6680, but crashes on 6630 an emulator.

  12. #12
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    393

    Re: Proxies, the HTTP stack and Series 60 v2.0

    Hi

    On 6630 CHttpFilterProxyInterface::InstallFilterL panics and is a known issue. Going the manual way of setting the properties should solve the issue.

    Nitin

  13. #13
    Registered User
    Join Date
    Oct 2005
    Posts
    10

    Re: Proxies, the HTTP stack and Series 60 v2.0

    i am trying to use rhttpsession with wsp/wsp as protocol. did anybody successfully port the http client example from nokia to wsp. there is absolutely no documentation or example code on how to use rhttpsession and wsp. i am really stuck there and i dont know where to go. if you can help me you will save my three months of work. please please help me.thank you

    regards,
    Praveen.
    praveenbm5@yahoo.com

  14. #14
    Regular Contributor
    Join Date
    Mar 2005
    Location
    Mumbai
    Posts
    212

    Re: Proxies, the HTTP stack and Series 60 v2.0

    hi nmittal,

    Is there any way i can find out if an access point is of WAP ONLY or FULL GPRS type.
    Hence if i get that the access pt is WAP only i will use InstallFilter else i will continue with the normal connection settings.

    I had this notion that a connection is a WAP only connection if there are some proxy settings configured for it, recently i switched my operator and the configuration that they have sent me has proxy settings for FULL GPRS connection too..


  15. #15
    Regular Contributor
    Join Date
    Mar 2005
    Location
    Mumbai
    Posts
    212

    Re: Proxies, the HTTP stack and Series 60 v2.0

    hi ,

    I have spent a lot of time on this thing, here is some thing that will make both ur connections work be it wsp or gprs

    In ur post method just before OpenTransactionL try out this code

    Code:
    HBufC* serviceType = HBufC::NewL(KCommsDbSvrMaxFieldLength);
    	CleanupStack::PushL(serviceType);
    	TPtr serviceTypePtr = serviceType->Des();
    	
    	User::LeaveIfError(iConnection.GetDesSetting(_L("IAP\\IAPServiceType"), serviceTypePtr));
    	
    	
    	CleanupStack::Pop(serviceType);
    	
    	if(UseProxy(iIAPID,serviceTypePtr))
    	{
    		CHttpFilterProxyInterface::InstallFilterL(iSession);
    	}
    	
    	RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();	
    	connInfo.SetPropertyL(iSession.StringPool().StringF(HTTP::EHttpSocketServ,RHTTPSession::GetTable()),THTTPHdrVal(iSockServ.Handle()));
    	TInt connPtr = REINTERPRET_CAST(TInt, &iConnection);
    	connInfo.SetPropertyL(iSession.StringPool().StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr));	
    
    
    
    TBool CHTTPExampleEngine::UseProxy(TUint32 aIapID, TDesC& aServiceType) 
    {
    	// open commdb
            TBool iUseProxy;
    	CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
    	CleanupStack::PushL(commDb);
    	TBool proxyEnabled(EFalse);
    
    	// opening the table
    	CCommsDbTableView* commView = commDb->OpenViewOnProxyRecordLC(aIapID, aServiceType);
    
    	if (commView->GotoFirstRecord() == KErrNone)
    	{
    		// Read the flag to see if we need proxyEnabled.
    		commView->ReadBoolL(TPtrC(PROXY_USE_PROXY_SERVER), proxyEnabled);
    
    		if(proxyEnabled)
    			iUseProxy=EFalse;
    	}
    	else
    	{
    		iUseProxy=ETrue;
    	}
    
    	CleanupStack::PopAndDestroy(commView);
    	CleanupStack::PopAndDestroy(commDb);
    
            return iUseProxy;
    }
    its strange because UseProxy function is returning the !value than what i expected , but still i have tested the code on 6600,6670,6681 it works on most of the s60 phones but crashes on the 6630 with older firmware, but works on my 6630 with firmware v 5.03.08

Posting Permissions

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