本文整理汇总了C++中THTTPHdrVal::SetStrF方法的典型用法代码示例。如果您正苦于以下问题:C++ THTTPHdrVal::SetStrF方法的具体用法?C++ THTTPHdrVal::SetStrF怎么用?C++ THTTPHdrVal::SetStrF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THTTPHdrVal
的用法示例。
在下文中一共展示了THTTPHdrVal::SetStrF方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DecodeGenericParamTokenL
TInt CWspHeaderReader::DecodeGenericParamTokenL(TWspPrimitiveDecoder& aDecoder, const TStringTable& aStrTable,
THTTPHdrVal& aParamValue, RStringF& aParamDesValue) const
{
TInt err = 0;
switch( aDecoder.VarType() )
{
case TWspPrimitiveDecoder::EString:
{
TPtrC8 fieldNameString;
err = aDecoder.String(fieldNameString);
User::LeaveIfError(err);
aParamDesValue = iStrPool.OpenFStringL(fieldNameString);
aParamValue.SetStrF(aParamDesValue);
} break;
case TWspPrimitiveDecoder::E7BitVal:
{
TUint8 fieldNameToken = 0;
err = aDecoder.Val7Bit(fieldNameToken);
User::LeaveIfError(err);
aParamDesValue = iStrPool.StringF(fieldNameToken, aStrTable);
aParamValue.SetStrF(aParamDesValue);
} break;
default:
User::Leave(KErrCorrupt);
break;
}
return err;
}
示例2: EnsureContentLengthL
void CHttpClientFilter::EnsureContentLengthL(RHTTPTransaction aTransaction)
{
RHTTPRequest request = aTransaction.Request();
if( request.HasBody() )
{
THTTPHdrVal hdrVal;
RStringF teName = iStringPool.StringF(HTTP::ETransferEncoding, iStringTable);
// Get rid of Content-Length header if present
// NOTE - cannot use a local variable for the Content-Length as causes a
// compiler bug in thumb builds - grand! : (
RHTTPHeaders headers = request.GetHeaderCollection();
headers.RemoveField(iStringPool.StringF(HTTP::EContentLength, iStringTable));
TInt bodySize = request.Body()->OverallDataSize();
if( bodySize != KErrNotFound )
{
// Size is known - set the ContentLength header.
headers.SetFieldL(iStringPool.StringF(HTTP::EContentLength, iStringTable), THTTPHdrVal(bodySize));
}
else if( headers.GetField(teName, 0, hdrVal) == KErrNotFound )
{
// Size is unknown and there's been no Encoding indicated by the
// client - set the 'TransferEncoding: chunked'
hdrVal.SetStrF(iStringPool.StringF(HTTP::EChunked, iStringTable));
headers.SetFieldL(teName, hdrVal);
}
}
}
示例3: EnsureContentTypePresentL
void CHttpClientFilter::EnsureContentTypePresentL(RHTTPTransaction aTransaction)
{
// From RFC 2616 Section 7.2.1 -
//
// Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type
// header field defining the media type of that body. If and only if the
// media type is not given by a Content-Type field, the recipient MAY attempt
// to guess the media type via inspection of its content and/or the name
// extension(s) of the URI used to identify the resource. If the media type
// remains unknown, the recipient SHOULD treat it as type "application/octet-stream".
RHTTPHeaders headers = aTransaction.Response().GetHeaderCollection();
THTTPHdrVal contentType;
RStringF contentTypeString = iStringPool.StringF(HTTP::EContentType, iStringTable);
if( headers.GetField(contentTypeString, 0, contentType) == KErrNotFound )
{
// There is no Content-Type header - add it with a value of
// "application/octet-stream".
contentType.SetStrF(iStringPool.StringF(HTTP::EApplicationOctetStream, iStringTable));
headers.SetFieldL(contentTypeString, contentType);
}
}
示例4: DecodeWellKnownParamTokenL
void CWspHeaderReader::DecodeWellKnownParamTokenL(TWspPrimitiveDecoder& aDecoder, TInt& aBytesRead,
TPtrC8& aRawParamBlock, CHeaderFieldPart& aHeaderFieldPart) const
{
TInt err = 0;
TUint32 parameterToken = 0;
aBytesRead = aDecoder.Integer(parameterToken);
THTTPHdrVal paramValue;
RStringF paramDesValue;
CleanupClosePushL(paramDesValue);
RStringF paramName = iStrPool.StringF(parameterToken, WSPParam::Table);
switch( parameterToken )
{
case WSPParam::EQ:
{
// Decode Q value
TUint32 qIntValue = 0;
err = aDecoder.UintVar(qIntValue);
User::LeaveIfError(err);
aBytesRead += err;
TReal q;
TInt numDecimals = 0;
TBuf8<KMaxNumQDigits> qDesC;
if( qIntValue > 100 )
{
// Value is -100 and then divide by 1000
qIntValue -= 100;
q = ((TReal)(qIntValue/1000.));
numDecimals = 3;
}
else
{
// Value is -1 and then divide by 100
--qIntValue;
if( qIntValue%10 ==0 )
numDecimals = 1;
else
numDecimals = 2;
q = ((TReal)(qIntValue/100.));
}
TRealFormat realFt(KMaxNumQDigits,numDecimals); // set max width and 3 decimal places
// always use a decimal separator rather than the one supplied
// by the current locale
realFt.iPoint = TChar('.');
qDesC.Num(q, realFt);
paramDesValue = iStrPool.OpenFStringL(qDesC);
paramValue.SetStrF(paramDesValue);
} break;
case WSPParam::ECharset:
{
if( aRawParamBlock[aBytesRead] == 128 )
{
paramDesValue = iStrPool.StringF(WSPStdConstants::EAny, WSPStdConstants::Table);
paramValue.SetStrF(paramDesValue);
// Need to call Integer to update offset in WSP Decoder
TUint8 updateDecoder = 0;
err = aDecoder.Val7Bit(updateDecoder);
User::LeaveIfError(err);
aBytesRead += err;
}
else
{
switch( aDecoder.VarType() )
{
case TWspPrimitiveDecoder::E7BitVal:
case TWspPrimitiveDecoder::ELengthVal:
{
TUint32 value = 0;
err = aDecoder.Integer(value);
User::LeaveIfError(err);
aBytesRead += err;
GetCharacterSetFromValueL(value, paramDesValue);
paramValue.SetStrF(paramDesValue);
} break;
default:
User::Leave(KErrCorrupt);
break;
}
}
} break;
case WSPParam::ELevel:
{
// This is a version value
err = aDecoder.VersionL(iStrPool,paramDesValue);
User::LeaveIfError(err);
aBytesRead += err;
paramValue.SetStrF(paramDesValue);
} break;
case WSPParam::EType:
case WSPParam::ESize:
case WSPParam::EPadding:
case WSPParam::ESEC:
case WSPParam::EMaxAge:
{
TUint32 integerValue = 0;
err = aDecoder.Integer(integerValue);
User::LeaveIfError(err);
aBytesRead += err;
paramValue.SetInt(integerValue);
} break;
case WSPParam::ECreationDate:
//.........这里部分代码省略.........