# HG changeset patch # User hgs # Date 1274945332 -10800 # Node ID 5bbf13e885a02440bfc7fdd1417436f57300ca81 # Parent e8f4211554fbc283bef58baf3f0908684e01ab4f 201021_1 diff -r e8f4211554fb -r 5bbf13e885a0 hotspotfw/hsclient/src/hssiaphandler.cpp --- a/hotspotfw/hsclient/src/hssiaphandler.cpp Mon May 24 21:11:39 2010 +0300 +++ b/hotspotfw/hsclient/src/hssiaphandler.cpp Thu May 27 10:28:52 2010 +0300 @@ -30,6 +30,10 @@ #include #include +// CONSTANTS +const TInt KRetryCount = 20; +const TInt KRetryTimeout = 100000; + using namespace CMManager; // ============================ MEMBER FUNCTIONS =============================== @@ -199,9 +203,27 @@ *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk; } } - // now update the access point - iWLANRecord->ModifyL( *dbSession ); + // Update access point, be prepared that Commsdat might be locked + TInt errCode( KErrLocked ); + TInt retryCount( 0 ); + while( errCode == KErrLocked && retryCount < KRetryCount ) + { + TRAP( errCode, iWLANRecord->ModifyL( *dbSession ) ); + + if ( errCode == KErrLocked ) + { + User::After( KRetryTimeout ); + } + retryCount++; + } + + if ( errCode ) + { + // override previous ret value only when error happened + ret = errCode; + } + CleanupStack::PopAndDestroy( dbSession ); DEBUG("CHssIapHandler::ChangeSettingsL DONE"); return ret; diff -r e8f4211554fb -r 5bbf13e885a0 hotspotfw/internetconnectivitytestservice/inc/ictshttphandler.h --- a/hotspotfw/internetconnectivitytestservice/inc/ictshttphandler.h Mon May 24 21:11:39 2010 +0300 +++ b/hotspotfw/internetconnectivitytestservice/inc/ictshttphandler.h Thu May 27 10:28:52 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: Contains implementation for HTTP::HEAD test +* Description: Contains implementation for connectivity test with HTTP * */ @@ -31,12 +31,12 @@ /** * Handles HTTP related things. * - * Sends HTTP::HEAD and interact with HTTP FW. Returns results to - * caller. + * Sends HTTP GET using HTTP FW. Returns results to the caller. * * @lib ictsclientinterface.lib */ -class CIctsHttpHandler : public CTimer, public MHTTPTransactionCallback +class CIctsHttpHandler : public CTimer, + public MHTTPTransactionCallback { public: @@ -53,7 +53,7 @@ virtual ~CIctsHttpHandler(); /** - * Send HTTP::HEAD request + * Send HTTP GET request * * @param aIPAddress IP address * @param aIapID IAP id @@ -61,11 +61,11 @@ * @return KErrNone if successful */ TInt SendHttpRequestL( TDesC8& aIPAddress, - TUint32 aIapID, - TUint32 aNetworkId ); + TUint32 aIapID, + TUint32 aNetworkId ); /** - * Cancels HTTP::HEAD request + * Cancels HTTP GET request * * @return None */ @@ -94,7 +94,6 @@ virtual TInt MHFRunError( TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent); - protected: // Functions from base classes @@ -126,7 +125,7 @@ * @return None */ void SetHttpConnectionInfoL( RConnection& aConnection, - RSocketServ& aSocketServ ); + RSocketServ& aSocketServ ); /** * Send HTTP request * @@ -142,6 +141,14 @@ * @return ETrue if found, else EFalse */ TBool CheckHttp( TDesC8& aIPAddress ); + + /** + * Checks if HTTP status code is a redirect (301,302,303,307) + * + * @param aTransaction HTTP transactionL + * @return ETrue if found, else EFalse + */ + TBool CheckStatusCodeL( RHTTPTransaction aTransaction ); private: // data diff -r e8f4211554fb -r 5bbf13e885a0 hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp --- a/hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp Mon May 24 21:11:39 2010 +0300 +++ b/hotspotfw/internetconnectivitytestservice/src/ictshttphandler.cpp Thu May 27 10:28:52 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: HTTP class for HTTP::HEAD testing +* Description: Class for HTTP GET testing * */ @@ -33,9 +33,9 @@ const TInt KFound = 302; const TInt KSeeOther = 303; const TInt KTemporaryRedirect = 307; + // ======== MEMBER FUNCTIONS ======== - // --------------------------------------------------------------------------- // CIctsHttpHandler::CIctsHttpHandler // C++ default constructor can NOT contain any code, that @@ -76,7 +76,8 @@ TInt aHttpResponseTime ) { DEBUG("CIctsHttpHandler::NewL()"); - CIctsHttpHandler* self = new( ELeave ) CIctsHttpHandler( aOwner, aHttpResponseTime ); + CIctsHttpHandler* self = new( ELeave ) CIctsHttpHandler( aOwner, + aHttpResponseTime ); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); @@ -126,42 +127,47 @@ RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo(); // Clear RConnection and Socket Server instances - connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketServ,RHTTPSession::GetTable())); - connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketConnection,RHTTPSession::GetTable())); + connInfo.RemoveProperty( strPool.StringF( HTTP::EHttpSocketServ, + RHTTPSession::GetTable() ) ); + connInfo.RemoveProperty( strPool.StringF( HTTP::EHttpSocketConnection, + RHTTPSession::GetTable() ) ); // Clear the proxy settings - THTTPHdrVal proxyUsage(strPool.StringF(HTTP::EUseProxy,RHTTPSession::GetTable())); - connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyUsage,RHTTPSession::GetTable())); - connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyAddress,RHTTPSession::GetTable())); + THTTPHdrVal proxyUsage( strPool.StringF( HTTP::EUseProxy, + RHTTPSession::GetTable() ) ); + connInfo.RemoveProperty( strPool.StringF( HTTP::EProxyUsage, + RHTTPSession::GetTable() ) ); + connInfo.RemoveProperty( strPool.StringF( HTTP::EProxyAddress, + RHTTPSession::GetTable() ) ); // RConnection has been started, set proxy (if defined) and RConnection and // Socket Server session properties. // Proxy - result = aConnection.EnumerateConnections(connCount); - User::LeaveIfError(result); + result = aConnection.EnumerateConnections( connCount ); + User::LeaveIfError( result) ; // Get service and service type for this connection // _LIT(string, "%s\\%s"); - query.Format(string, IAP, IAP_SERVICE); - result = aConnection.GetIntSetting(query, serviceId); + query.Format( string, IAP, IAP_SERVICE ); + result = aConnection.GetIntSetting( query, serviceId ); - query.Format(string, IAP, IAP_SERVICE_TYPE); - result = aConnection.GetDesSetting(query, serviceType); - User::LeaveIfError(result); + query.Format( string, IAP, IAP_SERVICE_TYPE ); + result = aConnection.GetDesSetting( query, serviceType ); + User::LeaveIfError( result ); // RConnection and Socket Server // Now bind the HTTP session with the socket server connection connInfo.SetPropertyL ( - strPool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), - THTTPHdrVal (aSocketServ.Handle()) ); + strPool.StringF( HTTP::EHttpSocketServ, RHTTPSession::GetTable() ), + THTTPHdrVal (aSocketServ.Handle() ) ); - TInt connPtr1 = reinterpret_cast(&aConnection); + TInt connPtr1 = reinterpret_cast( &aConnection) ; connInfo.SetPropertyL ( - strPool.StringF(HTTP::EHttpSocketConnection, - RHTTPSession::GetTable() ), THTTPHdrVal (connPtr1) ); + strPool.StringF( HTTP::EHttpSocketConnection, + RHTTPSession::GetTable() ), THTTPHdrVal ( connPtr1 ) ); } @@ -188,7 +194,7 @@ if ( !iAttachDone ) { - err = iConnection.Attach( pckgInfo, RConnection::EAttachTypeMonitor); + err = iConnection.Attach( pckgInfo, RConnection::EAttachTypeMonitor ); DEBUG1("CIctsHttpHandler::SendHttpRequestL attach: %d", err); } @@ -199,11 +205,13 @@ // Remove redirect filter RStringPool stringPool = iHttpSession.StringPool(); - RStringF filterName = stringPool.StringF(HTTP::ERedirect, RHTTPSession::GetTable()); - iHttpSession.FilterCollection().RemoveFilter(filterName); - + RStringF filterName = + stringPool.StringF( HTTP::ERedirect, RHTTPSession::GetTable() ); + iHttpSession.FilterCollection().RemoveFilter( filterName ); + RStringPool strPool = iHttpSession.StringPool(); - RStringF method = strPool.StringF(HTTP::EHEAD,RHTTPSession::GetTable()); + RStringF method = + strPool.StringF( HTTP::EGET, RHTTPSession::GetTable() ); TBuf8 ip; @@ -217,7 +225,7 @@ // Parse string to URI TUriParser8 uri; uri.Parse(ip); - iHttpTransaction = iHttpSession.OpenTransactionL(uri, *this, method); + iHttpTransaction = iHttpSession.OpenTransactionL( uri, *this, method ); RHTTPHeaders hdr = iHttpTransaction.Request().GetHeaderCollection(); RStringF headerStrName = strPool.OpenFStringL( KHeaderName() ); @@ -279,35 +287,27 @@ // Called by framework to pass transaction events. // --------------------------------------------------------------------------- // -void CIctsHttpHandler::MHFRunL(RHTTPTransaction aTransaction, - const THTTPEvent& aEvent) +void CIctsHttpHandler::MHFRunL( RHTTPTransaction aTransaction, + const THTTPEvent& aEvent ) { - DEBUG("CIctsHttpHandler::MHFRunL"); - + DEBUG1("CIctsHttpHandler::MHFRunL aEvent.iStatus: %d", + aEvent.iStatus); + // See HTTP event statuses. Only ESucceeded and EFailed are needed. switch (aEvent.iStatus) { - case THTTPEvent::EGotResponseHeaders: { DEBUG("CIctsHttpHandler::THTTPEvent::EGotResponseHeaders"); - } - break; - - case THTTPEvent::EGotResponseBodyData: - { - DEBUG("CIctsHttpHandler::THTTPEvent::EGotResponseBodyData"); + if ( CheckStatusCodeL( aTransaction ) ) + { + // Redirection found. Transaction can be canceled. + aTransaction.Cancel(); + } } break; - - case THTTPEvent::EResponseComplete: - { - DEBUG("CIctsHttpHandler::THTTPEvent::EResponseComplete"); - } - break; - case THTTPEvent::ESucceeded: { - DEBUG("CIctsHttpHandler::THTTPEvent::ESucceeded"); + DEBUG("CIctsHttpHandler::MHFRunL Succeeded"); CTimer::Cancel(); iOwner.HttpEventL( EConnectionOk, iString ); iString = KNullDesC; @@ -316,79 +316,17 @@ case THTTPEvent::EFailed: { + DEBUG("CIctsHttpHandler::MHFRunL Failed"); CTimer::Cancel(); - DEBUG("CIctsHttpHandler::THTTPEvent::EFailed"); - - RHTTPResponse resp = aTransaction.Response(); - TInt status = resp.StatusCode(); - - // Check if redirect was cause of EFailed - if( status == KMovedPermanently || status == KFound || - status == KSeeOther || status == KTemporaryRedirect ) - { - - // Inform the hotspot server that authentication is needed - RHTTPHeaders hdr =aTransaction.Response().GetHeaderCollection(); - RStringPool strP = aTransaction.Session().StringPool(); - RStringF location = strP.StringF(HTTP::ELocation,RHTTPSession::GetTable()); - - //parse the headers and look for location header - THTTPHdrVal hVal; - if(hdr.GetField(location,0,hVal)== KErrNone) - { - DEBUG("CIctsHttpHandler::THTTPEvent::GetField"); - // Location header is present - RStringF fieldValStr = strP.StringF(hVal.StrF()); - const TDesC8& fieldValDesC = fieldValStr.DesC(); - iString.Copy(fieldValDesC); - iOwner.HttpEventL( EHttpAuthenticationNeeded, iString ); - } - else - { - // No location header. Can't use authentication -> redirect. - iOwner.HttpEventL( EConnectionNotOk, iString ); - } - } - else - { - // Failed for other reason than redirect - iOwner.HttpEventL( EConnectionNotOk, iString ); - } - - iString = KNullDesC; + iOwner.HttpEventL( EConnectionNotOk, iString ); + iString = KNullDesC; } break; - case THTTPEvent::ERedirectedPermanently: - { - // Nothing here - DEBUG("CIctsHttpHandler::THTTPEvent::ERedirectedPermanently"); - } - break; - - case THTTPEvent::ERedirectedTemporarily: - { - // Nothing here - DEBUG("CIctsHttpHandler::THTTPEvent::ERedirectedTemporarily"); - } - break; - default: { - DEBUG1( "CIctsHttpHandler::MHFRunL::default iStatus: %d", aEvent.iStatus ); - CTimer::Cancel(); - if ( aEvent.iStatus < 0 ) - { - _LIT(string, "Unknown error"); - iString = string; - iOwner.HttpEventL( EConnectionNotOk, iString ); - } - else - { - _LIT(string, "Default"); - iString = string; - iOwner.HttpEventL( EConnectionNotOk, iString ); - } + DEBUG1( "CIctsHttpHandler::MHFRunL default: %d", aEvent.iStatus ); + // Do nothing. Timer will take care of error situations. } break; } @@ -418,4 +356,57 @@ return ( 0 == aIPAddress.Find( KHttpPrefix ) ); } +// ---------------------------------------------------------------------------- +// CIctsHttpHandler::CheckStatusCodeL +// ---------------------------------------------------------------------------- +TBool CIctsHttpHandler::CheckStatusCodeL( RHTTPTransaction aTransaction ) + { + DEBUG1("CIctsHttpHandler::CheckStatusCodeL response statuscode: %d", + aTransaction.Response().StatusCode()); + + TBool ret ( EFalse ); + + switch ( aTransaction.Response().StatusCode() ) + { + case KMovedPermanently: + case KFound: + case KSeeOther: + case KTemporaryRedirect: + { + DEBUG("CIctsHttpHandler::CheckStatusCodeL Redirect"); + CTimer::Cancel(); + ret = ETrue; + + //parse the headers and look for location header + RHTTPHeaders hdr =aTransaction.Response().GetHeaderCollection(); + RStringPool strP = aTransaction.Session().StringPool(); + RStringF location = + strP.StringF( HTTP::ELocation,RHTTPSession::GetTable() ); + THTTPHdrVal hVal; + if( hdr.GetField( location, 0, hVal ) == KErrNone ) + { + DEBUG("CIctsHttpHandler::CheckStatusCodeL location header"); + // Location header is present + RStringF fieldValStr = strP.StringF(hVal.StrF()); + const TDesC8& fieldValDesC = fieldValStr.DesC(); + iString.Copy( fieldValDesC ); + iOwner.HttpEventL( EHttpAuthenticationNeeded, iString ); + } + else + { + DEBUG("CIctsHttpHandler::CheckStatusCodeL no location header"); + // No location header. Can't redirect. + iOwner.HttpEventL( EConnectionNotOk, iString ); + iString = KNullDesC; + } + } + break; + + default: + // Do nothing + break; + } + return ret; + } + // End of File diff -r e8f4211554fb -r 5bbf13e885a0 wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp --- a/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Mon May 24 21:11:39 2010 +0300 +++ b/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Thu May 27 10:28:52 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -25,6 +25,12 @@ #include #endif #include +#include + +// This workaround can be removed when XQOP_WLAN_SNIFFER is correctly +// defined without the "void" parameter restriction: +#undef XQOP_WLAN_SNIFFER +#define XQOP_WLAN_SNIFFER QLatin1String("listView()") #include #include @@ -103,12 +109,11 @@ #endif // Execute synchronous WLAN Sniffer list view - // TODO: Start using defines in xqaiwdeclplat.h when available XQApplicationManager aiwMgr; XQAiwRequest *request = aiwMgr.create( "wlansniffer", - "com.nokia.symbian.IWlanSniffer", - "listView()", + XQI_WLAN_SNIFFER, + XQOP_WLAN_SNIFFER, true); // The WLAN Sniffer service must always exist diff -r e8f4211554fb -r 5bbf13e885a0 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp Mon May 24 21:11:39 2010 +0300 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp Thu May 27 10:28:52 2010 +0300 @@ -51,7 +51,6 @@ WlanSnifferService::WlanSnifferService(QObject* parent) : XQServiceProvider( - // TODO: Change to use the define in xqaiwdeclplat.h QLatin1String("wlansniffer.com.nokia.symbian.IWlanSniffer"), parent) {