本文整理汇总了C++中NPT_HttpRequest类的典型用法代码示例。如果您正苦于以下问题:C++ NPT_HttpRequest类的具体用法?C++ NPT_HttpRequest怎么用?C++ NPT_HttpRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NPT_HttpRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: body_stream
/*----------------------------------------------------------------------
| PLT_HttpClient::WaitForResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_HttpClient::WaitForResponse(NPT_InputStreamReference& input_stream,
NPT_HttpRequest& request,
NPT_SocketInfo& info,
NPT_HttpResponse*& response)
{
NPT_COMPILER_UNUSED(info);
// create a buffered stream for this connection stream
NPT_BufferedInputStreamReference buffered_input_stream(new NPT_BufferedInputStream(input_stream));
// parse the response
NPT_CHECK(NPT_HttpResponse::Parse(*buffered_input_stream, response));
// unbuffer the stream
buffered_input_stream->SetBufferSize(0);
// create an entity if one is expected in the response
if (request.GetMethod() == NPT_HTTP_METHOD_GET || request.GetMethod() == NPT_HTTP_METHOD_POST) {
NPT_HttpEntity* response_entity = new NPT_HttpEntity(response->GetHeaders());
// Transfer-Encoding: chunked ?
if (response_entity->GetTransferEncoding() == "chunked") {
NPT_InputStreamReference body_stream(new NPT_HttpChunkedDecoderInputStream(buffered_input_stream));
response_entity->SetInputStream((NPT_InputStreamReference)body_stream);
} else {
response_entity->SetInputStream((NPT_InputStreamReference)buffered_input_stream);
}
response->SetEntity(response_entity);
}
return NPT_SUCCESS;
}
示例2: if
/*----------------------------------------------------------------------
| PLT_HttpHelper::GetDeviceSignature
+---------------------------------------------------------------------*/
PLT_DeviceSignature
PLT_HttpHelper::GetDeviceSignature(const NPT_HttpRequest& request)
{
const NPT_String* agent = request.GetHeaders().GetHeaderValue(NPT_HTTP_HEADER_USER_AGENT);
const NPT_String* hdr = request.GetHeaders().GetHeaderValue("X-AV-Client-Info");
const NPT_String* server = request.GetHeaders().GetHeaderValue(NPT_HTTP_HEADER_SERVER);
if ((agent && (agent->Find("XBox", 0, true) >= 0 || agent->Find("Xenon", 0, true) >= 0)) ||
(server && server->Find("Xbox", 0, true) >= 0)) {
return PLT_DEVICE_XBOX;
} else if (agent && (agent->Find("Windows Media Player", 0, true) >= 0 || agent->Find("Windows-Media-Player", 0, true) >= 0 || agent->Find("Mozilla/4.0", 0, true) >= 0 || agent->Find("WMFSDK", 0, true) >= 0)) {
return PLT_DEVICE_WMP;
} else if (agent && (agent->Find("Sonos", 0, true) >= 0)) {
return PLT_DEVICE_SONOS;
} else if ((agent && agent->Find("PLAYSTATION 3", 0, true) >= 0) ||
(hdr && hdr->Find("PLAYSTATION 3", 0, true) >= 0)) {
return PLT_DEVICE_PS3;
} else if (agent && agent->Find("Windows", 0, true) >= 0) {
return PLT_DEVICE_WINDOWS;
} else if (agent && (agent->Find("Mac", 0, true) >= 0 || agent->Find("OS X", 0, true) >= 0 || agent->Find("OSX", 0, true) >= 0)) {
return PLT_DEVICE_MAC;
} else {
NPT_LOG_FINE_1("Unknown device signature (ua=%s)", agent?agent->GetChars():"none");
}
return PLT_DEVICE_UNKNOWN;
}
示例3: packet
/*----------------------------------------------------------------------
| PLT_SsdpSender::SendSsdp
+---------------------------------------------------------------------*/
NPT_Result
PLT_SsdpSender::SendSsdp(NPT_HttpRequest& request,
const char* usn,
const char* target,
NPT_UdpSocket& socket,
bool notify,
const NPT_SocketAddress* addr /* = NULL */)
{
NPT_CHECK_SEVERE(FormatPacket(request, usn, target, socket, notify));
// logging
NPT_String prefix = NPT_String::Format("Sending SSDP %s packet for %s",
(const char*)request.GetMethod(),
usn);
PLT_LOG_HTTP_MESSAGE(NPT_LOG_LEVEL_FINER, prefix, &request);
// use a memory stream to write all the data
NPT_MemoryStream stream;
NPT_Result res = request.Emit(stream);
NPT_CHECK(res);
// copy stream into a data packet and send it
NPT_LargeSize size;
stream.GetSize(size);
if (size != (NPT_Size)size) NPT_CHECK(NPT_ERROR_OUT_OF_RANGE);
NPT_DataBuffer packet(stream.GetData(), (NPT_Size)size);
NPT_CHECK_WARNING(socket.Send(packet, addr));
return NPT_SUCCESS;
}
示例4: query
/*----------------------------------------------------------------------
| CMediaCrawler::ProcessFileRequest
+---------------------------------------------------------------------*/
NPT_Result
CMediaCrawler::ProcessFileRequest(NPT_HttpRequest& request,
NPT_HttpResponse& response,
NPT_SocketInfo& info)
{
NPT_COMPILER_UNUSED(info);
NPT_LOG_FINE("CMediaCrawler::ProcessFileRequest Received Request:");
PLT_LOG_HTTP_MESSAGE(NPT_LOG_LEVEL_FINE, &request);
if (request.GetMethod().Compare("GET") && request.GetMethod().Compare("HEAD")) {
response.SetStatus(500, "Internal Server Error");
return NPT_SUCCESS;
}
// add the user agent header, some stupid media servers like YME needs it
if (!request.GetHeaders().GetHeader(NPT_HTTP_HEADER_USER_AGENT)) {
request.GetHeaders().SetHeader(NPT_HTTP_HEADER_USER_AGENT,
"Platinum/" PLT_PLATINUM_VERSION_STRING);
}
// File requested
NPT_HttpResponse* out_response = NULL;
NPT_HttpUrlQuery query(request.GetUrl().GetQuery());
const char* url = query.GetField("url");
if (url) {
// look for handler
CStreamHandler* handler = NULL;
NPT_ContainerFind(m_StreamHandlers, CStreamHandlerFinder(NULL, url), handler);
if (handler && NPT_SUCCEEDED(handler->ProcessFileRequest(request, out_response)) && out_response) {
// copy response code and reason
response.SetStatus(out_response->GetStatusCode(), out_response->GetReasonPhrase());
// copy headers
NPT_List<NPT_HttpHeader*>::Iterator headers = out_response->GetHeaders().GetHeaders().GetFirstItem();
while (headers) {
response.GetHeaders().SetHeader((*headers)->GetName(), (*headers)->GetValue());
++headers;
}
response.SetEntity(new NPT_HttpEntity(response.GetHeaders()));
// update inputstream
NPT_HttpEntity* out_entity;
if ((out_entity = out_response->GetEntity()) != NULL) {
NPT_InputStreamReference inputstream;
out_entity->GetInputStream(inputstream);
if (!inputstream.IsNull()) {
// set the stream but do not update the content length
response.GetEntity()->SetInputStream(inputstream, false);
}
}
delete out_response;
return NPT_SUCCESS;
}
}
response.SetStatus(404, "File Not Found");
return NPT_SUCCESS;
}
示例5: tmp_context
/*----------------------------------------------------------------------
| PLT_HttpServer::ServeFile
+---------------------------------------------------------------------*/
NPT_Result
PLT_HttpServer::ServeFile(const NPT_HttpRequest& request,
const NPT_HttpRequestContext& context,
NPT_HttpResponse& response,
NPT_String file_path)
{
NPT_InputStreamReference stream;
NPT_File file(file_path);
NPT_FileInfo file_info;
// prevent hackers from accessing files outside of our root
if ((file_path.Find("/..") >= 0) || (file_path.Find("\\..") >= 0) ||
NPT_FAILED(NPT_File::GetInfo(file_path, &file_info))) {
return NPT_ERROR_NO_SUCH_ITEM;
}
// check for range requests
const NPT_String* range_spec = request.GetHeaders().GetHeaderValue(NPT_HTTP_HEADER_RANGE);
// handle potential 304 only if range header not set
NPT_DateTime date;
NPT_TimeStamp timestamp;
if (NPT_SUCCEEDED(PLT_UPnPMessageHelper::GetIfModifiedSince((NPT_HttpMessage&)request, date)) &&
!range_spec) {
date.ToTimeStamp(timestamp);
NPT_LOG_INFO_5("File %s timestamps: request=%d (%s) vs file=%d (%s)",
(const char*)request.GetUrl().GetPath(),
(NPT_UInt32)timestamp.ToSeconds(),
(const char*)date.ToString(),
(NPT_UInt32)file_info.m_ModificationTime,
(const char*)NPT_DateTime(file_info.m_ModificationTime).ToString());
if (timestamp >= file_info.m_ModificationTime) {
// it's a match
NPT_LOG_FINE_1("Returning 304 for %s", request.GetUrl().GetPath().GetChars());
response.SetStatus(304, "Not Modified", NPT_HTTP_PROTOCOL_1_1);
return NPT_SUCCESS;
}
}
// open file
if (NPT_FAILED(file.Open(NPT_FILE_OPEN_MODE_READ)) ||
NPT_FAILED(file.GetInputStream(stream)) ||
stream.IsNull()) {
return NPT_ERROR_NO_SUCH_ITEM;
}
// set Last-Modified and Cache-Control headers
if (file_info.m_ModificationTime) {
NPT_DateTime last_modified = NPT_DateTime(file_info.m_ModificationTime);
response.GetHeaders().SetHeader("Last-Modified", last_modified.ToString(NPT_DateTime::FORMAT_RFC_1123), true);
response.GetHeaders().SetHeader("Cache-Control", "max-age=0,must-revalidate", true);
//response.GetHeaders().SetHeader("Cache-Control", "max-age=1800", true);
}
PLT_HttpRequestContext tmp_context(request, context);
return ServeStream(request, context, response, stream, PLT_MimeType::GetMimeType(file_path, &tmp_context));
}
示例6: NPT_CHECK_LABEL_SEVERE
/*----------------------------------------------------------------------
| PLT_HttpServerSocketTask::DoRun
+---------------------------------------------------------------------*/
void
PLT_HttpServerSocketTask::DoRun()
{
NPT_BufferedInputStreamReference buffered_input_stream;
NPT_HttpRequestContext context;
NPT_Result res = NPT_SUCCESS;
bool headers_only;
bool keep_alive = false;
// create a buffered input stream to parse HTTP request
NPT_InputStreamReference input_stream;
NPT_CHECK_LABEL_SEVERE(GetInputStream(input_stream), done);
NPT_CHECK_POINTER_LABEL_FATAL(input_stream.AsPointer(), done);
buffered_input_stream = new NPT_BufferedInputStream(input_stream);
while (!IsAborting(0)) {
NPT_HttpRequest* request = NULL;
NPT_HttpResponse* response = NULL;
// reset keep-alive to exit task on read failure
keep_alive = false;
// wait for a request
res = Read(buffered_input_stream, request, &context);
if (NPT_FAILED(res) || (request == NULL))
goto cleanup;
// process request and setup response
res = RespondToClient(*request, context, response);
if (NPT_FAILED(res) || (response == NULL))
goto cleanup;
// check if client requested keep-alive
keep_alive = PLT_HttpHelper::IsConnectionKeepAlive(*request);
headers_only = request->GetMethod() == NPT_HTTP_METHOD_HEAD;
// send response, pass keep-alive request from client
// (it can be overridden if response handler did not allow it)
res = Write(response, keep_alive, headers_only);
// on write error, reset keep_alive so we can close this connection
if (NPT_FAILED(res)) keep_alive = false;
cleanup:
// cleanup
delete request;
delete response;
if (!keep_alive && !m_StayAliveForever) {
return;
}
}
done:
return;
}
示例7: query
/*----------------------------------------------------------------------
| PLT_FileMediaServer::ProcessFileRequest
+---------------------------------------------------------------------*/
NPT_Result
PLT_FileMediaServer::ProcessFileRequest(NPT_HttpRequest& request,
NPT_HttpResponse& response,
NPT_SocketInfo& client_info)
{
NPT_COMPILER_UNUSED(client_info);
NPT_LOG_FINE("PLT_FileMediaServer::ProcessFileRequest Received Request:");
PLT_LOG_HTTP_MESSAGE(NPT_LOG_LEVEL_FINE, &request);
response.GetHeaders().SetHeader("Accept-Ranges", "bytes");
if (request.GetMethod().Compare("GET") && request.GetMethod().Compare("HEAD")) {
response.SetStatus(500, "Internal Server Error");
return NPT_SUCCESS;
}
// File requested
NPT_String path = m_FileBaseUri.GetPath();
NPT_String strUri = NPT_Uri::PercentDecode(request.GetUrl().GetPath());
NPT_HttpUrlQuery query(request.GetUrl().GetQuery());
NPT_String file_path = query.GetField("path");
// hack for XBMC support for 360, we urlencoded the ? to that the 360 doesn't strip out the query
// but then the query ends being parsed as part of the path
int index = strUri.Find("path=");
if (index>0) file_path = strUri.Right(strUri.GetLength()-index-5);
if (file_path.GetLength() == 0) goto failure;
// HACK for wmp: somehow they inverse our slashes !
// do it only if we're on windows
if (m_DirDelimiter == "\\") {
file_path.Replace('/', '\\');
}
if (path.Compare(strUri.Left(path.GetLength()), true) == 0) {
NPT_Integer start, end;
PLT_HttpHelper::GetRange(&request, start, end);
return PLT_FileServer::ServeFile(m_Path + file_path, &response, start, end, !request.GetMethod().Compare("HEAD"));
}
// Album Art requested
path = m_AlbumArtBaseUri.GetPath();
if (path.Compare(strUri.Left(path.GetLength()), true) == 0) {
return OnAlbumArtRequest(m_Path + file_path, response);
}
failure:
response.SetStatus(404, "File Not Found");
return NPT_SUCCESS;
}
示例8: if
/*----------------------------------------------------------------------
| PLT_MediaConnect::ProcessGetDescription
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaConnect::ProcessGetDescription(NPT_HttpRequest& request,
const NPT_HttpRequestContext& context,
NPT_HttpResponse& response)
{
NPT_String m_OldModelName = m_ModelName;
NPT_String m_OldModelNumber = m_ModelNumber;
NPT_String m_OldModelURL = m_ModelURL;
NPT_String m_OldManufacturerURL = m_ManufacturerURL;
NPT_String m_OldDlnaDoc = m_DlnaDoc;
NPT_String m_OldDlnaCap = m_DlnaCap;
NPT_String m_OldAggregationFlags = m_AggregationFlags;
// change some things based on User-Agent header
NPT_HttpHeader* user_agent = request.GetHeaders().GetHeader(NPT_HTTP_HEADER_USER_AGENT);
if (user_agent && user_agent->GetValue().Find("Xbox", 0, true)>=0) {
m_ModelName = "Windows Media Connect";
m_ModelNumber = "2.0";
m_ModelURL = "http://www.microsoft.com/";
m_ManufacturerURL = "http://www.microsoft.com/";
m_DlnaDoc = "";
m_DlnaCap = "";
m_AggregationFlags = "";
if (m_FriendlyName.Find(":") == -1)
m_FriendlyName += ": 1";
if (!m_FriendlyName.EndsWith(": Windows Media Connect"))
m_FriendlyName += ": Windows Media Connect";
} else if (user_agent && user_agent->GetValue().Find("Sonos", 0, true)>=0) {
m_ModelName = "Windows Media Player Sharing";
m_ModelNumber = "3.0";
}
// PS3
NPT_HttpHeader* client_info = request.GetHeaders().GetHeader("X-AV-Client-Info");
if (client_info && client_info->GetValue().Find("PLAYSTATION 3", 0, true)>=0) {
m_DlnaDoc = "DMS-1.50";
m_DlnaCap = "av-upload,image-upload,audio-upload";
m_AggregationFlags = "10";
}
NPT_Result res = PLT_FileMediaServer::ProcessGetDescription(request, context, response);
// reset to old values now
m_ModelName = m_OldModelName;
m_ModelNumber = m_OldModelNumber;
m_ModelURL = m_OldModelURL;
m_ManufacturerURL = m_OldManufacturerURL;
m_DlnaDoc = m_OldDlnaDoc;
m_DlnaCap = m_OldDlnaCap;
m_AggregationFlags = m_OldAggregationFlags;
return res;
}
示例9: query
/*----------------------------------------------------------------------
| CUPnPRenderer::ProcessHttpRequest
+---------------------------------------------------------------------*/
NPT_Result
CUPnPRenderer::ProcessHttpGetRequest(NPT_HttpRequest& request,
const NPT_HttpRequestContext& context,
NPT_HttpResponse& response)
{
// get the address of who sent us some data back
NPT_String ip_address = context.GetRemoteAddress().GetIpAddress().ToString();
NPT_String method = request.GetMethod();
NPT_String protocol = request.GetProtocol();
NPT_HttpUrl url = request.GetUrl();
if (url.GetPath() == "/thumb") {
NPT_HttpUrlQuery query(url.GetQuery());
NPT_String filepath = query.GetField("path");
if (!filepath.IsEmpty()) {
NPT_HttpEntity* entity = response.GetEntity();
if (entity == NULL) return NPT_ERROR_INVALID_STATE;
// check the method
if (request.GetMethod() != NPT_HTTP_METHOD_GET &&
request.GetMethod() != NPT_HTTP_METHOD_HEAD) {
response.SetStatus(405, "Method Not Allowed");
return NPT_SUCCESS;
}
// prevent hackers from accessing files outside of our root
if ((filepath.Find("/..") >= 0) || (filepath.Find("\\..") >=0)) {
return NPT_FAILURE;
}
#if 1
std::string path;
//url
#else
// open the file
CStdString path = CURL::Decode((const char*) filepath);
#endif
NPT_File file(path.c_str());
NPT_Result result = file.Open(NPT_FILE_OPEN_MODE_READ);
if (NPT_FAILED(result)) {
response.SetStatus(404, "Not Found");
return NPT_SUCCESS;
}
NPT_InputStreamReference stream;
file.GetInputStream(stream);
entity->SetContentType(GetMimeType(filepath));
entity->SetInputStream(stream, true);
return NPT_SUCCESS;
}
}
return PLT_MediaRenderer::ProcessHttpGetRequest(request, context, response);
}
示例10: address
/*----------------------------------------------------------------------
| PLT_HttpClient::Connect
+---------------------------------------------------------------------*/
NPT_Result
PLT_HttpClient::Connect(NPT_Socket* connection, NPT_HttpRequest& request, NPT_Timeout timeout)
{
// get the address of the server
NPT_IpAddress server_address;
NPT_CHECK_SEVERE(server_address.ResolveName(request.GetUrl().GetHost(), timeout));
NPT_SocketAddress address(server_address, request.GetUrl().GetPort());
// connect to the server
NPT_LOG_FINER_2("Connecting to %s:%d\n", (const char*)request.GetUrl().GetHost(), request.GetUrl().GetPort());
NPT_CHECK_SEVERE(connection->Connect(address, timeout));
return NPT_SUCCESS;
}
示例11: sscanf
/*----------------------------------------------------------------------
| PLT_HttpHelper::GetRange
+---------------------------------------------------------------------*/
NPT_Result
PLT_HttpHelper::GetRange(const NPT_HttpRequest& request,
NPT_Position& start,
NPT_Position& end)
{
start = (NPT_Position)-1;
end = (NPT_Position)-1;
const NPT_String* range =
request.GetHeaders().GetHeaderValue(NPT_HTTP_HEADER_RANGE);
NPT_CHECK_POINTER(range);
char s[32], e[32];
s[0] = '\0';
e[0] = '\0';
int ret = sscanf(*range, "bytes=%31[^-]-%31s", s, e);
if (ret < 1) {
return NPT_FAILURE;
}
if (s[0] != '\0') {
NPT_ParseInteger64(s, start);
}
if (e[0] != '\0') {
NPT_ParseInteger64(e, end);
}
return NPT_SUCCESS;
}
示例12: packet
/*----------------------------------------------------------------------
| PLT_SsdpSender::SendSsdp
+---------------------------------------------------------------------*/
NPT_Result
PLT_SsdpSender::SendSsdp(NPT_HttpRequest& request,
const char* usn,
const char* target,
NPT_UdpSocket& socket,
bool notify,
const NPT_SocketAddress* addr /* = NULL */)
{
NPT_CHECK_SEVERE(FormatPacket(request, usn, target, socket, notify));
// logging
NPT_LOG_FINE("Sending SSDP:");
PLT_LOG_HTTP_MESSAGE(NPT_LOG_LEVEL_FINE, &request);
// use a memory stream to write all the data
NPT_MemoryStream stream;
NPT_Result res = request.Emit(stream);
if (NPT_FAILED(res)) return res;
// copy stream into a data packet and send it
NPT_LargeSize size;
stream.GetSize(size);
if (size != (NPT_Size)size) return NPT_ERROR_OUT_OF_RANGE;
NPT_DataBuffer packet(stream.GetData(), (NPT_Size)size);
return socket.Send(packet, addr);
}
示例13: stream
/*----------------------------------------------------------------------
| PLT_HttpHelper::ToLog
+---------------------------------------------------------------------*/
NPT_Result
PLT_HttpHelper::ToLog(NPT_LoggerReference logger,
int level,
const NPT_HttpRequest& request)
{
NPT_COMPILER_UNUSED(logger);
NPT_COMPILER_UNUSED(level);
NPT_StringOutputStreamReference stream(new NPT_StringOutputStream);
NPT_OutputStreamReference output = stream;
request.GetHeaders().GetHeaders().Apply(NPT_HttpHeaderPrinter(output));
NPT_LOG_L4(logger, level, "\n%s %s %s\n%s",
(const char*)request.GetMethod(),
(const char*)request.GetUrl().ToRequestString(true),
(const char*)request.GetProtocol(),
(const char*)stream->GetString());
return NPT_SUCCESS;
}
示例14:
/*----------------------------------------------------------------------
| PLT_HttpHelper::SetBasicAuthorization
+---------------------------------------------------------------------*/
void
PLT_HttpHelper::SetBasicAuthorization(NPT_HttpRequest& request,
const char* username,
const char* password)
{
NPT_String encoded;
NPT_String cred = NPT_String(username) + ":" + password;
NPT_Base64::Encode((const NPT_Byte *)cred.GetChars(), cred.GetLength(), encoded);
request.GetHeaders().SetHeader(NPT_HTTP_HEADER_AUTHORIZATION, NPT_String("Basic " + encoded));
}
示例15:
/*----------------------------------------------------------------------
| NPT_HttpLoggerConfigurator::SetupResponse
+---------------------------------------------------------------------*/
NPT_Result
NPT_HttpLoggerConfigurator::SetupResponse(NPT_HttpRequest& request,
const NPT_HttpRequestContext& /*context*/,
NPT_HttpResponse& response)
{
// we only support GET here
if (request.GetMethod() != NPT_HTTP_METHOD_GET) return NPT_ERROR_HTTP_METHOD_NOT_SUPPORTED;
// construct the response message
NPT_String msg;
msg = "<ul>";
NPT_List<NPT_LogConfigEntry>& config = LogManager.GetConfig();
NPT_List<NPT_LogConfigEntry>::Iterator cit = config.GetFirstItem();
for (; cit; ++cit) {
NPT_LogConfigEntry& entry = (*cit);
msg += "<li>";
msg += entry.m_Key;
msg += "=";
msg += entry.m_Value;
msg += "</li>";
}
msg += "</ul>";
msg += "<ul>";
NPT_List<NPT_Logger*>& loggers = LogManager.GetLoggers();
NPT_List<NPT_Logger*>::Iterator lit = loggers.GetFirstItem();
for (;lit;++lit) {
NPT_Logger* logger = (*lit);
msg += "<li>";
msg += logger->GetName();
msg += ", level=";
msg += NPT_String::FromInteger(logger->GetLevel());
NPT_List<NPT_LogHandler*>& handlers = logger->GetHandlers();
NPT_List<NPT_LogHandler*>::Iterator hit = handlers.GetFirstItem();
msg += ", handlers=";
for (;hit;++hit) {
NPT_LogHandler* handler = (*hit);
msg += handler->ToString();
}
msg += "</li>";
}
msg += "</ul>";
// setup the response body
NPT_HttpEntity* entity = response.GetEntity();
entity->SetContentType("text/html");
entity->SetInputStream(msg);
return NPT_SUCCESS;
}