70 { |
70 { |
71 //open the transaction |
71 //open the transaction |
72 LOG(ESOCKET,EInfo, "CHttpTransactionClient::ConstructL "); |
72 LOG(ESOCKET,EInfo, "CHttpTransactionClient::ConstructL "); |
73 iFlag = 0; |
73 iFlag = 0; |
74 iDrmBuf = HBufC8::NewL(256); |
74 iDrmBuf = HBufC8::NewL(256); |
|
75 iEndOfRequest = false; |
75 OpenTransactionL(aUri , aRequestMethod); |
76 OpenTransactionL(aUri , aRequestMethod); |
76 } |
77 } |
77 |
78 |
78 void CHttpTransactionClient::OpenTransactionL(const TDesC* aUri, const TDesC* aRequestMethod) |
79 void CHttpTransactionClient::OpenTransactionL(const TDesC* aUri, const TDesC* aRequestMethod) |
79 { |
80 { |
96 |
97 |
97 CleanupStack::PopAndDestroy(2);//requestMethoStr// uriBuf |
98 CleanupStack::PopAndDestroy(2);//requestMethoStr// uriBuf |
98 LOG(ESOCKET,EInfo,"CHttpTransactionClient::OpenTransactionL - "); |
99 LOG(ESOCKET,EInfo,"CHttpTransactionClient::OpenTransactionL - "); |
99 } |
100 } |
100 |
101 |
101 void CHttpTransactionClient::SubmitL(RPointerArray<HBufC8>* aRawHeaders , TDesC8* aPostData, int aResponseTimeout) |
102 void CHttpTransactionClient::SubmitL(RPointerArray<HBufC8>* aRawHeaders , TDesC8* aPostData, int aResponseTimeout, bool aPartialDataFlag) |
102 { |
103 { |
103 //ELOG(ESOCKET,"CHttpTransactionClient::SubmitL + "); |
104 //ELOG(ESOCKET,"CHttpTransactionClient::SubmitL + "); |
104 //retrieve the headers |
105 //retrieve the headers |
|
106 iPartialPostData = aPartialDataFlag; |
105 TInt respTimeOut = aResponseTimeout; |
107 TInt respTimeOut = aResponseTimeout; |
106 delete iBuf; |
108 delete iBuf; |
107 iBuf=NULL; |
109 iBuf=NULL; |
108 if (aPostData!=NULL && aPostData->Length()>0) |
110 if (aPostData!=NULL && aPostData->Length()>0) |
109 { |
111 { |
694 * If this is the case notify of the error code so we don't block java. |
696 * If this is the case notify of the error code so we don't block java. |
695 */ |
697 */ |
696 |
698 |
697 void CHttpTransactionClient::NotifyErrorL(TInt aErrorCode) |
699 void CHttpTransactionClient::NotifyErrorL(TInt aErrorCode) |
698 { |
700 { |
699 LOG1(ESOCKET,EInfo," CHttpTransactionClient::NotifyErrorL: %d ",aErrorCode); |
701 ELOG1(ESOCKET," CHttpTransactionClient::NotifyErrorL: %d ",aErrorCode); |
700 if ((aErrorCode == KErrNotReady)) |
702 if ((aErrorCode == KErrNotReady)) |
701 { |
703 { |
702 iTransaction.Cancel(); |
704 iTransaction.Cancel(); |
703 iHttpSession.RestartConnection(); |
705 iHttpSession.RestartConnection(); |
704 |
706 |
759 @param aDataPart - the data part |
761 @param aDataPart - the data part |
760 @return ETrue if this is the last part. EFalse otherwise */ |
762 @return ETrue if this is the last part. EFalse otherwise */ |
761 TBool CHttpTransactionClient::GetNextDataPart(TPtrC8& aDataPart) |
763 TBool CHttpTransactionClient::GetNextDataPart(TPtrC8& aDataPart) |
762 { |
764 { |
763 LOG(ESOCKET,EInfo,"CHttpTransactionClient::GetNextDataPart"); |
765 LOG(ESOCKET,EInfo,"CHttpTransactionClient::GetNextDataPart"); |
764 TBool lastPart=EFalse; |
766 TBool lastPart=ETrue; |
|
767 |
765 if (iBuf!=NULL) |
768 if (iBuf!=NULL) |
766 { |
769 { |
767 lastPart = ETrue; |
770 // in-case of non-chunked, this is the end of POST data |
768 aDataPart.Set(iBuf->Des()); |
771 aDataPart.Set(iBuf->Des()); |
769 } |
772 } |
|
773 if (iPartialPostData) |
|
774 { |
|
775 lastPart = iEndOfRequest; |
|
776 } |
|
777 LOG1(ESOCKET,EInfo,"CHttpTransactionClient::GetNextDataPart, returning : %d", lastPart); |
770 return lastPart; |
778 return lastPart; |
771 } |
779 } |
772 |
780 |
773 /** Release the current data part being held at the data |
781 /** Release the current data part being held at the data |
774 supplier. This call indicates to the supplier that the part |
782 supplier. This call indicates to the supplier that the part |
775 is no longer needed, and another one can be supplied, if |
783 is no longer needed, and another one can be supplied, if |
776 appropriate. */ |
784 appropriate. */ |
777 void CHttpTransactionClient::ReleaseData() |
785 void CHttpTransactionClient::ReleaseData() |
778 { |
786 { |
779 LOG(ESOCKET,EInfo," CHttpTransactionClient::ReleaseData: delete iBuf"); |
787 LOG(ESOCKET,EInfo," CHttpTransactionClient::ReleaseData: "); |
780 if (iBuf) |
788 if (iBuf) |
781 { |
789 { |
782 delete iBuf; |
790 delete iBuf; |
783 iBuf=NULL; |
791 iBuf=NULL; |
784 } |
792 } |
|
793 if (iPartialPostData) |
|
794 { |
|
795 // inform the java side that post data is consumed |
|
796 TRAP_IGNORE(iObserver->DoPostCallBack()); |
|
797 } |
|
798 |
785 } |
799 } |
786 |
800 |
787 /** Obtain the overall size of the data being supplied, if known |
801 /** Obtain the overall size of the data being supplied, if known |
788 to the supplier. Where a body of data is supplied in several |
802 to the supplier. Where a body of data is supplied in several |
789 parts this size will be the sum of all the part sizes. If |
803 parts this size will be the sum of all the part sizes. If |
793 |
807 |
794 @return A size in bytes, or KErrNotFound if the size is not known. */ |
808 @return A size in bytes, or KErrNotFound if the size is not known. */ |
795 TInt CHttpTransactionClient::OverallDataSize() |
809 TInt CHttpTransactionClient::OverallDataSize() |
796 { |
810 { |
797 TInt overallSize = KErrNotFound; |
811 TInt overallSize = KErrNotFound; |
798 if (iBuf) |
812 if (iPartialPostData == true) |
|
813 { |
|
814 overallSize = KErrNotFound; |
|
815 } |
|
816 else if (iBuf) |
799 { |
817 { |
800 overallSize=iBuf->Length(); |
818 overallSize=iBuf->Length(); |
801 } |
819 } |
802 LOG1(ESOCKET,EInfo," CHttpTransactionClient::OverallDataSize: %d",overallSize); |
820 LOG1(ESOCKET,EInfo," CHttpTransactionClient::OverallDataSize: %d",overallSize); |
803 return overallSize; |
821 return overallSize; |
|
822 } |
|
823 |
|
824 void CHttpTransactionClient::PostDataL(HBufC8* aPostData, const bool aEndOfRequest) |
|
825 { |
|
826 LOG(ESOCKET,EInfo,"CHttpTransactionClient::PostData "); |
|
827 iEndOfRequest = aEndOfRequest; |
|
828 if (aPostData!=NULL && aPostData->Length()>0) |
|
829 { |
|
830 iBuf=aPostData; |
|
831 } |
|
832 else |
|
833 { |
|
834 HBufC8* buf = HBufC8::NewL(1); // descriptor of length 0 |
|
835 iBuf = buf; |
|
836 } |
|
837 iTransaction.NotifyNewRequestBodyPartL(); // notify the stack that new request body data is available |
|
838 |
|
839 |
804 } |
840 } |
805 |
841 |
806 /** Reset the data supplier. This indicates to the data supplier that it should |
842 /** Reset the data supplier. This indicates to the data supplier that it should |
807 return to the first part of the data. This could be used in a situation where |
843 return to the first part of the data. This could be used in a situation where |
808 the data consumer has encountered an error and needs the data to be supplied |
844 the data consumer has encountered an error and needs the data to be supplied |
812 If the supplier cannot reset it should return an error code; otherwise it should |
848 If the supplier cannot reset it should return an error code; otherwise it should |
813 return KErrNone, where the reset will be assumed to have succeeded*/ |
849 return KErrNone, where the reset will be assumed to have succeeded*/ |
814 TInt CHttpTransactionClient::Reset() |
850 TInt CHttpTransactionClient::Reset() |
815 { |
851 { |
816 LOG(ESOCKET,EInfo,"CHttpTransactionClient::Reset"); |
852 LOG(ESOCKET,EInfo,"CHttpTransactionClient::Reset"); |
817 TInt err = KErrNone; |
853 ELOG1(ESOCKET, "Reset() , Tran = %d", iTransaction.Id()); |
|
854 TInt err = 0; |
|
855 if(iPartialPostData == false) |
|
856 { |
|
857 err = KErrNone; |
|
858 } |
|
859 else |
|
860 { |
|
861 err = KErrNotSupported; |
|
862 } |
818 return err; |
863 return err; |
819 } |
864 } |
820 |
865 |
821 |
866 |
822 MNativeSecureConnectionInformation* CHttpTransactionClient::GetSecurityInfo() |
867 MNativeSecureConnectionInformation* CHttpTransactionClient::GetSecurityInfo() |