genode/repos/libports/src/app/fetchurl
Christian Helmuth c11d9b7b5c Remove false API dependencies from libc/posix components
Fixes #3720
2020-05-18 10:16:13 +02:00
..
README fetchurl: add progress timeout handling 2019-05-27 14:46:52 +02:00
component.cc fetchurl: add progress timeout handling 2019-05-27 14:46:52 +02:00
target.mk Remove false API dependencies from libc/posix components 2020-05-18 10:16:13 +02:00

README

A small frontend to the libcURL library.

Configuration
-------------

The component will try to fetch the given resource. If this operation stalls
for a given amount of time, the transfer will be aborted. The duration can be
set by setting the 'progress_timeout' attribute in the '<config>' node. It is
specified in milliseconds and the default value is 10 seconds.

The following config snippets illustrate its usage.

Load the socket plugin in to the fetchurl binary (print output to log):
!<config>
! <libc stdout="/dev/log" stderr="/dev/log"
!       rtc="/dev/rtc" socket="/socket"/>
! <vfs>
!  <dir name="dev">
!   <log/> <null/>
!   <inline name="rtc">2000-01-01 00:00</inline>
!   <inline name="random">01234567890123456789</inline>
!  </dir>
!  <dir name="socket"> <lwip dhcp="yes"/> </dir>
! </vfs>
! <fetch url="http://genode.org/about/LICENSE"
!        path="/dev/log" retry="3"/>
! <report progress="yes"/>
!</config>

Use the socket plugin of an other vfs (store file in a directory):
!<config>
! <libc stdout="/dev/log" stderr="/dev/log"
!       rtc="/dev/rtc" socket="/socket"/>
! <vfs>
!  <dir name="dev">
!   <log/> <null/>
!   <inline name="rtc">2000-01-01 00:00</inline>
!   <inline name="random">01234567890123456789</inline>
!  </dir>
!  <fs name="tcpip"/>
!  <dir name="download"> <fs label="download"/> </dir>
! </vfs>
! <fetch url="http://genode.org/about/LICENSE"
!        path="/download/LICENSE" retry="3"/>
! <report progress="yes"/>
!</config>

The two primary options are 'url', the URL to fetch, and 'path', the
file-system path where fetched data is written. Secondary options are
'retry' and 'proxy'. Retry is the number of fetch attempts to make
following failure, and proxy is used to reroute requests.

An example TOR proxying configuration:

! <fetch url="http://genode.org/about/LICENSE" path="LICENSE"
!        proxy="sock5://10.0.0.1:9050" />

The presence of a 'report' node in the configuration with an
affirmative 'progress' attribute will enable a progress report.
The 'delay_ms' attribute will set the minimum interval between
reports and defauts to 100 miliseconds. The report format is as
follows.

! <progress>
!   <fetch url="..." total="100.0" now="50.0"/>
! </progress>