×
Namespaces

Variants
Actions

HTTP回应中的内容部署标头无法正确接收

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

兼容于
平台: S60 5th Edition
S60 5th Edition

文章
翻译:
hoolee
最后由 hamishwillee 在 07 Aug 2012 编辑
  • 详细描述

当我们下载附件时,附件的名称可以通过HTTP回应中的HTTP::EContentDispostion来获得。但是在S60第五版手机上,这个头却无法正确读到,只能获取部分字符串。

  • 如何重演

SDK中的WebClient应用程序可以用来下载附件,下列代码在获得HTTP回应时可以获得EContentDisposition头

void CWebClientEngine::MHFRunL( RHTTPTransaction aTransaction, 
const THTTPEvent& aEvent )
{
switch ( aEvent.iStatus )
{
case THTTPEvent::EGotResponseHeaders:
{
RHTTPResponse resp = aTransaction.Response();<br>
RHTTPHeaders hdr = resp.GetHeaderCollection();
RStringPool strP = iSession.StringPool();
RStringF contentDisp = strP.StringF(HTTP::EContentDisposition, RHTTPSession::GetTable());<br>
THTTPHdrVal tempHdrVal;
TInt err = headers.GetField(contentDisp, 0, tempHdrVal);
if (err == KErrNone)
{
RStringF field = tempHdrVal.StrF();
const TDesC8& fieldValDesC = field.DesC(); //the buffer fieldValDesC<br>
 
//doesn't contain the entire header information
field.Close();
}
contentDisp.Close();
}
break;

期待的结果: 上列代码中的描述符fieldValDesC,包含了整个头信息,包括附件名称。

实际结果: fieldValDesC描述符只包含了部分信息,并不包含附件名称。

  • 解决方案

暂无解决方案

This page was last modified on 7 August 2012, at 03:16.
104 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×