Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Martin Chang
    @marty1885
    You need to install boost
    Yernar Aldabergenov
    @yernar
    Hello everyone! I've just came across this framework and got interested. But, I have spotted that the framework doesn't have security(like in spring) and data validation. How are you guys dealing with it?
    HadiAbbasi
    @HadiAbbasi

    @marty1885

    thanks a lot... @marty1885
    it worked for me...
    Here is the full bash script that I created for drogon easy setup on my ubuntu server...

    just put this script in a path and run the below command on it!
    bash drogon_installer_on_debian_ubuntu.sh install_drogon
    HadiAbbasi
    @HadiAbbasi
    I appreciate you...
    praveenpillay
    @praveenpillay
    Can we enable history mode in dragon?
    Martin Chang
    @marty1885

    Can we enable history mode in dragon?

    You can add a pre-pahdling/sync-advice AOP and rewrite the document path there.

    ciclonite
    @ciclonite
    Hi All! I've installed Drogon locally, but when i try to compile the project this error come up :
    make Error at CMakeLists.txt:43 (find_package):
    Could not find a package configuration file provided by "Drogon" with any
    of the following names:
    DrogonConfig.cmake
    drogon-config.cmake
    But if i search those files :
    sudo find / -name DrogonConfig.cmake
    /usr/local/lib/cmake/Drogon/DrogonConfig.cmake
    Thanks
    cmake -version
    cmake version 3.16.3
    Martin Chang
    @marty1885
    @ciclonite I think your CMake is not configured to search /usr/local/lib/cmake. Try remove it from /usr/local and install drogon to /usr
    ex:
    sudo rm /usr/local/include/drogon /usr/local/lib/libdrogon.a /usr/local/lib/cmake/DrogonConfig.cmake
    # In build directory
    cmake -DCMAKE_INSTALL_PREFIX=/usr/ ../..
    make
    sudo make install
    ciclonite
    @ciclonite
    Hi Martin, thank you for reply, i've tried without success :
    find / -name libdrogon.a
    /home/ciclonite/drogon/build/libdrogon.a
    /usr/lib/libdrogon.a
    Martin Chang
    @marty1885
    Now it can't link?
    ciclonite
    @ciclonite
    Nope, i'm investigating if there is a problem with my cmake
    Martin Chang
    @marty1885
    I think it's just the case that your CMake is not built to search those paths
    praveenpillay
    @praveenpillay
    Do we support flatbuffers in websocket?
    An Tao
    @an-tao
    Not yet, you need to integrate it yourself.
    aliakbarRashidi
    @aliakbarRashidi
    Hello Mr An Tao. more power to your elbow. Has Swagger integration been finished?
    An Tao
    @an-tao
    No, there was a man want to do it, so I didn't focus on it recently.
    Serdar G├╝rer
    @Radresingen
    Hello everyone i have a problem. I am using httpclient of drogon framework and trying to make a http request to a domain, however i get InvalidCertificate as a result. Is there a way to not to check ssl when making a request ?
    Martin Chang
    @marty1885
    @Radresingen When creating the client. Set validateCert to false.
    auto client = HttpClient::newHttpClient(/*host=*/"https://127.0.0.1:8849",
                                                /*eventLoop=*/app().getLoop(),
                                                /*useOldTLS=*/false,
                                                /*validateCert=*/false);
    Martin Chang
    @marty1885
    Let us know if curl or a browser doesn't complain about bad SSL for that endpoint. In that case it can be a bug in our validation code
    Ghasem Ramezani
    @another-ghasem
    Hello everyone, I'm using trantor::Logger for logging and trantor::AsyncFileLogger for logging into file. But trantor::AsyncFileLogger uses a Buffer for some reasons and I need to have control over flushing this buffer from the user-code (the code which uses LOG_INFO, LOG_TRACE, ...) something like std::endl which flushes the stream buffer. I want this for debugging purposes. How could I achieve this?
    An Tao
    @an-tao
    you could use the flush() method of trantor::AsyncFileLogger class to achieve this.
    Ghasem Ramezani
    @another-ghasem

    you could use the flush() method of trantor::AsyncFileLogger class to achieve this.

    How could I call flush() when I'm using the logging macros? (LOG_INFO, LOG_TRACE, ...).

    An Tao
    @an-tao
    use LOG_ERROR or higher level of logs.
    GeorgeDuckman
    @GeorgeDuckman

    Hello everyone, I want to apologize if my question is stupid, I'm new to the web/sql in general, but is it possible to mix the SQL query methods of drogon? Or should we avoid doing so?

    For example making an execSqlSync query inside a callback of an execSqlAsync query?

    I ask this because when I tried, the query inside the callback always got stuck. I spent a good 20 minutes on it before trying to simply change my configuration to allocate more than one connection to the database and poof it worked! Does this mean that within an execSqlAsync callback the connection is not yet closed?

    In that case, should I pass all my queries to execSqlAsyncFuture?

    An Tao
    @an-tao
    you should use the execSqlAsync method in the callback.
    GeorgeDuckman
    @GeorgeDuckman
    Thank you for your reply !
    An Tao
    @an-tao
    U are welcome
    and you could try to use coroutines to avoid the callback hell.
    GeorgeDuckman
    @GeorgeDuckman
    I think I'll definitely do that thanks
    Martin Chang
    @marty1885
    Yeah. Use coroutines when you can.
    Ibroheem
    @ibroheem

    and you could try to use coroutines to avoid the callback hell.

    Disrespecting callback eh.

    HadiAbbasi
    @HadiAbbasi

    hello
    I'm looking for a way to add custom header for specific file!

    I've added <img src="./imgs/img.jpg"> tag in my view csp file and just I wanna addHeader like Cache-Control for that image!
    I thought I can set it by this way but there is no any header in chrome developer-tools->network tab -> selected image headers!
    in csp file:
    <img src = "./imgs/img.jpg" width="100%" height = "100%"/>

    in controller.h:
    PATH_ADD("/imgs/img.jpg",Get,Post);

    in controller.cc
    void ClientPageCtrl::asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback)
    {
    }

    as I know, we can make a new response using newHttpResponse here, but I don't know how I can set my custom header for specific file!
    thanks a lot...
    Best,
    Hadi

    HadiAbbasi
    @HadiAbbasi
    sorry I don't know how to add my codes in code area (code block) in community!
    HadiAbbasi
    @HadiAbbasi

    now I can load my image file & set it to response body and set-header is successful!

    include "ClientPageCtrl.h"
    include <fstream>
    include <iostream>
    include <sstream>
    void ClientPageCtrl::asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback)
    {
    auto resp=HttpResponse::newHttpResponse();
    resp->setStatusCode(k200OK);
    resp->setContentTypeCode(CT_IMAGE_JPG);
    resp->addHeader("Cache-Control", "no-cache222");
    std::ifstream inFile;
    inFile.open("/home/CDN/drogon/CDN/build/imgs/img.jpg"); //open the input file
    std::stringstream strStream;
    strStream << inFile.rdbuf(); //read the file
    std::string str = strStream.str(); //str holds the content of the file
    resp->setBody(str);
    callback(resp);
    }

    but is there any filter on response phase to simply set header on file?

    An Tao
    @an-tao
    you could use the newFileResponse method
    3 replies
    Kaung Zaw Htet
    @KaungZawHtet
    When will drogon 2 be launched? So excited to see it
    Martin Chang
    @marty1885
    It's a moving goal right now. The maintainers have limited time and have to work on both projects.
    We have already backported a lot of drogon2's features into drogon (test framework, etc...). So you are not missing out on anything
    zxcvbnm111111
    @zxcvbnm111111:matrix.org
    [m]
    How can I save the file I'm getting from a POST request in Drogon?
    An Tao
    @an-tao
    please search the MultiPartParser in drogon project
    1 reply
    Ibroheem
    @ibroheem

    drogon::nosql::RedisClientPtr drogon::nosql::RedisClientManager::getRedisClient(const string&): Assertion `redisClientsMap_.find(name) != redisClientsMap_.end()

    When trying to use Redis

    Ibroheem
    @ibroheem

    Happens when I try to use:

    drogon::app().createRedisClient("127.0.0.1", 6379); drogon::nosql::RedisClientPtr redisClient = app().getRedisClient();

    But when I use:

    nosql::RedisClientPtr redisClient = nosql::RedisClient::newRedisClient(InetAddress("127.0.0.1", 6379));

    It's OK.

    Martin Chang
    @marty1885
    getRedisClient() only works on Drogon's main event thread and worker thread. (Which is different from the process's main thread
    You'll get that error when calling getRedisClien and getDbClient from non worker threads.