Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    oat++
    @oatpp_io_twitter

    Hey @/all ,
    Update :bell:

    The new shiny 1.0.0 version is now released - 1.0.0.

    In this release:

    • Configurable object mapping - now user can create own types and add support for these types in ApiController, ApiClient, json::mapping::ObjectMapper.
    • Predefined mapping-enabled unsigned integer types are added.
    • Full support for automatic content compression/decompression based on Accept-Encoding / Content-Encoding headers.
    • CMake. Options added to disable logs. OATPP_DISABLE_LOGV, OATPP_DISABLE_LOGD, OATPP_DISABLE_LOGI, OATPP_DISABLE_LOGW, OATPP_DISABLE_LOGE

    Cheers :tada:
    Leonid

    Alex Benedict
    @abenedic
    Hello, I am experimenting with this a bit for work. As part of that we need TLS support, but cannot use LibreSSL and must use OpenSSL or BoringSSL. How open would you be to having the oatpp-libressl module have configurable TLS support if there were a libTLS shim?
    oat++
    @oatpp_io_twitter

    Hello, @abenedic ,
    Thanks for the question!

    Well the TLS is something that can be easily substituted in oatpp with any other implementation.
    Currently, oatpp has two TLS adoptor module: oatpp-libressl and oatpp-mbedtls. But having more adaptors is a good idea - especially for BoringSSL.

    How open would you be to having the oatpp-libressl module have configurable TLS support if there were a libTLS shim?

    I think it will confuse a user - like which adaptor should be taken and how should I patch/tweak it to get libressl or openssl or desired tls version.

    On the other hand, it's pretty straight forward to create a new adaptor for BoringSSL and/or LibreSSL - there are already two examples. And I think the effort to create a new adaptor is comparable with the effort of creating libTLS shim and making oatpp-libressl configurable.
    oat++
    @oatpp_io_twitter
    So what I want propose is to create the BoringSSL adaptor for oatpp - I will provide all necessary assistance.
    And meanwhile, you can play with the framework using other adaptor. Once oatpp-boringssl is done - switch the adaptors.
    Alex Benedict
    @abenedic
    That sounds reasonable, I might be able to get something done by this weekend(unless some one is motivated). There isn't much work to be done to get that ready(based on the libressl version).
    oat++
    @oatpp_io_twitter
    Sounds great!
    I've created the oatpp-boringssl repository here - https://github.com/oatpp/oatpp-boringssl please feel free to fork it.
    Also later today I'll put some boilerplate code there if you not get started by that time.
    oat++
    @oatpp_io_twitter

    Hey @abenedic ,

    I took a closer look at BoringSSL - it seems to be very Google-specific and it's unclear to me what is the best way to include it in the module.

    So I think the better idea and less painful is to adapt OpenSSL
    The oatpp-openssl repo - https://github.com/oatpp/oatpp-openssl
    Alex Benedict
    @abenedic
    I just saw your message, I was just fiddling with getting it set up as a submodule and trying to get build files generated. It does seem like a big hassle to get it work in a cross platform way.
    I got most of the libressl specific cmake stuff configured to work with boringssl, so I will likely just copy over my work on that part already and just change the BoringSSL stuff to OpenSSL. Had a bit less time than I would have liked to work on it today, learned a bit more about CMake though which was nice.
    Alex Benedict
    @abenedic
    If a person installs it from the package manager then boringssl should look like openssl 1.1.0 though, so really the user could choose the backend by installing boringssl instead of openssl. As long as they don't change anything major from openssl as far as the TLS stuff goes it should be possible to support either with some minimal changes. One of the bigger issues is that boringssl return codes are different from in openssl.
    Alex Benedict
    @abenedic
    A decent amount of the logic in the libressl, mbedtls, and eventual openssl modules is similar, maybe in the future there may be some opportunity for refactoring this and maybe setting the TLS module at compile time when compiling oatpp. This would be my preference personally. I would like to have https by default when using the framework and have some choice at compile time, but I personally don't see much advantage to having it be a module decidable later.
    oat++
    @oatpp_io_twitter

    Hey, thanks for the update!
    It looks like we are in the opposite time-zones:)

    A decent amount of the logic in the libressl, mbedtls, and eventual openssl modules is similar, maybe in the future there may be some opportunity for refactoring this and maybe setting the TLS module at compile time when compiling oatpp.

    Having some kind of uber TLS module is definitely a good idea. Not sure about making it a part of core oatpp module though - oatpp by design works with streams. It doesn't care about where that stream comes from, is it TCP or Bluetooth or TLS over Bluetooth or whatever. You just take oatpp as a stream processor and plug any stream provider to it.
    But we'll see how things will work out in the future.

    Please keep me updated on the progress, and ping me if you have any questions!
    Alex Benedict
    @abenedic
    Yeah UTC-7 here. Sure that sounds sensible. I tend to have a bit of time in the morning(~8am locally) and around the end of day(~4pm) to work on open source projects. I have BoringSSL installed locally, so I was planning on just getting it to work first in the boringssl module and then use that as the base for the openssl module. I should have it currently at the point where I just need to change all the libTLS stuff to use the older interfaces from boringssl. I am planning on keeping the interfaces exactly the same so the current tests can be reused as much as possible, which should help with the "uber TLS" module later if you go that route.
    oat++
    @oatpp_io_twitter
    Hah and I am currently in utc+7 on my vacation :)
    Thats sounds great especially that you have experience with boringssl (as I dont have). It will be goot to have at least one tls module supporting tls1.3. So yeah it's a valuable effort!
    rrajpaul
    @rrajpaul
    @bhorn I have updated my local copy of oatpp-mongocxxmapper to compile against oatpp v1.0.0
    rrajpaul
    @rrajpaul
    @bhorn I tried to use the starter project with oatpp-mongocxxmapper but I felt that either progresql or the crud example would be better suited for the example.
    Benedikt-Alexander Mokroß
    @bamkrs
    @rrajpaul nice that you got it running on 1.0.0, I wasn't able to bump it since my mongo-environment is gone and i had no time to set it up again. Could you fork the repository and create a pull-request to my repository? We could consider to make oatpp-mongocxxmapper an official module if enough data is aquired to prove its reliability. So we are really happy about any reports
    rrajpaul
    @rrajpaul
    @bhorn I am still working on the starter project - got it to compile and run but not insert data or get data etc. Once I get get, post, put and delete working I will do a pull request
    Benedikt-Alexander Mokroß
    @bamkrs
    @rrajpaul nice! thank you.
    rrajpaul
    @rrajpaul
    @bhorn I am getting an error when trying to return a dto object from a bsoncxx::v_noabi::document using readFromDocument
    @bhorn

    @bhorn -- sample DTO
    // StyleDto.hpp
    // crud
    //
    // Created by Leonid on 3/13/18.
    // Modified by Ryan Rajpaul 01/31/2020
    // Copyright © 2018 oatpp. All rights reserved.
    //

    ifndef DTOs_hpp

    define DTOs_hpp

    include "oatpp/core/data/mapping/type/Object.hpp"

    include "oatpp/core/macro/codegen.hpp"

    include OATPP_CODEGEN_BEGIN(DTO)

    class StyleDto : public oatpp::data::mapping::type::Object {

    DTO_INIT(StyleDto, Object)

    DTO_FIELD(Int32, StyleId);
    DTO_FIELD(String, Manufacturer, "Manufacturer");
    DTO_FIELD(String, Brand, "Brand");
    DTO_FIELD(String, Category, "Category");
    DTO_FIELD(String, Type, "Type");
    DTO_FIELD(String, Description, "Description");

    };

    include OATPP_CODEGEN_END(DTO)

    endif / DTOs_hpp /

    @bhorn -- method below StyleDto::ObjectWrapper Database::getStyleById(v_int32 id){
    bsoncxx::stdx::optional<bsoncxx::v_noabi::document::value> result =
    m_db[COLLECTION_NAME].find_one({document{} << "StyleId" << id << finalize});

    auto docView = result->view();
    auto style = m_mongomapper->readFromDocument(docView);
    
    if(style) {
        OATPP_LOGD(TAG, "Found style with id %d", id);
    
        return style;
    }
    return style;

    }

    rrajpaul
    @rrajpaul

    @bhorn -- Method that will try to get a mongodb document by StyleId

    StyleDto::ObjectWrapper Database::getStyleById(v_int32 id){
    bsoncxx::stdx::optional<bsoncxx::v_noabi::document::value> result =
    m_db[COLLECTION_NAME].find_one({document{} << "StyleId" << id << finalize});

    auto docView = result->view();
    auto style = m_mongomapper->readFromDocument(docView);
    
    if(style) {
        OATPP_LOGD(TAG, "Found style with id %d", id);
    
        return style;
    }
    return style;

    }

    @bhorn sample json definition of a style document from style collection

    {
    "StyleId": NumberInt(4400),
    "Manufacturer": "Acme Inc",
    "Category": "Boys",
    "Type": "Footwear",
    "Description": "Running shoes"
    }

    Benedikt-Alexander Mokroß
    @bamkrs
    Hey @rrajpaul i will take a look tomorrow, its very hard to read on mobile
    rrajpaul
    @rrajpaul
    No problem, I will keep at it thanks
    Benedikt-Alexander Mokroß
    @bamkrs
    Hey @rrajpaul sorry for replying so late, kinda bussy atm. Do you still have the error? could you send me a pastebin of the error and a screenshot of your stack?
    rrajpaul
    @rrajpaul
    fix the error, my bad as I did not do readFromDocument<StyleDto::ObjectWrapper>
    @bhorn the fork for oatpp-mongocxxmapper is now on my github at https://github.com/rrajpaul/oatpp-mongocxxmapper
    rrajpaul
    @rrajpaul
    I am having a different sort of issue issue Floating point exception (core dumped) I have uploaded my local project to https://github.com/rrajpaul/oatpp-mongodb-example. If you can take a look
    rrajpaul
    @rrajpaul
    @bhorn I have figured what is causing the error - it was swagger component
    Benedikt-Alexander Mokroß
    @bamkrs
    @rrajpaul great to hear and see your progress! If you have any further issues, we can help you the most if you screenshot your error and stacktrace. If its too much to screenshot, you can also upload it to pastebin or similar.
    rrajpaul
    @rrajpaul
    @bhorn I have updated the example project name to example-mongodb and i used the README.md from the CRUD example.
    @bhorn I will update the tests as they do not work.
    @bhorn the link to the mongodb example project is https://github.com/rrajpaul/example-mongodb
    note8g2018
    @note8g2018
    hi
    do you know how to install LibreSSL in windows 10?
    Benedikt-Alexander Mokroß
    @bamkrs
    Hi @note8g2018 libressl has a README.windows in their repository, https://github.com/libressl-portable/portable/blob/master/README.windows I think this explains everything :)
    codderembedded
    @codderembedded
    Hi, I am trying my-service example. I want to create an endpoint that performs file operations. I want to take base64 data, convert it to string and save it in txt file. How can I do it? How can I convert to std::string from oatpp::String?
    oat++
    @oatpp_io_twitter

    Hello @codderembedded ,

    I want to take base64 data, convert it to string and save it in txt file. How can I do it?

    #include "oatpp/encoding/Base64.hpp"
    
    ...
    
    oatpp::String base64Data = "SGVsbG8gV29ybGQh";
    oatpp::String plainData = oatpp::encoding::Base64::decode(base64Data);
    plainData->saveToFile("/path/to/file.txt");
    How can I convert to std::string from oatpp::String?
      oatpp::String oatppString = "Hello World!";
      std::string stdString = oatppString->std_str();
    Please let me know if you have more questions!
    codderembedded
    @codderembedded
    thank you very much
    codderembedded
    @codderembedded
    How can I convert to oatpp::String from int