Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Farook Al-Sammarraie
    @The-EDev
    Update on clang format, I managed to get the bot working, the biggest problem was getting the string escaped, thankfully that's done
    Luca Schlecker
    @luca-schlecker
    @The-EDev, is the .clang-format in master already the one which will be used?
    Farook Al-Sammarraie
    @The-EDev
    no, I prepared a new one based on how Crow was already formatted (plus a few improvements)
    Luca Schlecker
    @luca-schlecker
    I guess reformatting the whole project based on the new format file and committing it all in its own commit is the way to go. I think I formatted the new file in CrowCpp/Crow#278 using the old one, so the format won't be like the other files...
    Farook Al-Sammarraie
    @The-EDev
    That's alright, I plan on formatting all the files with the new format and making a PR
    Farook Al-Sammarraie
    @The-EDev
    @luca-schlecker I'm trying to test your PR by using an example that would require #define CROW_MAIN, unfortunately following CrowCpp/Crow#110 which originally described the problem seems to compile just fine. any ideas?
    Luca Schlecker
    @luca-schlecker
    I don't quite understand. No example would require #define CROW_MAIN with my PR. What exactly are you trying to test? I"ve tested inclusion in multiple source files and I've tested putting the crow include inside a header which itself is included in multiple source files (which basically is the same thirg as the first one) and both worked.
    Farook Al-Sammarraie
    @The-EDev
    I was attempting to do the same tests you've done, I just couldn't get them to fail when compiling with an older version
    basically I was trying to build something that would fail to compile with the current version but work with your changes
    Luca Schlecker
    @luca-schlecker
    Weird, 'cause that was the first thing I tested before even coming up with my solution.
    I'll send you my test project, give me a moment.
    Farook Al-Sammarraie
    @The-EDev
    I appreciate it
    Luca Schlecker
    @luca-schlecker
    // test.hpp
    
    #pragma once
    #include <crow.h>
    #include <string>
    
    inline static void start_crow_server(unsigned int port) {
      crow::SimpleApp app;
      CROW_ROUTE(app, "/")
      ([port]() { return "Hello World " + std::to_string(port); });
      app.port(port).multithreaded().run();
    }
    
    void test();
    // a.cpp
    
    #include <test.hpp>
    #include <thread>
    
    int main(int argc, char** argv) {
      std::thread t([]() { test(); });
      start_crow_server(8002);
      t.join();
      return 0;
    }
    // b.cpp
    
    #include <test.hpp>
    
    void test() {
      start_crow_server(8001);
    }
    This project fails with the old Crow if I put #define CROW_MAIN inside the header (as expected) or leave it out (as expected). Only if I put it in one cpp file and one only it works (as expected).
    The new Crow just works.
    Luca Schlecker
    @luca-schlecker
    @The-EDev Will the CROW_MAIN-less feature land in v0.4? I'd write something like: If you are using a version below v0.4 ...
    Farook Al-Sammarraie
    @The-EDev
    well the way it's being done ATM is as masterrather than a version number (e.g. blueprints.md and routes.md), once a release is made the idea is to change those to the version number. This is because I don't want people to be confused by a v0.4 in the doc when it doesn't actually exist anywhere else
    Luca Schlecker
    @luca-schlecker
    So should I write something like: "If you are using version v0.3 or below ..."
    Farook Al-Sammarraie
    @The-EDev
    actually "If you are using version 0.3" only would suffice since 0.2 did not have CROW_MAIN
    Luca Schlecker
    @luca-schlecker
    Oh, interesting. Ok, then I'll just write "If you are using version v0.3 ..."
    And for the README, should I put it inside the ## Disclaimer region?
    Farook Al-Sammarraie
    @The-EDev
    umm, no, I think above the first example would be best
    Luca Schlecker
    @luca-schlecker
    Updated the PR, what do you think @The-EDev?
    Farook Al-Sammarraie
    @The-EDev
    All good, thanks a lot for all the work
    Luca Schlecker
    @luca-schlecker
    You're welcome, I am happy to help.
    Luca Schlecker
    @luca-schlecker
    @The-EDev By the way, if I wanted to introduce a function inside App that'd return whether or not SSL is being used, it would be callable regardless of SSL being enabled or not, wouldn't it? (Similar to bool compression_used() const)
    Farook Al-Sammarraie
    @The-EDev
    I mean, in order for it to return that SSL isn't being used it would have to operate without it being enabled right?
    Luca Schlecker
    @luca-schlecker
    Also that, but one could enable SSL through CMake but not end up using it, which should then also return false. The variable use_ssl_ already does this, but just like there are stubs for .ssl() and .ssl_file(), there should also be a stub for .ssl_used() const.
    Anyway, I'll fix a bug I've encountered having to do with SSL redirection. If SSL is enabled, but not used, one would still always be redirected to https:// leading to broken webpages (at least for me).
    Farook Al-Sammarraie
    @The-EDev
    That's interesting
    I'm pretty sure Crow doesn't do any redirection
    at least when it comes to SSL, either that or I'm completely forgetting stuff here
    Luca Schlecker
    @luca-schlecker
    There actually is some stuff going on:
    //if there is a redirection with a partial URL, treat the URL as a route.
    std::string location = res.get_header_value("Location");
    if (!location.empty() && location.find("://", 0) == std::string::npos)
    {
    #ifdef CROW_ENABLE_SSL
        location.insert(0, "https://" + req_.get_header_value("Host"));
    #else
        location.insert(0, "http://" + req_.get_header_value("Host"));
    #endif
        res.set_header("location", location);
    }
    Luca Schlecker
    @luca-schlecker
    It has to do with response::redirect and response::redirect_perm.
    Farook Al-Sammarraie
    @The-EDev
    I finally got the clang format script to fully work
    Farook Al-Sammarraie
    @The-EDev
    I just posted about creating a blog for Crow, any ideas / suggestions ?
    legendaryzyper
    @legendaryzyper
    when will crow be available for visual studio 2022?
    Farook Al-Sammarraie
    @The-EDev
    @legendaryzyper did you encounter any problems compiling a Crow project in VS2022?
    Luca Schlecker
    @luca-schlecker
    I already successfully compiled a Crow project using VS2022. Should just work. 👍
    legendaryzyper
    @legendaryzyper
    weird I got build errors saying that cant build under v143
    Luca Schlecker
    @luca-schlecker
    Are you using vcpkg?
    legendaryzyper
    @legendaryzyper
    i built manually from source
    Luca Schlecker
    @luca-schlecker
    Weird... Could you please provide some more information about what errors are occuring.
    legendaryzyper
    @legendaryzyper
    wait im reinstalling vs2022
    Luca Schlecker
    @luca-schlecker
    Where did you get your depentencies from? (Boost)
    legendaryzyper
    @legendaryzyper
    vcpkg
    Luca Schlecker
    @luca-schlecker
    I ran into the problem that I had to manually upgrade my Boost installation from 1.75 to the latest.
    That's probably where your problem is coming from.
    So everything should work out for you if you upgrade boost. 👍