[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/QuantStack/git2cpp/main/src/wasm/utils.cpp [Back]  [Original]

#ifdef EMSCRIPTEN

#    include "utils.hpp"

#    include 
#    include 
#    include 
#    include 

#    include 

#    include "../utils/input_output.hpp"
#    include "constants.hpp"

unsigned long get_request_timeout_ms()
{
    double timeout_seconds = WASM_HTTP_TRANSPORT_TIMEOUT_DEFAULT_S;
    auto env_var = std::getenv(WASM_HTTP_TRANSPORT_TIMEOUT_NAME.data());
    if (env_var != nullptr)
    {
        try
        {
            auto value = std::stod(env_var);
            if (value < 1e-3)  // Must be at least 1 ms.
            {
                throw std::runtime_error("");  // Caught below.
            }
            timeout_seconds = value;
        }
        catch (std::exception& e)
        {
            // Catch failures from (1) stod and (2) timeout 

Web Proxy Viewer  |  New URL  |  Original Page