webengine/osswebengine/WebCore/platform/network/symbian/HttpConnection.cpp
branchRCL_3
changeset 40 8bfb9186a8b8
parent 38 4917f9bf7995
child 41 4bd5176e1bc8
equal deleted inserted replaced
38:4917f9bf7995 40:8bfb9186a8b8
   202 }
   202 }
   203 
   203 
   204 void HttpConnection::submitL()
   204 void HttpConnection::submitL()
   205 {
   205 {
   206     __ASSERT_DEBUG( !m_transaction, THttpConnUtils::PanicLoader( KErrArgument ) );
   206     __ASSERT_DEBUG( !m_transaction, THttpConnUtils::PanicLoader( KErrArgument ) );
       
   207     TBool retryFlag = StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager()->getRetryConnectivityFlag();
       
   208     if( retryFlag )
       
   209         return;
   207 
   210 
   208     HttpSessionManager* httpSessionMgr = StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager();
   211     HttpSessionManager* httpSessionMgr = StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager();
   209     User::LeaveIfNull(httpSessionMgr);
   212     User::LeaveIfNull(httpSessionMgr);
   210     httpSessionMgr->openHttpSessionIfNeededL();
   213     httpSessionMgr->openHttpSessionIfNeededL();
   211     TPtrC8 urlPtr( m_handle->request().url().des() );
   214     TPtrC8 urlPtr( m_handle->request().url().des() );
   724             break;// We don't process this event
   727             break;// We don't process this event
   725             }
   728             }
   726         default:
   729         default:
   727             {
   730             {
   728             // error handling
   731             // error handling
   729             if(aEvent.iStatus == KErrNotReady || aEvent.iStatus == KErrDisconnected   )
   732             //KErrDisconnected should be coming only for OCC
       
   733             //MHFRunL gets call before connection manager
       
   734             if(aEvent.iStatus == KErrDisconnected)
   730                 StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager()->setRetryConnectivityFlag();                 
   735                 StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager()->setRetryConnectivityFlag();                 
   731             else
   736             else
   732                 handleError(aEvent.iStatus);               
   737                 handleError(aEvent.iStatus);               
   733             break;
   738             break;
   734             }
   739             }
   785     return ret;
   790     return ret;
   786 }
   791 }
   787 
   792 
   788 void HttpConnection::complete(int error)
   793 void HttpConnection::complete(int error)
   789 {
   794 {
   790     TBool retryFlag = StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager()->getRetryConnectivityFlag();
   795     HttpSessionManager* httpSessionManager = StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager();
       
   796     TBool retryFlag = httpSessionManager->getRetryConnectivityFlag();
   791     if( retryFlag )
   797     if( retryFlag )
   792         {
   798         {
   793         m_transaction->Cancel();
       
   794         //m_cancelled = false; //for flash
       
   795         return;
   799         return;
   796         }
   800         }
   797     
   801     
   798     if (m_defersData) {
   802     if (m_defersData) {
   799         m_defersData->m_done = true;
   803         m_defersData->m_done = true;
   848     if (m_transaction) {
   852     if (m_transaction) {
   849         m_transaction->Cancel();
   853         m_transaction->Cancel();
   850         m_transaction->Close();
   854         m_transaction->Close();
   851         delete m_transaction;
   855         delete m_transaction;
   852         m_transaction = NULL;
   856         m_transaction = NULL;
       
   857         httpSessionManager->removeRequest(this);
   853     }
   858     }
   854     if (error) {
   859     if (error) {
   855         CResourceHandleManager::self()->receivedFinished(m_handle, error, this);
   860         CResourceHandleManager::self()->receivedFinished(m_handle, error, this);
   856         derefHandle();
   861         derefHandle();
   857     }
   862     }
  1200 
  1205 
  1201     __ASSERT_DEBUG( m_transaction, THttpConnUtils::PanicLoader( KErrArgument ) );
  1206     __ASSERT_DEBUG( m_transaction, THttpConnUtils::PanicLoader( KErrArgument ) );
  1202 
  1207 
  1203     if(uriParser.Parse( m_transaction->Request().URI().UriDes() ) == KErrNone)
  1208     if(uriParser.Parse( m_transaction->Request().URI().UriDes() ) == KErrNone)
  1204         {
  1209         {
  1205         if (uriParser.IsPresent(EUriHost) && uriParser.IsPresent(EUriScheme)) // looking only for absolue Url path and schemes other than http(s)
  1210         if (uriParser.IsPresent(EUriScheme)) // looking only for absolue Url path and schemes other than http(s)
  1206             {
  1211             {
  1207             const TDesC8& scheme = uriParser.Extract(EUriScheme);
  1212             const TDesC8& scheme = uriParser.Extract(EUriScheme);
  1208             if (scheme.FindF(_L8("http")) == KErrNotFound) // everything but http(s)
  1213             if(uriParser.IsPresent(EUriHost) || scheme.FindF(_L8("tel")) == KErrNone)
  1209                 {
  1214                 {
  1210                 TPtrC8 ptr(uriParser.UriDes());
  1215                 if (scheme.FindF(_L8("http")) == KErrNotFound) // everything but http(s)
  1211                 // these arrays are pushed into CleanupStack in case leave
       
  1212                 // if no leave, they will be freed below
       
  1213                 RArray<TUint>* typeArray = new (ELeave) RArray<TUint>(1);
       
  1214                 CleanupStack::PushL(typeArray);
       
  1215 
       
  1216                 CDesCArrayFlat* desArray = new (ELeave) CDesCArrayFlat(1);
       
  1217                 CleanupStack::PushL(desArray);
       
  1218 
       
  1219                 User::LeaveIfError(typeArray->Append(EParamRequestUrl));
       
  1220 
       
  1221                 HBufC16* urlbuf = HBufC16::NewLC( ptr.Length()  + 1); // +1 for zero terminate
       
  1222                 urlbuf->Des().Copy( ptr );
       
  1223                 TPtr16 bufDes16 = urlbuf->Des();
       
  1224                 bufDes16.ZeroTerminate();
       
  1225 
       
  1226                 desArray->AppendL(bufDes16);
       
  1227                 CleanupStack::Pop();
       
  1228 
       
  1229                 MBrCtlSpecialLoadObserver* loadObserver = control(m_frame)->brCtlSpecialLoadObserver();
       
  1230 
       
  1231                 if (loadObserver)
       
  1232                     {
  1216                     {
  1233                     TRAP_IGNORE(loadObserver->HandleRequestL(typeArray, desArray));
  1217                     TPtrC8 ptr(uriParser.UriDes());
  1234                     }
  1218                     // these arrays are pushed into CleanupStack in case leave
  1235 
  1219                     // if no leave, they will be freed below
  1236                 // No leave, so pop here and clean up
  1220                     RArray<TUint>* typeArray = new (ELeave) RArray<TUint>(1);
  1237                 CleanupStack::Pop(desArray);
  1221                     CleanupStack::PushL(typeArray);
  1238                 CleanupStack::Pop(typeArray);
  1222 
  1239 
  1223                     CDesCArrayFlat* desArray = new (ELeave) CDesCArrayFlat(1);
  1240                 // cleanup arrays
  1224                     CleanupStack::PushL(desArray);
  1241                 if (typeArray)
  1225 
  1242                     {
  1226                     User::LeaveIfError(typeArray->Append(EParamRequestUrl));
  1243                     // Closes the array and frees all memory allocated to the array
  1227 
  1244                     typeArray->Close();
  1228                     HBufC16* urlbuf = HBufC16::NewLC( ptr.Length()  + 1); // +1 for zero terminate
  1245                     delete typeArray;
  1229                     urlbuf->Des().Copy( ptr );
  1246                     }
  1230                     TPtr16 bufDes16 = urlbuf->Des();
  1247 
  1231                     bufDes16.ZeroTerminate();
  1248                 if (desArray)
  1232 
  1249                     {
  1233                     desArray->AppendL(bufDes16);
  1250                     // Deletes all descriptors from the array and frees the memory allocated to the array buffer
  1234                     CleanupStack::Pop();
  1251                     desArray->Reset();
  1235 
  1252                     delete desArray;
  1236                     MBrCtlSpecialLoadObserver* loadObserver = control(m_frame)->brCtlSpecialLoadObserver();
  1253                     }
  1237 
  1254 
  1238                     if (loadObserver)
  1255                 return KErrCancel;
  1239                         {
       
  1240                         TRAP_IGNORE(loadObserver->HandleRequestL(typeArray, desArray));
       
  1241                         }
       
  1242 
       
  1243                     // No leave, so pop here and clean up
       
  1244                     CleanupStack::Pop(desArray);
       
  1245                     CleanupStack::Pop(typeArray);
       
  1246 
       
  1247                     // cleanup arrays
       
  1248                     if (typeArray)
       
  1249                         {
       
  1250                         // Closes the array and frees all memory allocated to the array
       
  1251                         typeArray->Close();
       
  1252                         delete typeArray;
       
  1253                         }
       
  1254 
       
  1255                     if (desArray)
       
  1256                         {
       
  1257                         // Deletes all descriptors from the array and frees the memory allocated to the array buffer
       
  1258                         desArray->Reset();
       
  1259                         delete desArray;
       
  1260                         }
       
  1261 
       
  1262                     return KErrCancel;
       
  1263                     }
  1256                 }
  1264                 }
  1257             }
  1265             }
  1258         }
  1266         }
  1259     return KErrNone;
  1267     return KErrNone;
  1260     }
  1268     }
  1267     RHTTPSession& session = StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager()->httpSession();
  1275     RHTTPSession& session = StaticObjectsContainer::instance()->resourceLoaderDelegate()->httpSessionManager()->httpSession();
  1268     // remove own address from transaction properties
  1276     // remove own address from transaction properties
  1269     m_transaction->PropertySet().RemoveProperty(session.StringPool().StringF(HttpFilterCommonStringsExt::ESelfPtr,
  1277     m_transaction->PropertySet().RemoveProperty(session.StringPool().StringF(HttpFilterCommonStringsExt::ESelfPtr,
  1270         HttpFilterCommonStringsExt::GetTable()));
  1278         HttpFilterCommonStringsExt::GetTable()));
  1271     m_transaction = NULL;
  1279     m_transaction = NULL;
       
  1280     m_isDone = true;
  1272     return trans;
  1281     return trans;
  1273 }
  1282 }
  1274 
  1283 
  1275 // -----------------------------------------------------------------------------
  1284 // -----------------------------------------------------------------------------
  1276 // HttpConnection::addIMEINotifyPropertiesL
  1285 // HttpConnection::addIMEINotifyPropertiesL