http GET POST头

_LIT8(KUserAgent, "SimpleClient 1.0");
_LIT8(KAccept, "*/*");
_LIT8(KMimeType, "text/plain");
_LIT8(KOnline, "X-Online-Host");

_LIT8(KContentLength, "Content-Length"); // Content type sent in a POST request
_LIT8(KContentVendor, "Content-Vendor");
_LIT8(KMsisdn, "X-Up-Calling-Line-ID");
_LIT8(KConnectionType, "Close");

_LIT8(KPragma, "Pragma");
_LIT8(KNoCache, "no-cache");

 

void SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField, const TDesC8& aHdrValue)
 {
 RStringF valStr = iSession.StringPool().OpenFStringL(aHdrValue);
 CleanupClosePushL(valStr);
 THTTPHdrVal val(valStr);
 aHeaders.SetFieldL(iSession.StringPool().StringF(aHdrField,
  RHTTPSession::GetTable()), val);
 CleanupStack::PopAndDestroy(); // valStr
 }


void AddHeaderL(RHTTPHeaders aHeaders, const TDesC8& aHeaderField, const TDesC8& aHeaderValue)
{
RStringPool stringPool = iSession.StringPool();
RStringF valStr = stringPool.OpenFStringL(aHeaderValue);
THTTPHdrVal headerVal(valStr);

RStringF fieldStr = stringPool.OpenFStringL(aHeaderField);

aHeaders.SetFieldL(fieldStr, headerVal);
valStr.Close();
fieldStr.Close();
}

SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
SetHeaderL(hdr, HTTP::EAccept, KAccept);
SetHeaderL(hdr, HTTP::EContentType, KMimeType);


AddHeaderL(headers, KOnline(), ip);
AddHeaderL(headers, KPragma(), KNoCache());

你可能感兴趣的:(http GET POST头)