Commit 6226a7ce authored by jan.koester's avatar jan.koester
Browse files

compression reactivated

parent d0953e05
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ namespace blogi {

            libhtmlpp::HtmlString condat,sysicohtml;

            sysicohtml << "<img alt=\"sysico\" src=\"" << Args->config->buildurl("nodeinfo/sysico.png",url,512) << "\" />";
            sysicohtml << "<img alt=\"sysico\" width=\"32px\" height=\"32px\" src=\"" << Args->config->buildurl("nodeinfo/sysico.png",url,512) << "\" />";

            #ifndef Windows
            struct utsname usysinfo;
+15 −2
Original line number Diff line number Diff line
@@ -167,8 +167,21 @@ bool blogi::Theme::Controller(const int tid,libhttppp::HttpRequest *req){
                    resp.setContentType("application/octet-stream");
                }

                if( curfile->Compressed.length() >0 && req->getHeaderData("accept-encoding")
                    && req->getHeaderData("accept-encoding")->at(0).getvalue().find("br")!=std::string::npos ){
                bool compressed = false;

                libhttppp::HttpHeader::HeaderData *acph=req->getHeaderData("accept-encoding");

                if(acph){
                    for(libhttppp::HttpHeader::HeaderData::Values *cdat=acph->getfirstValue();
                        cdat; cdat=cdat->nextvalue()){
                        if(cdat->getvalue().find("br")!=std::string::npos){
                            compressed=true;
                            break;
                        }
                    }
                }

                if( curfile->Compressed.length() >0 && req->getHeaderData("accept-encoding") && compressed ){
                    resp.setHeaderData("content-encoding")->push_back("br");
                    resp.setContentLength(curfile->Compressed.length());
                    resp.send(req,nullptr,-1);