WEB开发网
开发学院手机开发Symbian 开发 Symbian (Http DownLoad) Http 引擎下载实现 阅读

Symbian (Http DownLoad) Http 引擎下载实现

 2010-02-08 03:06:00 来源:WEB开发网   
核心提示:RStringF iPrxAddr = iSession.StringPool().OpenFStringL(aProxy8);CleanupClosePushL(iPrxAddr);THTTPHdrVal iPrxUsage(iSession.StringPool().StringF(HTTP::EUseProxy,

RStringF iPrxAddr = iSession.StringPool().OpenFStringL(aProxy8);

CleanupClosePushL(iPrxAddr);

THTTPHdrVal iPrxUsage(iSession.StringPool().StringF

(HTTP::EUseProxy,RHTTPSession::GetTable()));

iSession.ConnectionInfo().SetPropertyL(iSession.StringPool().StringF

(HTTP::EProxyUsage,RHTTPSession::GetTable()), iPrxUsage);

iSession.ConnectionInfo().SetPropertyL(iSession.StringPool().StringF

(HTTP::EProxyAddress,RHTTPSession::GetTable()), iPrxAddr);

CleanupStack::PopAndDestroy();

}

#endif

// Get request method string for HTTP GET

RStringF method = iSession.StringPool().StringF(HTTP::EGET,

RHTTPSession::GetTable());

// Open transaction with previous method and parsed uri. This class will

// receive transaction events in MHFRunL and MHFRunError.

iTransaction = iSession.OpenTransactionL(uri, *this, method);

// Set headers for request; user agent and accepted content type

RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();

SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);//设置UA

SetHeaderL(hdr, HTTP::EAccept, KAccept);//设置accept

//设置代码续传

TBuf8<64> sizeStr;

sizeStr.Format (_L8("bytes=%d-"),iDownloadSize);

sizeStr.AppendFormat (_L8("%d"),curSizeL);

SetHeaderL (hdr, HTTP::ERange, sizeStr);

// Submit the transaction. After this the framework will give transaction

// events via MHFRunL and MHFRunError.

iTransaction.SubmitL();//启动请求.请法度是一个异步的过程.

//请求完成后,会在MHTTPTransactionCallback方法回调相关的事件.

iRunning = ETrue;

}

//POST 请求

void CWebClientEngine::HTTPPostL(const TDesC8& aUri, const TDesC8& aBody)

{

iDownloadSize = 0;

上一页  1 2 3 4 5  下一页

Tags:Symbian Http DownLoad

编辑录入:coldstar [复制链接] [打 印]
赞助商链接