[Cppcms-users] request of json/rpc compression
Brought to you by:
artyom-beilis
|
From: Juergen G. <jue...@gm...> - 2012-04-02 09:40:55
|
Hi,
Is it possible to enable the compression of json/rpc calls. I've changed
the function bool::response::need_gzip() and added the protocal
"application/json" at the file http_response.cpp. Here is the full function:
bool response::need_gzip()
{
#ifndef CPPCMS_NO_GZIP
if(disable_compression_ == 1)
return false;
if(io_mode_!=normal)
return false;
if(context_.service().cached_settings().gzip.enable==false)
return false;
if(strstr(context_.request().cgetenv("HTTP_ACCEPT_ENCODING"),"gzip")==0)
return false;
std::string l_help=get_header("Content-Encoding");
if(!l_help.empty())
// User had defined its own content encoding
// he may compress data on its own... disable compression
return false;
std::string const content_type=get_header("Content-Type");
if(protocol::is_prefix_of("text/",content_type))
return true;
if(protocol::is_prefix_of("application/json",content_type))
return true;
return false;
#else
return false;
#endif
}
Thanks
Jürgen Gleiss
|