Merge branch 'config_curl_conn_timeout' of https://github.com/geneticdrift/MPD
This commit is contained in:
commit
b4e3891912
2
NEWS
2
NEWS
|
@ -8,6 +8,8 @@ ver 0.24 (not yet released)
|
|||
- show PCRE support in "config" response
|
||||
* archive
|
||||
- add option to disable archive plugins in mpd.conf
|
||||
* input
|
||||
- curl: add "connect_timeout" configuration
|
||||
* decoder
|
||||
- hybrid_dsd: remove
|
||||
- opus: implement bitrate calculation
|
||||
|
|
|
@ -223,21 +223,31 @@ variables such as ``http_proxy`` or specified in :file:`~/.curlrc`
|
|||
will be in effect.
|
||||
|
||||
.. list-table::
|
||||
:widths: 20 80
|
||||
:widths: 20 70 10
|
||||
:header-rows: 1
|
||||
|
||||
* - Setting
|
||||
- Description
|
||||
- Default
|
||||
* - **proxy**
|
||||
- Sets the address of the HTTP proxy server.
|
||||
-
|
||||
* - **proxy_user, proxy_password**
|
||||
- Configures proxy authentication.
|
||||
-
|
||||
* - **verify_peer yes|no**
|
||||
- Verify the peer's SSL certificate? `More information <http://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html>`_.
|
||||
- yes
|
||||
* - **verify_host yes|no**
|
||||
- Verify the certificate's name against host? `More information <http://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html>`_.
|
||||
- yes
|
||||
* - **cacert**
|
||||
- Set path to Certificate Authority (CA) bundle `More information <https://curl.se/libcurl/c/CURLOPT_CAINFO.html>`_.
|
||||
-
|
||||
* - **connect_timeout**
|
||||
- Set the the connect phase timeout in seconds. "0" is `libcurl`'s default built-in connection timeout - 300 seconds.
|
||||
`More information <https://curl.se/libcurl/c/CURLOPT_CONNECTTIMEOUT.html>`_.
|
||||
- 10
|
||||
|
||||
ffmpeg
|
||||
------
|
||||
|
|
|
@ -151,6 +151,9 @@ static const char *cacert;
|
|||
|
||||
static bool verify_peer, verify_host;
|
||||
|
||||
/** Connection settings */
|
||||
static long connect_timeout;
|
||||
|
||||
static CurlInit *curl_init;
|
||||
|
||||
static constexpr Domain curl_domain("curl");
|
||||
|
@ -374,6 +377,11 @@ input_curl_init(EventLoop &event_loop, const ConfigBlock &block)
|
|||
cacert = block.GetBlockValue("cacert");
|
||||
verify_peer = block.GetBlockValue("verify_peer", default_verify);
|
||||
verify_host = block.GetBlockValue("verify_host", default_verify);
|
||||
|
||||
constexpr unsigned default_connection_timeout = 10;
|
||||
unsigned timeout = block.GetBlockValue("connect_timeout",
|
||||
default_connection_timeout);
|
||||
connect_timeout = static_cast<long>(timeout);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -399,7 +407,7 @@ CurlInputStream::CurlInputStream(EventLoop &event_loop, const char *_url,
|
|||
request_headers.Append("Icy-Metadata: 1");
|
||||
|
||||
for (const auto &[key, header] : headers)
|
||||
request_headers.Append((key + ":" + header).c_str());
|
||||
request_headers.Append((key + ":" += header).c_str());
|
||||
}
|
||||
|
||||
CurlInputStream::~CurlInputStream() noexcept
|
||||
|
@ -439,6 +447,7 @@ CurlInputStream::InitEasy()
|
|||
request->SetOption(CURLOPT_HTTPHEADER, request_headers.Get());
|
||||
request->SetProxyVerifyPeer(verify_peer);
|
||||
request->SetProxyVerifyHost(verify_host);
|
||||
request->SetConnectTimeout(connect_timeout);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -130,6 +130,10 @@ public:
|
|||
easy.SetOption(CURLOPT_PROXY_SSL_VERIFYPEER, value);
|
||||
}
|
||||
|
||||
void SetConnectTimeout(long timeout_seconds) {
|
||||
easy.SetConnectTimeout(timeout_seconds);
|
||||
}
|
||||
|
||||
void SetNoBody(bool value=true) {
|
||||
easy.SetNoBody(value);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "Easy.hxx"
|
||||
#include "Version.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdio>
|
||||
|
||||
namespace Curl {
|
||||
|
||||
|
|
Loading…
Reference in New Issue