fetchurl: add proxy configuration option

This commit is contained in:
Stefan Kalkowski
2016-08-26 16:45:37 +02:00
committed by Norman Feske
parent ba95c6834f
commit 78b6096fa5
2 changed files with 12 additions and 0 deletions

View File

@@ -11,3 +11,8 @@ Configuration
! </libc>
! <fetch url="http://genode.org/about/LICENSE" path="LICENSE"/>
!</config>
Optionally, you can use a proxy:
! <fetch url="http://genode.org/about/LICENSE" path="LICENSE"
! proxy="sock5://10.0.0.1:9050 />

View File

@@ -135,6 +135,13 @@ void Component::construct(Genode::Env &env)
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
/* check for optional proxy configuration */
try {
Genode::String<256> proxy;
node.attribute("proxy").value(&proxy);
curl_easy_setopt(curl, CURLOPT_PROXY, proxy.string());
} catch (...) { }
res = curl_easy_perform(curl);
close(fd);
if (res != CURLE_OK)