本文整理汇总了C++中THttpResponseHeader::setContentLength方法的典型用法代码示例。如果您正苦于以下问题:C++ THttpResponseHeader::setContentLength方法的具体用法?C++ THttpResponseHeader::setContentLength怎么用?C++ THttpResponseHeader::setContentLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THttpResponseHeader
的用法示例。
在下文中一共展示了THttpResponseHeader::setContentLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeResponse
qint64 TActionContext::writeResponse(THttpResponseHeader &header, QIODevice *body, qint64 length)
{
T_TRACEFUNC("length:%s", qPrintable(QString::number(length)));
header.setContentLength(length);
header.setRawHeader("Server", "TreeFrog server");
header.setCurrentDate();
// Write data
return writeResponse(header, body);
}
示例2: writeResponse
qint64 TActionContext::writeResponse(THttpResponseHeader& header, QIODevice *body, qint64 length)
{
T_TRACEFUNC("length:%s", qPrintable(QString::number(length)));
qint64 res = -1;
if (httpSocket) {
header.setContentLength(length);
header.setRawHeader("Server", "TreeFrog server");
header.setRawHeader("Date", QLocale::c().toString(QDateTime::currentDateTime().toUTC(),
QLatin1String("ddd, dd MMM yyyy hh:mm:ss 'GMT'")).toLatin1());
header.setRawHeader("Connection", "close");
res = httpSocket->write(static_cast<THttpHeader*>(&header), body);
}
return res;
}
示例3: writeResponse
qint64 TActionContext::writeResponse(THttpResponseHeader &header, QIODevice *body, qint64 length)
{
T_TRACEFUNC("length:%s", qPrintable(QString::number(length)));
header.setContentLength(length);
header.setRawHeader("Server", "TreeFrog server");
# if QT_VERSION >= 0x040700
QDateTime utc = QDateTime::currentDateTimeUtc();
#else
QDateTime utc = QDateTime::currentDateTime().toUTC();
#endif
header.setRawHeader("Date", QLocale(QLocale::C).toString(utc, QLatin1String("ddd, dd MMM yyyy hh:mm:ss 'GMT'")).toLatin1());
// Write data
return writeResponse(header, body);
}