Commit 40d175ff authored by jan.koester's avatar jan.koester
Browse files

speeed

parent d8cf0ffc
Loading
Loading
Loading
Loading
+1 −1
Changes for Dockerfile: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
# images from another registry/namespace -- see DOCKER_PREFIX in systempp/build-chroot.sh.

ARG IMAGE_PREFIX=tuxist/
ARG FENRIROS_TAG=20261103
ARG FENRIROS_TAG=20261107

FROM ${IMAGE_PREFIX}fenriros-devel:${FENRIROS_TAG} AS build

+37 −0
Changes for src/blogi.cpp: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3346,6 +3346,43 @@ void blogi::Blogi::RequestEvent(libhttppp::HttpRequest &curreq, const int tid, U
            return;
        }

        // Fast path for /media/getimage/: an image needs nothing from the
        // generic page pipeline below -- not the session lookup/creation
        // (which INSERTs a fresh session for every cookieless request), not
        // the cookie-banner render, not the deep copy of the template DOM,
        // and above all not every plugin's Rendering() hook (navbar etc. run
        // their DB queries to build a page that's then thrown away). All of
        // that used to run once per image, ~100-250 ms each on lnx.tuxist.de
        // vs. <1 ms for mediadb itself. The media Controller only needs the
        // raw session id (to look up a logged-in user's authdb token) and
        // never touches `page` on this route.
        {
            const std::string giPrefix = ctx->buildurl("media/getimage/");
            if (curreq.getRequestURL().compare(0, giPrefix.length(), giPrefix) == 0)
            {
                std::string giSess;
                try
                {
                    libhttppp::HttpCookie gicookie;
                    gicookie.parse(curreq);
                    for (libhttppp::HttpCookie::CookieData *c = gicookie.getfirstCookieData(); c; c = c->nextCookieData())
                    {
                        if (c->getKey() == "sessionid")
                            giSess = c->getValue();
                    }
                }
                catch (...)
                {
                }
                for (const blogi::Plugin::PluginData *curplg = BlogiPlg->getFirstPlugin(); curplg; curplg = curplg->getNextPlg())
                {
                    PluginApi *api = curplg->getInstace();
                    if (api->getName() == "media" && api->Controller(tid, curreq, nullptr, giSess))
                        return;
                }
            }
        }

        libhttppp::HttpCookie cookie;
        libhttppp::HttpResponse curres;
        std::string sessid;