Commit 701ace8e authored by Jan Köster's avatar Jan Köster
Browse files

test

parent e53e100a
Loading
Loading
Loading
Loading
+54 −1
Changes for src/blogi.cpp: 54 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2476,11 +2476,15 @@ RETRY_REQUEST:
        try{
            /*blogi internal pages and redirections*/
            if(curreq.getRequestURL().compare("/")==0 || curreq.getRequestURL().compare(ctx->prefix)==0){
                const std::string reqUrl = curreq.getRequestURL();
                const std::string target = ctx->startPage.empty() ? std::string("/") : ctx->startPage;
                if(target != reqUrl){
                    curres.setState(HTTP307);
                curres.setHeaderData("location")->push_back(ctx->startPage);
                    curres.setHeaderData("location")->push_back(target);
                    curres.setContentType("text/html");
                    curres.send(curreq,"", 0);
                    return;
                }
            }else if(curreq.getRequestURL().compare(0,ctx->buildurl("api").length(),ctx->buildurl("api"))==0){
                api(curreq,tid,*ctx);
                return;
@@ -2744,7 +2748,56 @@ RETRY_REQUEST:
        resp.setState(HTTP500);
        resp.setContentType("text/html");
        sendCompressed(curreq,resp,output.c_str(),output.length());
    }catch(const netplus::NetException &e){
        std::cerr << "RequestEvent netplus::NetException: " << e.what() << std::endl;
        libhtmlpp::HtmlString output;
        libhtmlpp::HtmlString err;
        std::string hreason;
        libhtmlpp::HtmlEncode(e.what(), hreason);
        err << "<!DOCTYPE html><html><body style=\"color:rgb(238, 238, 238); background:rgb(35, 38, 39);\"><span>"
            << hreason
            << "</span><br/><a style=\"text-decoration: none; color: rgb(58,212, 58);\" href=\""
            <<  ctx->startPage
            << "\" >Zur&uuml;ck zur Startseite</a></body></html>";
        libhtmlpp::print(err.parse(), output);
        libhttppp::HttpResponse resp;
        resp.setState(HTTP500);
        resp.setContentType("text/html");
        sendCompressed(curreq, resp, output.c_str(), output.length());
    }catch(const std::exception &e){
        std::cerr << "RequestEvent std::exception: " << e.what() << std::endl;
        libhtmlpp::HtmlString output;
        libhtmlpp::HtmlString err;
        std::string hreason;
        libhtmlpp::HtmlEncode(e.what(), hreason);
        err << "<!DOCTYPE html><html><body style=\"color:rgb(238, 238, 238); background:rgb(35, 38, 39);\"><span>"
            << hreason
            << "</span><br/><a style=\"text-decoration: none; color: rgb(58,212, 58);\" href=\""
            <<  ctx->startPage
            << "\" >Zur&uuml;ck zur Startseite</a></body></html>";
        libhtmlpp::print(err.parse(), output);
        libhttppp::HttpResponse resp;
        resp.setState(HTTP500);
        resp.setContentType("text/html");
        sendCompressed(curreq, resp, output.c_str(), output.length());
    }catch(const char *e){
        std::cerr << "RequestEvent std::exception: " << e << std::endl;
        libhtmlpp::HtmlString output;
        libhtmlpp::HtmlString err;
        std::string hreason;
        libhtmlpp::HtmlEncode(e, hreason);
        err << "<!DOCTYPE html><html><body style=\"color:rgb(238, 238, 238); background:rgb(35, 38, 39);\"><span>"
            << hreason
            << "</span><br/><a style=\"text-decoration: none; color: rgb(58,212, 58);\" href=\""
            <<  ctx->startPage
            << "\" >Zur&uuml;ck zur Startseite</a></body></html>";
        libhtmlpp::print(err.parse(), output);
        libhttppp::HttpResponse resp;
        resp.setState(HTTP500);
        resp.setContentType("text/html");
        sendCompressed(curreq, resp, output.c_str(), output.length());
    }catch(...){
        std::cerr << "RequestEvent unknown exception" << std::endl;
        libhtmlpp::HtmlString output;
        libhtmlpp::HtmlString err;
        err << "<!DOCTYPE html><html><body style=\"color:rgb(238, 238, 238); background:rgb(35, 38, 39);\"><span>"