17 |
17 |
18 |
18 |
19 #include <httpstringconstants.h> |
19 #include <httpstringconstants.h> |
20 #include <rhttpheaders.h> |
20 #include <rhttpheaders.h> |
21 #include <mmfcontrollerpluginresolver.h> //to get the supported MIME types |
21 #include <mmfcontrollerpluginresolver.h> //to get the supported MIME types |
22 #ifdef _DEBUG |
22 #ifdef ENABLE_USAGE_REPORT_TEST |
23 #include <bautils.h> |
23 #include <bautils.h> |
24 #include "irreportsettings.h" |
24 #include "irreportsettings.h" |
25 #endif |
25 #endif |
26 #include "irdataprovider.h" |
26 #include "irdataprovider.h" |
27 #include "irdebug.h" |
27 #include "irdebug.h" |
40 const TInt KNokiaIrAppAcceptMaxLength = 25; |
40 const TInt KNokiaIrAppAcceptMaxLength = 25; |
41 const TInt KSize = 1024; |
41 const TInt KSize = 1024; |
42 const TInt KMaxSize = 2048; |
42 const TInt KMaxSize = 2048; |
43 const TInt KBufSize = 10; |
43 const TInt KBufSize = 10; |
44 const TUid KUidHelixController = { 0x101F8514 }; // Helix Video controller UID |
44 const TUid KUidHelixController = { 0x101F8514 }; // Helix Video controller UID |
|
45 const TInt KLogbufferLenth = KLogBufferSize/2 - 1; |
45 |
46 |
46 // --------------------------------------------------------------------------- |
47 // --------------------------------------------------------------------------- |
47 // CIRHttpDataProvider::CIRHttpDataProvider(MIRHttpDataProviderObserver& |
48 // CIRHttpDataProvider::CIRHttpDataProvider(MIRHttpDataProviderObserver& |
48 // aObserver):iObserver(aObserver),iRunning(EFalse) |
49 // aObserver):iObserver(aObserver),iRunning(EFalse) |
49 // Creates instance of CIRHttpDataProvider. |
50 // Creates instance of CIRHttpDataProvider. |
217 IRLOG_DEBUG( "CIRHttpDataProvider::IssueHttpRequestL - Opening transaction" ); |
218 IRLOG_DEBUG( "CIRHttpDataProvider::IssueHttpRequestL - Opening transaction" ); |
218 // Open transaction with previous method and parsed uri. This class will |
219 // Open transaction with previous method and parsed uri. This class will |
219 // receive transaction events in MHFRunL and MHFRunError. |
220 // receive transaction events in MHFRunL and MHFRunError. |
220 iHttpTransaction = iHttpSession.OpenTransactionL( uri, *this, method ); |
221 iHttpTransaction = iHttpSession.OpenTransactionL( uri, *this, method ); |
221 |
222 |
222 #ifdef _DEBUG |
223 #ifdef ENABLE_USAGE_REPORT_TEST |
223 RFs iFs; |
224 RFs iFs; |
224 User::LeaveIfError(iFs.Connect()); |
225 User::LeaveIfError(iFs.Connect()); |
225 |
226 |
226 TTime timeStamp; |
227 TTime timeStamp; |
227 //timeStamp.UniversalTime(); |
228 //timeStamp.UniversalTime(); |
287 |
288 |
288 // Submit the transaction. After this the framework will give transaction |
289 // Submit the transaction. After this the framework will give transaction |
289 // events via MHFRunL and MHFRunError. |
290 // events via MHFRunL and MHFRunError. |
290 iHttpTransaction.SubmitL(); |
291 iHttpTransaction.SubmitL(); |
291 |
292 |
292 #ifdef _DEBUG |
293 #ifdef ENABLE_USAGE_REPORT_TEST |
293 if ( aRequestInfo.iMethod == EIRHttpPOST ) |
294 if ( aRequestInfo.iMethod == EIRHttpPOST ) |
294 { |
295 { |
295 _LIT( KSentPrefix, "X__"); |
296 _LIT( KSentPrefix, "X__"); |
296 TFileName sentLogFileName(KDstFilePath); |
297 TFileName sentLogFileName(KDstFilePath); |
297 sentLogFileName.Append(KSentPrefix); |
298 sentLogFileName.Append(KSentPrefix); |
625 |
626 |
626 // Set the User-Agent header to UAProf string |
627 // Set the User-Agent header to UAProf string |
627 SetHeaderL( header, HTTP::EUserAgent, |
628 SetHeaderL( header, HTTP::EUserAgent, |
628 iIRNetworkControllerHandle->GetUAProfString()->Des() ); |
629 iIRNetworkControllerHandle->GetUAProfString()->Des() ); |
629 logstr.Copy(iIRNetworkControllerHandle->GetUAProfString()->Des()); |
630 logstr.Copy(iIRNetworkControllerHandle->GetUAProfString()->Des()); |
630 IRLOG_DEBUG2( "CIRHttpDataProvider::BuildHeadersL - HTTP::EUserAgent = %S", &logstr ); |
631 IRLOG_DEBUG( "CIRHttpDataProvider::BuildHeadersL - HTTP::EUserAgent ="); |
631 |
632 TInt logstrLenth = logstr.Length(); |
|
633 TBuf<KLogbufferLenth> tempStr; |
|
634 TInt index = 0; |
|
635 while( logstrLenth > 0 ) |
|
636 { |
|
637 if( logstrLenth > KLogbufferLenth ) |
|
638 { |
|
639 tempStr.Copy( &logstr[index], KLogbufferLenth ); |
|
640 } |
|
641 else |
|
642 { |
|
643 tempStr.Copy( &logstr[index], logstrLenth ); |
|
644 } |
|
645 IRLOG_DEBUG2( "%S", &tempStr ); |
|
646 index += KLogbufferLenth; |
|
647 logstrLenth -= KLogbufferLenth; |
|
648 } |
632 // Set the Accept Character set header |
649 // Set the Accept Character set header |
633 SetHeaderL( header, HTTP::EAcceptCharset, KAcceptCharset ); |
650 SetHeaderL( header, HTTP::EAcceptCharset, KAcceptCharset ); |
634 logstr.Copy(KAcceptCharset); |
651 logstr.Copy(KAcceptCharset); |
635 IRLOG_DEBUG2( "CIRHttpDataProvider::BuildHeadersL - HTTP::EAcceptCharset = %S", &logstr ); |
652 IRLOG_DEBUG2( "CIRHttpDataProvider::BuildHeadersL - HTTP::EAcceptCharset = %S", &logstr ); |
636 |
653 |
666 RStringF xWapProfileString = iHttpSession.StringPool().OpenFStringL( |
683 RStringF xWapProfileString = iHttpSession.StringPool().OpenFStringL( |
667 xWapProfile ); |
684 xWapProfile ); |
668 RStringF xWapProfileValueString = iHttpSession.StringPool().OpenFStringL( |
685 RStringF xWapProfileValueString = iHttpSession.StringPool().OpenFStringL( |
669 iIRNetworkControllerHandle->GetWapProfString()->Des() ); |
686 iIRNetworkControllerHandle->GetWapProfString()->Des() ); |
670 logstr.Copy(iIRNetworkControllerHandle->GetWapProfString()->Des()); |
687 logstr.Copy(iIRNetworkControllerHandle->GetWapProfString()->Des()); |
671 IRLOG_DEBUG2( "CIRHttpDataProvider::BuildHeadersL - x-wap-profile = %S", &logstr ); |
688 IRLOG_DEBUG( "CIRHttpDataProvider::BuildHeadersL - x-wap-profile ="); |
|
689 logstrLenth = logstr.Length(); |
|
690 index = 0; |
|
691 while( logstrLenth > 0 ) |
|
692 { |
|
693 if( logstrLenth > KLogbufferLenth ) |
|
694 { |
|
695 tempStr.Copy( &logstr[index], KLogbufferLenth ); |
|
696 } |
|
697 else |
|
698 { |
|
699 tempStr.Copy( &logstr[index], logstrLenth ); |
|
700 } |
|
701 IRLOG_DEBUG2( "%S", &tempStr ); |
|
702 index += KLogbufferLenth; |
|
703 logstrLenth -= KLogbufferLenth; |
|
704 } |
|
705 |
672 THTTPHdrVal xWapProfileHeader(xWapProfileValueString ); |
706 THTTPHdrVal xWapProfileHeader(xWapProfileValueString ); |
673 header.SetFieldL(xWapProfileString, xWapProfileHeader); |
707 header.SetFieldL(xWapProfileString, xWapProfileHeader); |
674 xWapProfileString.Close(); |
708 xWapProfileString.Close(); |
675 xWapProfileValueString.Close(); |
709 xWapProfileValueString.Close(); |
676 |
710 |
776 RStringF xNokiaIrAppAcceptString = iHttpSession.StringPool().OpenFStringL( |
810 RStringF xNokiaIrAppAcceptString = iHttpSession.StringPool().OpenFStringL( |
777 xNokiaIrAppAccept ); |
811 xNokiaIrAppAccept ); |
778 RStringF xNokiaIrAppAcceptValueString = iHttpSession.StringPool().OpenFStringL( |
812 RStringF xNokiaIrAppAcceptValueString = iHttpSession.StringPool().OpenFStringL( |
779 audioMIMEs ); |
813 audioMIMEs ); |
780 logstr.Copy(audioMIMEs); |
814 logstr.Copy(audioMIMEs); |
781 IRLOG_DEBUG2( "CIRHttpDataProvider::BuildHeadersL - X-Nokia-iRAPP-Accept = %S", &logstr ); |
815 IRLOG_DEBUG( "CIRHttpDataProvider::BuildHeadersL - X-Nokia-iRAPP-Accept =" ); |
|
816 logstrLenth = logstr.Length(); |
|
817 index = 0; |
|
818 while( logstrLenth > 0 ) |
|
819 { |
|
820 if( logstrLenth > KLogbufferLenth ) |
|
821 { |
|
822 tempStr.Copy( &logstr[index], KLogbufferLenth ); |
|
823 } |
|
824 else |
|
825 { |
|
826 tempStr.Copy( &logstr[index], logstrLenth ); |
|
827 } |
|
828 IRLOG_DEBUG2( "%S", &tempStr ); |
|
829 index += KLogbufferLenth; |
|
830 logstrLenth -= KLogbufferLenth; |
|
831 } |
782 THTTPHdrVal xNokiaIrAppAcceptHeader(xNokiaIrAppAcceptValueString ); |
832 THTTPHdrVal xNokiaIrAppAcceptHeader(xNokiaIrAppAcceptValueString ); |
783 header.SetFieldL(xNokiaIrAppAcceptString, xNokiaIrAppAcceptHeader); |
833 header.SetFieldL(xNokiaIrAppAcceptString, xNokiaIrAppAcceptHeader); |
784 xNokiaIrAppAcceptString.Close(); |
834 xNokiaIrAppAcceptString.Close(); |
785 xNokiaIrAppAcceptValueString.Close(); |
835 xNokiaIrAppAcceptValueString.Close(); |
786 |
836 |