Re: [Cppcms-users] request of json/rpc compression
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2012-04-02 09:47:16
|
I'd suggest: Add some regular expression to configration file that would control the gzip compression and use it instead of hard-coded values. Of course it should be optional and it should go to: http://cppcms.com/wikipp/en/page/cppcms_1x_config#gzip Good idea, **patches are welcome** Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Juergen Gleiss <jue...@gm...> >To: cpp...@li... >Sent: Monday, April 2, 2012 12:40 PM >Subject: [Cppcms-users] request of json/rpc compression > > >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 > > >------------------------------------------------------------------------------ >This SF email is sponsosred by: >Try Windows Azure free for 90 days Click Here >http://p.sf.net/sfu/sfd2d-msazure >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |