blur-network/blur

Enhancement: rewrite of epee library (partial, at least)

Opened this issue · 2 comments

Not liking the things in that library. Historically, its been a source of a fairly large problem at least once (Cisco Talos). Comments in code don't seem to be happy with it either... which draws similar attention to p2p.

  • IP addressess handled irresponsibly...
  • Removed a gif-content-type from the http_base.h header file
  • For some reason we have code that handles all kinds of media/web files (?)
    -
    template<class t_connection_context>
    std::string simple_http_connection_handler<t_connection_context>::get_file_mime_tipe(const std::string& path)
    {
    std::string result;
    std::string ext = string_tools::get_extension(path);
    if(!string_tools::compare_no_case(ext, "gif"))
    result = "image/gif";
    else if(!string_tools::compare_no_case(ext, "jpg"))
    result = "image/jpeg";
    else if(!string_tools::compare_no_case(ext, "html"))
    result = "text/html";
    else if(!string_tools::compare_no_case(ext, "htm"))
    result = "text/html";
    else if(!string_tools::compare_no_case(ext, "js"))
    result = "application/x-javascript";
    else if(!string_tools::compare_no_case(ext, "css"))
    result = "text/css";
    else if(!string_tools::compare_no_case(ext, "xml"))
    result = "application/xml";
    else if(!string_tools::compare_no_case(ext, "svg"))
    result = "image/svg+xml";
    return result;
    }
    //-----------------------------------------------------------------------------------
    (Surely, most of this is probably very unnecessary)

Consider partial rewrite.

epee namespace appears to be using ssize_t everywhere std::size_t occurs. since size_t is not always portable, this could be the reason... but can we need to make sure that std::size_t should indeed be a ssize_t as compiler says ... or, if it should be a size_t as name implies... we should make this clearer.

Other places this was occurring, as far as the linker was concerned:

  • src/checkpoints/checkpoints.cpp
  • external/easylogging.h
  • contrib/epee/include/misc_log_ex.h
  • src/crypto & src/crypto/crypto-ops in various files

Similarly, there is a special case going on with streams. If this is simply for portability -- great. No problems. But make the customized types less confusing

Something found when building the snap for v0.1.9.6 (snapcraft core uses ubuntu:16.04)

SnapBuildWarning

Definitely worth looking into what exactly is going on here... as it may be the cause of some of the p2p oddities, and looks to have the ability to affect everything that uses endpoint addresses.