syncmlfw/common/http/src/nsmlhttp.cpp
changeset 5 3f7d9dbe57c8
parent 0 b497e44ab2fc
child 9 57a65a3a658c
child 22 19fb38abab1d
equal deleted inserted replaced
4:958eca8527dd 5:3f7d9dbe57c8
    20 #include "nsmlhttpclient.h"
    20 #include "nsmlhttpclient.h"
    21 #include <e32property.h> 
    21 #include <e32property.h> 
    22 #include <DevManInternalCRKeys.h>
    22 #include <DevManInternalCRKeys.h>
    23 #include <centralrepository.h>
    23 #include <centralrepository.h>
    24 #include "nsmlprivatepskeys.h"
    24 #include "nsmlprivatepskeys.h"
       
    25 #include <nsmlconstants.h>
    25 
    26 
    26 
    27 
    27 #include "nsmlerror.h"
    28 #include "nsmlerror.h"
    28 #ifdef __NSML_DEBUG__
    29 #ifdef __NSML_DEBUG__
    29 #include "wbxml2xmlconverter.h"
    30 #include "wbxml2xmlconverter.h"
   141         if ( err == KErrNone )
   142         if ( err == KErrNone )
   142             {
   143             {
   143             iMaxMsgSize = value;
   144             iMaxMsgSize = value;
   144             }
   145             }
   145         }
   146         }
       
   147     
       
   148     CRepository* rep = CRepository::NewLC(KCRUidNSmlDSEngine);
       
   149     TInt flag(0);
       
   150     TRAPD(err, rep->Get(KNsmlDsDeflateSupport, flag));
       
   151     DBG_FILE_CODE(flag, _S8("Flag value"));
       
   152     if ( err == KErrNone )
       
   153         {
       
   154         iDeflateFlag = flag;
       
   155         }
       
   156     CleanupStack::PopAndDestroy(rep);
   146 	}
   157 	}
   147 
   158 
   148 // ---------------------------------------------------------
   159 // ---------------------------------------------------------
   149 // CNSmlHTTP::ReadRepositoryL(TInt aKey, TInt& aValue)
   160 // CNSmlHTTP::ReadRepositoryL(TInt aKey, TInt& aValue)
   150 // 
   161 // 
   563 #endif // __NSML_DEBUG__
   574 #endif // __NSML_DEBUG__
   564 	
   575 	
   565 	delete iReqBodySubmitBuffer;
   576 	delete iReqBodySubmitBuffer;
   566     iReqBodySubmitBuffer = NULL;
   577     iReqBodySubmitBuffer = NULL;
   567 	
   578 	
   568 	if( (iSession == ESyncMLDSSession) && (iServerAcceptEncoding == ExptDeflate) )
   579 	if( (iSession == ESyncMLDSSession) && (iServerAcceptEncoding == ExptDeflate) && iDeflateFlag )
   569 		{
   580 		{
   570 		TRAPD( err, CompressL(aStartPtr) );
   581 		TRAPD( err, CompressL(aStartPtr) );
   571 		User::LeaveIfError( err );
   582 		User::LeaveIfError( err );
   572 		}
   583 		}
   573 	else
   584 	else
  1068 	CleanupStack::PopAndDestroy( useragent );  
  1079 	CleanupStack::PopAndDestroy( useragent );  
  1069 	SetHeaderL( hdr, HTTP::ECacheControl, KSmlCacheControl );
  1080 	SetHeaderL( hdr, HTTP::ECacheControl, KSmlCacheControl );
  1070 	SetHeaderL( hdr, HTTP::EAcceptCharset, KSmlAcceptCharSet );
  1081 	SetHeaderL( hdr, HTTP::EAcceptCharset, KSmlAcceptCharSet );
  1071 	SetHeaderL( hdr, HTTP::EAcceptLanguage , KSmlAcceptLanguage );
  1082 	SetHeaderL( hdr, HTTP::EAcceptLanguage , KSmlAcceptLanguage );
  1072 		
  1083 		
  1073 	if( iSession == ESyncMLDSSession )//for ds session
  1084 	if( iSession == ESyncMLDSSession && iDeflateFlag )//for ds session
  1074 	  { 
  1085 	  {
  1075 	  if(iServerAcceptEncoding == ExptDeflate)
  1086 	  if(iServerAcceptEncoding == ExptDeflate)
  1076 	      {
  1087           {
  1077 	      SetHeaderL( hdr, HTTP::EContentEncoding , KSmlContentDeflate );
  1088           SetHeaderL( hdr, HTTP::EContentEncoding , KSmlContentDeflate );
  1078 	      }
  1089           }
  1079 	      SetHeaderL( hdr, HTTP::EAcceptEncoding , KSmlContentDeflate );
  1090           SetHeaderL( hdr, HTTP::EAcceptEncoding , KSmlContentDeflate );
  1080 	  }
  1091 	  }
  1081 
  1092 
  1082 	// Add headers and body data for methods that use request bodies
  1093 	// Add headers and body data for methods that use request bodies
  1083 	// Content type header
  1094 	// Content type header
  1084 	TBuf8<KMaxContentTypeSize> contTypeBuf;
  1095 	TBuf8<KMaxContentTypeSize> contTypeBuf;
  1133 		{	
  1144 		{	
  1134 			User::LeaveIfError( TNSmlError::ESmlStatusSizeMismatch );
  1145 			User::LeaveIfError( TNSmlError::ESmlStatusSizeMismatch );
  1135 		}
  1146 		}
  1136 		else
  1147 		else
  1137 		{
  1148 		{
  1138 		    if ( (iSession == ESyncMLDSSession) && (iServerContentEncoding == ExptDeflate) )
  1149 		    if ( (iSession == ESyncMLDSSession) && (iServerContentEncoding == ExptDeflate) && iDeflateFlag )
  1139 		        {		    
  1150 		        {		    
  1140 		        TRAPD( err, DecompressL( aStartPtr ) );		    
  1151 		        TRAPD( err, DecompressL( aStartPtr ) );		    
  1141 				User::LeaveIfError( err );
  1152 				User::LeaveIfError( err );
  1142 		        }
  1153 		        }
  1143 		    else		    
  1154 		    else