Setting curl timeout

Dear all,

When trying to use some webradios, or some podcasts, I often have a problem similiar to the one shown here: https://github.com/ChrisPanda/volumio-podcast-plugin/issues/9. This for instance happens with the France Musique web radio http://direct.francemusique.fr/live/francemusique-midfi.mp3.

I noticed, when running curl directly from the command line, for instance volumio@ella:~$ curl -v -L -o curl.mp3 http://direct.francemusique.fr/live/francemusique-midfi.mp3 that it takes about 15s for the actual download to start (after two redirections, see the output at the end of this message).

It seems that, as used by volumio, curl timeout is set to 10s. Hence the errors.

So my question is: where can curl options be set? For instance, I could add --connect-timeout 20 In volumio? In the volumio plugins? In mpd?

I tried to add a .curlrc file with the relevant option in /home/volumio/. , /root/. , and /var/lib/mpd/. but it didn’t help.

Any ideas?

Thanks in advance for your help.

Mhz

PS: the output of curl:

volumio@volumio:~$ curl --connect-timeout 20 -v -L -o curl.mp3 http://direct.francemusique.fr/live/francemusique-midfi.mp3
* Hostname was NOT found in DNS cache
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 185.59.40.2...
* Connected to direct.francemusique.fr (185.59.40.2) port 80 (#0)
> GET /live/francemusique-midfi.mp3 HTTP/1.1
> User-Agent: curl/7.38.0
> Host: direct.francemusique.fr
> Accept: */*
> 
< HTTP/1.1 302 Moved Temporarily
* Server nginx/1.10.3 is not blacklisted
< Server: nginx/1.10.3
< Date: Sat, 02 Feb 2019 17:12:21 GMT
< Content-Type: text/html
< Content-Length: 161
< Connection: keep-alive
< Location: http://chai5she.cdn.dvmr.fr:80/francemusique-midfi.mp3
< 
* Ignoring the response-body
{ [data not shown]
100   161  100   161    0     0   1890      0 --:--:-- --:--:-- --:--:--  1916
* Connection #0 to host direct.francemusique.fr left intact
* Issue another request to this URL: 'http://chai5she.cdn.dvmr.fr:80/francemusique-midfi.mp3'
* Hostname was NOT found in DNS cache
  0     0    0     0    0     0      0      0 --:--:--  0:00:14 --:--:--     0*   Trying 185.59.40.10...
  0     0    0     0    0     0      0      0 --:--:--  0:00:15 --:--:--     0* Connected to chai5she.cdn.dvmr.fr (185.59.40.10) port 80 (#1)
> GET /francemusique-midfi.mp3 HTTP/1.1
> User-Agent: curl/7.38.0
> Host: chai5she.cdn.dvmr.fr
> Accept: */*
> 
< HTTP/1.1 200 OK
* Server nginx/1.6.2 is not blacklisted
< Server: nginx/1.6.2
< Date: Sat, 02 Feb 2019 17:14:21 GMT
< Content-Type: audio/mpeg
< Transfer-Encoding: chunked
< Connection: keep-alive
< icy-metadata: 1
< icy-pub: 1
< Cache-Control: no-cache, no-store
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: Origin, Accept, X-Requested-With, Content-Type
< Access-Control-Allow-Methods: GET, OPTIONS, HEAD
< Expires: Mon, 26 Jul 1997 05:00:00 GMT
< 
{ [data not shown]
100  146k    0  146k    0     0   7033      0 --:--:--  0:00:21 --:--:-- 16168^C

Dear all,

I found that curl timeout is set to 10s by mpd (see MPD/src/lib/curl/Request.cxx).

In the MPD documentation about the curl plugin, it is said that settings set in ~/.curlrc should override this setting. However, I didn’t succeed in achieving such an effect through volumio.

I stopped looking for such a solution, because, anyway, there was no reason for such a long connection time. Instead, I decided to set primary and secondary DNS in the ‘Network’ settings of volumio, and that completely solved my problem.

I hop it can help other people.