From 3147ffb08a13ba60e8734aacfc1b867ae50f1416 Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 5 Oct 2014 16:04:49 +0800 Subject: [PATCH] http proxy support by setting NETWORK_PROXY variable This should implement feature request in #919. --- defaults.lua | 5 +++++ frontend/ui/networkmgr.lua | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/defaults.lua b/defaults.lua index 68e3ae00c..29259495e 100644 --- a/defaults.lua +++ b/defaults.lua @@ -178,6 +178,11 @@ KOBO_LIGHT_ON_START = -1 -- -1 or 0-100. -1 leaves light as it is, oth KOBO_SCREEN_SAVER = "" -- image or directory with pictures or "-" KOBO_SCREEN_SAVER_LAST_BOOK = true -- get screensaver from last book if possible +-- Network proxy settings +-- proxy url should be a string in the format of "http://localhost:3128" +-- proxy authentication is not supported yet. +NETWORK_PROXY = nil + -- #################################################################### -- following features are not supported right now -- #################################################################### diff --git a/frontend/ui/networkmgr.lua b/frontend/ui/networkmgr.lua index 68a765eff..293d69a86 100644 --- a/frontend/ui/networkmgr.lua +++ b/frontend/ui/networkmgr.lua @@ -83,4 +83,10 @@ function NetworkMgr:getWifiStatus() return false end +-- set network proxy if global variable NETWORK_PROXY is defined +if NETWORK_PROXY then + local http = require("socket.http") + http.PROXY = NETWORK_PROXY +end + return NetworkMgr