engine/src/HttpClient.cpp
branchsymbian1
changeset 336 3d6c1417e8bd
parent 284 69385a7c9810
child 381 29e277559820
equal deleted inserted replaced
296:80f1da5ac28b 336:3d6c1417e8bd
   119 	if(iWaitingForGet)
   119 	if(iWaitingForGet)
   120 		{
   120 		{
   121 		iWaitingForGet = EFalse;
   121 		iWaitingForGet = EFalse;
   122 		if( aErrorCode == KErrNone)
   122 		if( aErrorCode == KErrNone)
   123 			{
   123 			{
   124 			TRAP_IGNORE(iSession.OpenL());
   124 			//TRAP_IGNORE(iSession.OpenL());
   125 			DP("    one");
       
   126 			RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
   125 			RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
   127 			DP("    one point five");
       
   128 			RStringPool pool = iSession.StringPool();
   126 			RStringPool pool = iSession.StringPool();
   129 			// Attach to socket server
   127 			// Attach to socket server
   130 			DP("    two");
       
   131 			connInfo.SetPropertyL(pool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iPodcastModel.ConnectionEngine().SockServ().Handle()));
   128 			connInfo.SetPropertyL(pool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iPodcastModel.ConnectionEngine().SockServ().Handle()));
   132 			// Attach to connection
   129 			// Attach to connection
   133 			DP("    three");
       
   134 			TInt connPtr = REINTERPRET_CAST(TInt, &iPodcastModel.ConnectionEngine().Connection());
   130 			TInt connPtr = REINTERPRET_CAST(TInt, &iPodcastModel.ConnectionEngine().Connection());
   135 			connInfo.SetPropertyL(pool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr));
   131 			connInfo.SetPropertyL(pool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr));
   136 			DP("    four");
       
   137 
   132 
   138 			iPodcastModel.SetProxyUsageIfNeededL(iSession);
   133 			iPodcastModel.SetProxyUsageIfNeededL(iSession);
   139 			DoGetAfterConnectL();
   134 			DoGetAfterConnectL();
   140 			//iWaitingForGet = EFalse; // set to true by DoGetAfterConnectL
       
   141 			}
   135 			}
   142 		else
   136 		else
   143 			{
   137 			{
   144 			ClientRequestCompleteL(KErrCouldNotConnect);
   138 			ClientRequestCompleteL(KErrCouldNotConnect);
   145 			iSession.Close();			
   139 			iSession.Close();			
   203 	DP("CHttpClient::DoGetAfterConnectL END");
   197 	DP("CHttpClient::DoGetAfterConnectL END");
   204 	}
   198 	}
   205 
   199 
   206 TBool CHttpClient::GetL(const TDesC& aUrl, const TDesC& aFileName,  TBool aSilent) {
   200 TBool CHttpClient::GetL(const TDesC& aUrl, const TDesC& aFileName,  TBool aSilent) {
   207 	DP("CHttpClient::Get START");
   201 	DP("CHttpClient::Get START");
       
   202 	DP2("Getting '%S' to '%S'", &aUrl, &aFileName);
   208 	
   203 	
   209 	if (iIsActive)
   204 	if (iIsActive)
   210 		{
   205 		{
   211 		return EFalse;
   206 		return EFalse;
   212 		}
   207 		}
   269 	TRAP_IGNORE(iObserver.CompleteL(this, KErrDisconnected));
   264 	TRAP_IGNORE(iObserver.CompleteL(this, KErrDisconnected));
   270 
   265 
   271 	}
   266 	}
   272 
   267 
   273 void CHttpClient::ClientRequestCompleteL(TInt aErrorCode) {
   268 void CHttpClient::ClientRequestCompleteL(TInt aErrorCode) {
   274 	DP1("CHttpClient::ClientRequestCompleteL, aErrorCode=%d", aErrorCode);
   269 	DP1("CHttpClient::ClientRequestCompleteL BEGIN, aErrorCode=%d", aErrorCode);
   275 	iIsActive = EFalse;
   270 	iIsActive = EFalse;
   276 	iObserver.CompleteL(this, aErrorCode);
   271 	iObserver.CompleteL(this, aErrorCode);
   277 	DP1("    iTransactionCount=%d", iTransactionCount);
   272 	DP1("    iTransactionCount=%d", iTransactionCount);
   278 	if(iTransactionCount>0)
   273 	if(iTransactionCount>0)
   279 		{
   274 		{
   285 			delete iHandler;
   280 			delete iHandler;
   286 			iHandler = NULL;
   281 			iHandler = NULL;
   287 			iSession.Close();
   282 			iSession.Close();
   288 			}
   283 			}
   289 		}
   284 		}
       
   285 	DP("CHttpClient::ClientRequestCompleteL END");
   290 }
   286 }