296 // Close the log file and the connection to the server. |
227 // Close the log file and the connection to the server. |
297 TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("Log file closed."))); |
228 TLSLOG(KSenHttpChannelLogChannelBase , KMinLogLevel,(_L("Log file closed."))); |
298 TLSLOG_CLOSE(KSenHttpChannelLogChannelBase); |
229 TLSLOG_CLOSE(KSenHttpChannelLogChannelBase); |
299 } |
230 } |
300 |
231 |
301 TInt CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer ) |
232 // This function expects that RConnection has been connected |
302 { |
233 // and that RConnection has already been opened! |
303 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KNormalLogLevel, _L8("- SetIapPrefsL , IAP ID (%d)"), aIapId)); |
234 /* |
304 |
235 void CSenHttpChannelImpl::SetIapPrefsL(TUint32 aIapId, |
|
236 RConnection& aConnection, |
|
237 RSocketServ& aSocketServer) |
|
238 { |
305 // Check whether IAP ID is not equal with the one that is currently in effect: |
239 // Check whether IAP ID is not equal with the one that is currently in effect: |
306 if(iExplicitIapDefined && iIapId == aIapId ) |
240 if(iExplicitIapDefined && iIapId == aIapId ) |
307 { |
241 { |
308 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id is same as currently in effect"); |
242 return; // nothing to do |
309 return KErrNone; |
243 } |
310 } |
244 |
311 else |
245 LOG_WRITEFORMAT((_L8("- SetIapPrefsL: Re-setting IAP ID (%d)"), aIapId)); |
312 { |
|
313 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id different with the currently in effect"); |
|
314 } |
|
315 |
|
316 |
246 |
317 // Check if socket server (connection) is already open.. |
247 // Check if socket server (connection) is already open.. |
318 if( iExplicitIapDefined ) |
248 if( iExplicitIapDefined ) |
319 { |
249 { |
320 // Socket server opened once before for some other IAP |
250 // Socket server opened once before for some other IAP |
321 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Re-using existing RConnection => calling RConnection::Stop"); |
251 LOG_WRITE_L("- SetIapPrefsL: Re-using existing RConnection => calling RConnection::Stop"); |
322 aConnection.Stop(); |
252 aConnection.Stop(); |
323 } |
253 } |
324 else |
254 else |
325 { |
255 { |
|
256 aConnection.Stop(); // prompted from user |
|
257 iSess.DisconnectL(); |
|
258 iSess.ConnectL(); |
|
259 |
326 // Connect to a socket server |
260 // Connect to a socket server |
327 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Connecting to new socket server"); |
261 LOG_WRITE_L("- SetIapPrefsL: Connecting to new socket server"); |
328 User::LeaveIfError( aSocketServer.Connect() ); |
262 User::LeaveIfError(aSocketServer.Connect()); |
329 |
263 |
330 // Open new connection |
264 // Open new connection |
331 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Opening new RConnection using the socket server."); |
265 LOG_WRITE_L("- SetIapPrefsL: Opening new RConnection using the socket server."); |
332 User::LeaveIfError( aConnection.Open(aSocketServer) ); |
266 User::LeaveIfError(aConnection.Open(aSocketServer)); |
333 } |
267 } |
334 |
268 |
335 // Set the IAP selection preferences (IAP ID, do not prompt) |
269 // Set the IAP selection preferences (IAP ID, do not prompt) |
336 TInt retVal = SetID(aIapId, aDialogPref, aConnection, aSocketServer); |
270 TCommDbConnPref pref; |
337 |
271 pref.SetIapId( aIapId ); |
|
272 |
|
273 TCommDbDialogPref dialogPref; |
|
274 dialogPref = ECommDbDialogPrefDoNotPrompt; |
|
275 pref.SetDialogPreference(dialogPref); |
|
276 |
|
277 // Start the connection with the new preferences |
|
278 LOG_WRITE_L("- SetIapPrefsL: Calling RConnection::Start with new IAP prefs"); |
|
279 aConnection.Start(pref); |
|
280 |
338 // Get the connection "handle" from the HTTP session |
281 // Get the connection "handle" from the HTTP session |
339 RHTTPConnectionInfo connInfo = iSess.ConnectionInfo(); |
282 RHTTPConnectionInfo connInfo = iSess.ConnectionInfo(); |
340 |
283 |
341 // Attach socket server |
284 // Attach socket server |
342 connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketServ, |
285 connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketServ, |
345 |
288 |
346 // Attach connection |
289 // Attach connection |
347 TInt connPtr = REINTERPRET_CAST(TInt, &aConnection); |
290 TInt connPtr = REINTERPRET_CAST(TInt, &aConnection); |
348 connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketConnection, |
291 connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketConnection, |
349 RHTTPSession::GetTable()), |
292 RHTTPSession::GetTable()), |
350 THTTPHdrVal(connPtr)); |
293 THTTPHdrVal(connPtr)); |
|
294 |
|
295 // Remember the IAP id that is being set; there is |
|
296 // no direct API to query effective IAP ID from CommsDB. |
|
297 iExplicitIapDefined = ETrue; |
|
298 iIapId = aIapId; |
|
299 } |
|
300 */ |
|
301 |
|
302 |
|
303 /* |
|
304 void CSenHttpChannelImpl::SetupConnectionWithIapPrefsL( TUint32 aIapId, |
|
305 RConnection& aConnection, |
|
306 RSocketServ& aSocketServer ) |
|
307 { |
|
308 // Check whether IAP ID is not equal with the one that is currently in effect: |
|
309 if(iExplicitIapDefined && iIapId == aIapId ) |
|
310 { |
|
311 return; // nothing to do |
|
312 } |
|
313 |
|
314 LOG_WRITEFORMAT((_L8("- SetIapPrefsL, IAP ID (%d)"), aIapId)); |
|
315 |
|
316 // Check if socket server (connection) is already open.. |
|
317 if( iExplicitIapDefined ) |
|
318 { |
|
319 // Socket server opened once before for some other IAP |
|
320 LOG_WRITE_L("- SetIapPrefsL: Re-using existing RConnection => calling RConnection::Stop"); |
|
321 aConnection.Stop(); |
|
322 } |
|
323 else |
|
324 { |
|
325 // Connect to a socket server |
|
326 LOG_WRITE_L("- SetIapPrefsL: Connecting to new socket server"); |
|
327 User::LeaveIfError( aSocketServer.Connect() ); |
|
328 |
|
329 // Open new connection |
|
330 LOG_WRITE_L("- SetIapPrefsL: Opening new RConnection using the socket server."); |
|
331 User::LeaveIfError( aConnection.Open(aSocketServer) ); |
|
332 } |
|
333 |
|
334 // Set the IAP selection preferences (IAP ID, do not prompt) |
|
335 TCommDbConnPref pref; |
|
336 pref.SetIapId( aIapId ); |
|
337 |
|
338 TCommDbDialogPref dialogPref; |
|
339 dialogPref = ECommDbDialogPrefDoNotPrompt; |
|
340 pref.SetDialogPreference(dialogPref); |
|
341 |
|
342 // Start the connection with the new preferences |
|
343 LOG_WRITE_L("- SetIapPrefsL: Calling RConnection::Start with new IAP prefs"); |
|
344 aConnection.Start(pref); |
|
345 } |
|
346 |
|
347 |
|
348 void CSenHttpChannelImpl::AttachSocketServerAndConnectionWithHttpSession( TUint32 aIapId, |
|
349 RConnection& aConnection, |
|
350 RSocketServ& aSocketServer ) |
|
351 { |
|
352 if(iExplicitIapDefined && iIapId == aIapId ) |
|
353 { |
|
354 return; // nothing to do |
|
355 } |
|
356 |
|
357 // Get the connection "handle" from the HTTP session |
|
358 RHTTPConnectionInfo connInfo = iSess.ConnectionInfo(); |
|
359 |
|
360 // Attach socket server |
|
361 connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketServ, |
|
362 RHTTPSession::GetTable()), |
|
363 THTTPHdrVal(aSocketServer.Handle())); |
|
364 |
|
365 // Attach connection |
|
366 TInt connPtr = REINTERPRET_CAST(TInt, &aConnection); |
|
367 connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketConnection, |
|
368 RHTTPSession::GetTable()), |
|
369 THTTPHdrVal(connPtr)); |
|
370 |
|
371 // Remember the IAP id that is being set, because *at the moment*, |
|
372 // there is NO direct API to query effective IAP ID from CommsDB. |
|
373 iExplicitIapDefined = ETrue; |
|
374 iIapId = aIapId; |
|
375 } |
|
376 |
|
377 |
|
378 void CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, RConnection& aConnection, RSocketServ& aSocketServer ) |
|
379 { |
|
380 SetupConnectionWithIapPrefsL( aIapId, aConnection, aSocketServer ); |
|
381 AttachSocketServerAndConnectionWithHttpSession( aIapId, aConnection, aSocketServer ); |
|
382 } |
|
383 */ |
|
384 |
|
385 |
|
386 TInt CSenHttpChannelImpl::SetIapPrefsL( TUint32 aIapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer ) |
|
387 { |
|
388 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KNormalLogLevel, _L8("- SetIapPrefsL, IAP ID (%d)"), aIapId)); |
|
389 |
|
390 // Check whether IAP ID is not equal with the one that is currently in effect: |
|
391 if(iExplicitIapDefined && iIapId == aIapId ) |
|
392 { |
|
393 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id is same as currently in effect"); |
|
394 return KErrNone; |
|
395 } |
|
396 else |
|
397 { |
|
398 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Iap Id different with the currently in effect"); |
|
399 } |
|
400 |
|
401 |
|
402 // Check if socket server (connection) is already open.. |
|
403 if( iExplicitIapDefined ) |
|
404 { |
|
405 // Socket server opened once before for some other IAP |
|
406 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Re-using existing RConnection => calling RConnection::Stop"); |
|
407 aConnection.Stop(); |
|
408 } |
|
409 else |
|
410 { |
|
411 // Connect to a socket server |
|
412 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Connecting to new socket server"); |
|
413 User::LeaveIfError( aSocketServer.Connect() ); |
|
414 |
|
415 // Open new connection |
|
416 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Opening new RConnection using the socket server."); |
|
417 User::LeaveIfError( aConnection.Open(aSocketServer) ); |
|
418 } |
|
419 |
|
420 // Set the IAP selection preferences (IAP ID, do not prompt) |
|
421 /* |
|
422 *Single click connectivity feature has been implemented by CSock (RConnection class). |
|
423 *According to this client no need to set the IAP ID. |
|
424 *Automatically RConnection will use the suitable IAP |
|
425 */ |
|
426 |
|
427 |
|
428 TCommDbConnPref pref; |
|
429 #ifndef __SINGLE_CLICK_CONNECTIVITY_ENABLED__ |
|
430 pref.SetIapId( aIapId ); |
|
431 #else |
|
432 pref.SetIapId( 0 ); //By default IAP ID is "0". IAP selection will take care by RConnection |
|
433 #endif //__SINGLE_CLICK_CONNECTIVITY_ENABLED__ |
|
434 TCommDbDialogPref dialogPref; |
|
435 |
|
436 if (aDialogPref) |
|
437 { |
|
438 dialogPref = ECommDbDialogPrefDoNotPrompt; |
|
439 } |
|
440 else |
|
441 { |
|
442 dialogPref = ECommDbDialogPrefPrompt; |
|
443 } |
|
444 pref.SetDialogPreference(dialogPref); |
|
445 |
|
446 // Start the connection with the new preferences |
|
447 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetIapPrefsL: Calling RConnection::Start with new IAP prefs"); |
|
448 |
|
449 TInt retVal =aConnection.Start(pref); |
|
450 |
|
451 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("RConnection->Start retVal [%d]"), retVal)); |
|
452 |
|
453 // Get the connection "handle" from the HTTP session |
|
454 RHTTPConnectionInfo connInfo = iSess.ConnectionInfo(); |
|
455 |
|
456 // Attach socket server |
|
457 connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketServ, |
|
458 RHTTPSession::GetTable()), |
|
459 THTTPHdrVal(aSocketServer.Handle())); |
|
460 |
|
461 // Attach connection |
|
462 TInt connPtr = REINTERPRET_CAST(TInt, &aConnection); |
|
463 connInfo.SetPropertyL(iStringPool.StringF( HTTP::EHttpSocketConnection, |
|
464 RHTTPSession::GetTable()), |
|
465 THTTPHdrVal(connPtr)); |
|
466 |
|
467 // Remember the IAP id that is being set, because *at the moment*, |
|
468 // there is NO direct API to query effective IAP ID from CommsDB. |
|
469 if (!retVal) |
|
470 { |
|
471 #ifdef __SINGLE_CLICK_CONNECTIVITY_ENABLED__ |
|
472 //Since we are using by default setIapId "0". |
|
473 //There won't be any explicitly defined Iap Id |
|
474 iExplicitIapDefined = EFalse; |
|
475 iIapId = 0; |
|
476 #else |
|
477 iExplicitIapDefined = ETrue; |
|
478 iIapId = aIapId; |
|
479 #endif //__SINGLE_CLICK_CONNECTIVITY_ENABLED__ |
|
480 } |
351 return retVal; |
481 return retVal; |
352 } |
482 } |
353 |
|
354 TInt CSenHttpChannelImpl::SetID(TUint32 aId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer, TBool aSNAP) |
|
355 { |
|
356 /* |
|
357 * Single click connectivity feature has been implemented by CSock (RConnection class). |
|
358 * According to this client no need to set the IAP ID. |
|
359 * Automatically RConnection will use the suitable IAP |
|
360 */ |
|
361 TInt retVal = KErrNone; |
|
362 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl called with ID [%d]"), aId)); |
|
363 |
|
364 #ifndef __ENABLE_ALR__ |
|
365 if (iOCCenabled == EFalse) |
|
366 { |
|
367 #endif |
|
368 if (aSNAP == EFalse) |
|
369 { |
|
370 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- SetIAPID"); |
|
371 TCommDbConnPref pref; |
|
372 pref.SetIapId( aId ); |
|
373 TCommDbDialogPref dialogPref; |
|
374 if (aDialogPref) |
|
375 { |
|
376 dialogPref = ECommDbDialogPrefDoNotPrompt; |
|
377 } |
|
378 else |
|
379 { |
|
380 dialogPref = ECommDbDialogPrefPrompt; |
|
381 } |
|
382 pref.SetDialogPreference(dialogPref); |
|
383 retVal = aConnection.Start(pref); |
|
384 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("RConnection->Start retVal [%d]"), retVal)); |
|
385 } |
|
386 else |
|
387 { |
|
388 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- SetSNAPID"); |
|
389 // Set the SNAP selection preferences (SNAP ID) |
|
390 TConnSnapPref pref; |
|
391 pref.SetSnap(aId); |
|
392 // Start the connection with the new preferences |
|
393 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"- SetSnapPrefsL: Calling RConnection::Start with new SNAP prefs"); |
|
394 TInt retVal = aConnection.Start(pref); |
|
395 } |
|
396 #ifndef __ENABLE_ALR__ |
|
397 } |
|
398 else |
|
399 { |
|
400 if (aSNAP == EFalse) |
|
401 { |
|
402 /* If IAP id is zero, it is interpreted as |
|
403 * client's request for not requesting any specific IAP. |
|
404 * Default value is 0. |
|
405 * |
|
406 * If IAP id is set, SNAP id shall be zero. |
|
407 * If IAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown. |
|
408 * If IAP id is set, Connection selection dialog shall be disabled. |
|
409 * If IAP id is set, bearer set shall be EExtendedConnBearerUnknown. |
|
410 * If IAP id is set, forced roaming is disabled automatically. |
|
411 * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection |
|
412 * selection dialog shall be enabled. |
|
413 */ |
|
414 |
|
415 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC with IAP Settings"); |
|
416 TConnPrefList prefList; |
|
417 TExtendedConnPref extPrefs; |
|
418 //extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown); |
|
419 //TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC Silent Connection"); |
|
420 //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
|
421 //extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown); |
|
422 extPrefs.SetIapId(aId); |
|
423 extPrefs.SetSnapId(0); |
|
424 prefList.AppendL(&extPrefs); |
|
425 retVal = aConnection.Start(prefList); |
|
426 if(retVal == KErrNone) |
|
427 { |
|
428 iIapId = aId; |
|
429 } |
|
430 else |
|
431 { |
|
432 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP ->Start retVal [%d]"), retVal)); |
|
433 } |
|
434 } |
|
435 else |
|
436 { |
|
437 /** |
|
438 * Sets SNAP id. If SNAP id is zero, it is interpreted as |
|
439 * client's request for not requesting any specific SNAP. |
|
440 * Default value is 0. |
|
441 * |
|
442 * If SNAP id is set, IAP id shall be zero. |
|
443 * If SNAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown. |
|
444 * If SNAP id is set, Connection selection dialog shall be disabled. |
|
445 * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection |
|
446 * selection dialog shall be enabled. |
|
447 */ |
|
448 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC with SNAP Settings"); |
|
449 TConnPrefList prefList; |
|
450 TExtendedConnPref extPrefs; |
|
451 //extPrefs.SetSnapPurpose( CMManager::ESnapPurposeUnknown); |
|
452 //TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting up OCC Silent Connection"); |
|
453 //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
|
454 //extPrefs.SetBearerSet(TExtendedConnBearer::EExtendedConnBearerUnknown); |
|
455 if(aId == 0) |
|
456 { |
|
457 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel, "- Setting SnapPurpose Internet"); |
|
458 if(aDialogPref) //If it fails because of unavailibility of access points |
|
459 { |
|
460 extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown); |
|
461 extPrefs.SetConnSelectionDialog(ETrue); |
|
462 } |
|
463 else |
|
464 { |
|
465 extPrefs.SetSnapPurpose(CMManager::ESnapPurposeInternet); |
|
466 //extPrefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent); |
|
467 } |
|
468 } |
|
469 else |
|
470 { |
|
471 extPrefs.SetSnapId(aId); |
|
472 extPrefs.SetIapId(0); |
|
473 extPrefs.SetSnapPurpose(CMManager::ESnapPurposeUnknown); |
|
474 extPrefs.SetConnSelectionDialog(EFalse); |
|
475 } |
|
476 prefList.AppendL(&extPrefs); |
|
477 retVal = aConnection.Start(prefList); |
|
478 |
|
479 if(retVal == KErrNone) |
|
480 { |
|
481 aConnection.GetIntSetting( _L("IAP\\Id"), iIapId); |
|
482 TName name; |
|
483 retVal = aConnection.Name(name); |
|
484 if(retVal == KErrNone) |
|
485 { |
|
486 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP Name [%S]"), &name)); |
|
487 } |
|
488 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("GetIntSetting returned IAP [%d]"), iIapId)); |
|
489 } |
|
490 else |
|
491 { |
|
492 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("SNAP ->Start retVal [%d]"), retVal)); |
|
493 } |
|
494 } |
|
495 } |
|
496 #endif |
|
497 if (!retVal) |
|
498 { |
|
499 iExplicitIapDefined = ETrue; |
|
500 } |
|
501 return retVal; |
|
502 } |
|
503 |
|
504 TInt CSenHttpChannelImpl::SetSnapPrefsL( TUint32 aSnapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer ) |
483 TInt CSenHttpChannelImpl::SetSnapPrefsL( TUint32 aSnapId, TBool aDialogPref, RConnection& aConnection, RSocketServ& aSocketServer ) |
505 { |
484 { |
506 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- CSenHttpChannelImpl::SetSnapPrefsL, SNAP ID (%d)"), aSnapId)); |
485 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("- CSenHttpChannelImpl::SetSnapPrefsL, SNAP ID (%d)"), aSnapId)); |
507 // Check whether SNAP ID is not equal with the one that is currently in effect: |
486 // Check whether SNAP ID is not equal with the one that is currently in effect: |
508 if(iExplicitIapDefined && iSnapId == aSnapId ) |
487 if(iExplicitIapDefined && iSnapId == aSnapId ) |
685 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL"); |
667 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL"); |
686 TUriParser8 uri; |
668 TUriParser8 uri; |
687 RStringF method; |
669 RStringF method; |
688 TPtrC8 deflate; |
670 TPtrC8 deflate; |
689 // Set IAP preferences, if such exist in properties (and not already in effect): |
671 // Set IAP preferences, if such exist in properties (and not already in effect): |
690 TUint32 id(KErrNone); |
672 TUint32 iapId(KErrNone); |
691 TBool prompt(ETrue); |
673 TBool doNotPrompt(ETrue); |
692 |
674 |
693 TInt retVal = aProps.IAPDialogL( prompt ); |
675 TInt retVal = aProps.IAPDialogL( doNotPrompt ); |
694 if ( retVal != KErrNone ) |
676 if ( retVal != KErrNone ) |
695 { |
677 { |
696 // by default, do not prompt (even if property does not exist!) |
678 // by default, do not prompt (even if property does not exist!) |
697 // => only if property is set, and has value "FALSE", show PROMPT |
679 // => only if property is set, and has value "FALSE", show PROMPT |
698 prompt = ETrue; |
680 doNotPrompt = ETrue; |
699 } |
681 } |
700 |
682 |
701 #ifndef __ENABLE_ALR__ |
|
702 // Independent of dialog preference (property's existance), if IAP was predefined, it must be set |
683 // Independent of dialog preference (property's existance), if IAP was predefined, it must be set |
703 if(((aProps.IapIdL(id)) == KErrNone)) |
684 if(((aProps.IapIdL(iapId)) == KErrNone)) |
704 { |
685 { |
705 retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ); |
686 retVal = SetIapPrefsL(iapId, doNotPrompt, iConnection, iSockServ); |
706 } |
687 } |
707 else if(((aProps.SnapIdL(id)) == KErrNone)) |
688 else if(((aProps.SnapIdL(iapId)) == KErrNone)) |
708 { |
689 { |
709 retVal = SetSnapPrefsL(id, prompt, iConnection, iSockServ); |
690 retVal = SetSnapPrefsL(iapId, doNotPrompt, iConnection, iSockServ); |
710 } |
691 } |
711 else//to better control RConnection, we have to call Start by ourselve |
692 else//to better control RConnection, we have to call Start by ourselve |
712 { |
693 { |
713 retVal = SetSnapPrefsL(0, EFalse, iConnection, iSockServ); |
694 retVal = SetSnapPrefsL(0, EFalse, iConnection, iSockServ); |
714 if(retVal == KErrNotFound) |
695 if(retVal == KErrNotFound) |
715 { |
696 { |
716 if(iOCCenabled == EFalse) |
697 retVal = SetIapPrefsL(0, EFalse, iConnection, iSockServ); |
717 { |
|
718 retVal = SetIapPrefsL(0, EFalse, iConnection, iSockServ); |
|
719 } |
|
720 else |
|
721 { |
|
722 retVal = SetSnapPrefsL(0, prompt, iConnection, iSockServ); |
|
723 } |
|
724 } |
698 } |
725 } |
699 } |
726 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Set Snap/IAP prefs retVal [%d]"), retVal)); |
700 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("Set Snap/IAP prefs retVal [%d]"), retVal)); |
727 User::LeaveIfError(retVal); |
701 User::LeaveIfError(retVal); |
728 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL After User::Leave"); |
702 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::InvokeHttpMethodL After User::Leave"); |
729 TInt ret= iConnection.GetIntSetting(_L("IAP\\Id"), iUsedIapId); |
703 TInt ret=iConnection.GetIntSetting(_L("IAP\\Id"), iUsedIapId); |
730 // Check transport properties |
704 // Check transport properties |
731 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id)); |
|
732 #else |
|
733 retVal = SetIapPrefsL(id, prompt, iConnection, iSockServ); |
|
734 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP/SNAP %d"), id)); |
|
735 iUsedIapId = id; |
|
736 #endif |
|
737 |
|
738 CSenLayeredHttpTransportProperties::TSenHttpMethod httpMethod; |
705 CSenLayeredHttpTransportProperties::TSenHttpMethod httpMethod; |
739 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("PROMPT %d"), prompt)); |
706 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("IAP %d"), iapId)); |
|
707 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("DONT PROMPT %d"), doNotPrompt)); |
740 TInt retValHttpMethod = aProps.HttpMethodL(httpMethod); |
708 TInt retValHttpMethod = aProps.HttpMethodL(httpMethod); |
741 |
709 |
742 |
710 |
743 /*Installing the deflate filter based on the property values */ |
711 /*Installing the deflate filter based on the property values */ |
744 /*Once installed, the filter will be alive for on session lifetime */ |
712 /*Once installed, the filter will be alive for on session lifetime */ |
1907 |
1875 |
1908 TBool CSenHttpChannelImpl::EffectiveIapId( TUint32 &aIapId ) |
1876 TBool CSenHttpChannelImpl::EffectiveIapId( TUint32 &aIapId ) |
1909 { |
1877 { |
1910 TInt handle = iConnection.SubSessionHandle(); |
1878 TInt handle = iConnection.SubSessionHandle(); |
1911 if (handle>0) |
1879 if (handle>0) |
1912 { |
1880 { |
1913 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): Current RConnection's subsession handle(%d)"), handle )); |
1881 TUint connEnum(0); |
1914 TUint connEnum(0); |
1882 TInt err = iConnection.EnumerateConnections(connEnum); |
1915 TInt err = iConnection.EnumerateConnections(connEnum); |
1883 if (!err && !connEnum) |
1916 if (!err && !connEnum) |
1884 { |
1917 { |
1885 return EFalse; |
1918 return EFalse; |
1886 } |
1919 } |
1887 } |
1920 } |
1888 |
1921 else |
1889 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): Current RConnection's subsession handle(%d)"), iIapId )); |
1922 { |
1890 #ifdef _SENDEBUG |
1923 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," -> RConnection has not been initialized."); |
|
1924 } |
|
1925 |
|
1926 if( iExplicitIapDefined ) |
1891 if( iExplicitIapDefined ) |
1927 { |
1892 { |
1928 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8(" - IAP ID is known: %d"), iIapId )); |
1893 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8(" - IAP ID is known: %d"), iIapId )); |
1929 } |
1894 } |
1930 else |
1895 else |
1931 { |
1896 { |
1932 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," - IAP ID is not known."); |
1897 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," - IAP ID is not known."); |
1933 } |
1898 } |
1934 |
1899 |
|
1900 if( handle < KErrNone ) |
|
1901 { |
|
1902 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel," -> RConnection has not been initialized."); |
|
1903 } |
|
1904 #endif // _SENDEBUG |
|
1905 |
1935 if( handle && !iExplicitIapDefined ) |
1906 if( handle && !iExplicitIapDefined ) |
1936 { |
1907 { |
1937 // Eventhough IAP was not explicitely set (through Serene API), this |
1908 // Eventhough IAP was not explicitely set (through Serene API), this |
1938 // code can check what IAP end-user provided via IAP selection dialog: |
1909 // code can check what IAP end-user provided via IAP selection dialog: |
|
1910 TLSLOG_L(KSenHttpChannelLogChannelBase , KMinLogLevel,"CSenHttpChannelImpl::EffectiveIapId: about to call RConnection::GetIntSetting()"); |
1939 _LIT( KIapIdKey, "IAP\\Id" ); |
1911 _LIT( KIapIdKey, "IAP\\Id" ); |
1940 iConnection.GetIntSetting( KIapIdKey, iIapId); |
1912 iConnection.GetIntSetting( KIapIdKey, iIapId); |
1941 if ( iIapId > 0 ) |
1913 if ( iIapId > 0 ) |
1942 { |
1914 { |
1943 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("---- GetIntSetting(): retuens IAP(%d)"), iIapId )); |
1915 TLSLOG_FORMAT((KSenHttpChannelLogChannelBase , KMinLogLevel, _L8("CSenHttpChannelImpl::EffectiveIapId(): end-user provided IAP(%d)"), iIapId )); |
1944 // Treat the end-user selection as "explicit" definition as well(!): |
1916 // Treat the end-user selection as "explicit" definition as well(!): |
1945 iExplicitIapDefined = ETrue; |
1917 iExplicitIapDefined = ETrue; |
1946 } |
1918 } |
1947 } |
1919 } |
1948 if( iExplicitIapDefined ) |
1920 if( iExplicitIapDefined ) |