Commit 00c700d1 authored by jan.koester's avatar jan.koester
Browse files

fixe cookie

parent 9de8495f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -36,8 +36,8 @@

blogi::RedisStore::RedisStore(const char *host,int port,const char *password,int timeout,int threads){
    _Threads=threads;
    _RedisCTX=new struct redisContext*[_Threads+1];
    for(int i = 0; i<=_Threads; ++i){
    _RedisCTX=new struct redisContext*[_Threads];
    for(int i = 0; i<_Threads; ++i){

        struct timeval tv={0,timeout};

+8 −4
Original line number Diff line number Diff line
@@ -60,8 +60,8 @@ blogi::Blogi::Blogi(Config *blgcfg,netplus::socket *serversocket) : HttpEvent(se
    PlgArgs = new PluginArgs;
    PlgArgs->config=blgcfg;

    PlgArgs->database=new Database*[threads+1];
    for(int i=0; i<=threads; ++i){
    PlgArgs->database=new Database*[threads];
    for(int i=0; i<threads; ++i){
        if(strcmp(PlgArgs->config->getdbdriver(),"pgsql")==0)
            PlgArgs->database[i]= new Postgresql(PlgArgs->config->getdbopts());
        else if(strcmp(PlgArgs->config->getdbdriver(),"sqlite")==0)
@@ -96,7 +96,10 @@ blogi::Blogi::~Blogi(){
    delete PlgArgs->edit;
    delete PlgArgs->auth;
    delete PlgArgs->session;
    delete PlgArgs->database;
     for(int i=0; i<threads; ++i){
        delete PlgArgs->database[i];
    }
    delete[] PlgArgs->database;
    delete BlogiPlg;
    delete PlgArgs;
    delete Page;
@@ -174,7 +177,8 @@ void blogi::Blogi::loginPage(libhttppp::HttpRequest *curreq,const int tid){
        PlgArgs->session->addSessionData(sessid,"username",username.c_str(), username.length());
        libhttppp::HttpResponse curres;
        libhttppp::HttpCookie cookie;
        cookie.setcookie(&curres, "sessionid", sessid);
        cookie.setcookie(&curres, "sessionid", sessid,nullptr,PlgArgs->config->getDomain(),-1,
                         PlgArgs->config->buildurl("",url,512),false,"1","Lax");
        curres.setState(HTTP307);
        curres.setVersion(HTTPVERSION(1.1));
        *curres.setData("Location") << PlgArgs->config->getstartpage();
+8 −0
Original line number Diff line number Diff line
@@ -104,6 +104,9 @@ blogi::Config::Config(const char *path) : confplus::Config(path){
            _SSLKeypath=getValue(getKey("/BLOGI/HTTP/SSLKEYPATH"),0);
    }catch(...){
    }

    if(getKey("/BLOGI/DOMAIN/NAME"))
        _Domain=getValue(getKey("/BLOGI/DOMAIN/NAME"),0);
}

blogi::Config::~Config(){
@@ -232,3 +235,8 @@ const char * blogi::Config::getsslkeypath(){
    return _SSLKeypath.c_str();
}

const char * blogi::Config::getDomain(){
    if(_Domain.empty())
        return nullptr;
    return _Domain.c_str();
}
+4 −0
Original line number Diff line number Diff line
@@ -71,6 +71,9 @@ namespace blogi {

        const char *getsslcertpath();
        const char *getsslkeypath();

        const char *getDomain();

    private:
        std::vector<std::string>  _PlgDir;
        std::string               _DBDriver;
@@ -93,5 +96,6 @@ namespace blogi {
        std::string               _StartPage;
        std::string               _SSLCertpath;
        std::string               _SSLKeypath;
        std::string               _Domain;
    };
};