How to set timeout for http request in mbed-http?


The default timeout for http request in mbed-http library seems to be at 10 seconds. Is there a way to change it to a different value like 5 seconds? Simply adding a line to set timeout on socket seems not working.

http_request.h, starting from line 54

    HttpRequest(NetworkInterface* network, http_method method, const char* url, Callback<void(const char *at, uint32_t length)> bodyCallback = 0)
        : HttpRequestBase(NULL, bodyCallback)
        _error = 0;
        _response = NULL;

        _parsed_url = new ParsedUrl(url);
        _request_builder = new HttpRequestBuilder(method, _parsed_url);

        _socket = new TCPSocket();
        _socket->set_timeout(5000);   // Added line here
        _we_created_socket = true;

When Ethernet cable is unplugged, the measured timeout stays at 10 seconds after adding the line.