summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--applications/luci-app-dnscrypt-proxy/Makefile2
-rw-r--r--applications/luci-app-dnscrypt-proxy/luasrc/model/cbi/dnscrypt-proxy/overview_tab.lua6
-rw-r--r--libs/luci-lib-httpclient/Makefile2
-rw-r--r--libs/luci-lib-httpclient/luasrc/httpclient.lua2
-rw-r--r--libs/luci-lib-httpprotoutils/Makefile14
-rw-r--r--libs/luci-lib-httpprotoutils/luasrc/http/conditionals.lua (renamed from modules/luci-base/luasrc/http/protocol/conditionals.lua)4
-rw-r--r--libs/luci-lib-httpprotoutils/luasrc/http/conditionals.luadoc (renamed from modules/luci-base/luasrc/http/protocol/conditionals.luadoc)2
-rw-r--r--libs/luci-lib-httpprotoutils/luasrc/http/date.lua (renamed from modules/luci-base/luasrc/http/protocol/date.lua)2
-rw-r--r--libs/luci-lib-httpprotoutils/luasrc/http/date.luadoc (renamed from modules/luci-base/luasrc/http/protocol/date.luadoc)2
-rw-r--r--libs/luci-lib-httpprotoutils/luasrc/http/mime.lua (renamed from modules/luci-base/luasrc/http/protocol/mime.lua)2
-rw-r--r--libs/luci-lib-httpprotoutils/luasrc/http/mime.luadoc (renamed from modules/luci-base/luasrc/http/protocol/mime.luadoc)2
11 files changed, 29 insertions, 11 deletions
diff --git a/applications/luci-app-dnscrypt-proxy/Makefile b/applications/luci-app-dnscrypt-proxy/Makefile
index 4b632b8d04..d34fec87d7 100644
--- a/applications/luci-app-dnscrypt-proxy/Makefile
+++ b/applications/luci-app-dnscrypt-proxy/Makefile
@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for DNSCrypt-Proxy
-LUCI_DEPENDS:=+uclient-fetch +dnscrypt-proxy
+LUCI_DEPENDS:=+uclient-fetch +dnscrypt-proxy +luci-lib-httpprotoutils
LUCI_PKGARCH:=all
include ../../luci.mk
diff --git a/applications/luci-app-dnscrypt-proxy/luasrc/model/cbi/dnscrypt-proxy/overview_tab.lua b/applications/luci-app-dnscrypt-proxy/luasrc/model/cbi/dnscrypt-proxy/overview_tab.lua
index 999c81dee7..8f0e3224b4 100644
--- a/applications/luci-app-dnscrypt-proxy/luasrc/model/cbi/dnscrypt-proxy/overview_tab.lua
+++ b/applications/luci-app-dnscrypt-proxy/luasrc/model/cbi/dnscrypt-proxy/overview_tab.lua
@@ -4,7 +4,6 @@
local fs = require("nixio.fs")
local uci = require("luci.model.uci").cursor()
local util = require("luci.util")
-local date = require("luci.http.protocol.date")
local res_input = "/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv"
local res_dir = fs.dirname(res_input)
local dump = util.ubus("network.interface", "dump", {})
@@ -12,6 +11,11 @@ local plug_cnt = tonumber(luci.sys.exec("env -i /usr/sbin/dnscrypt-proxy --vers
local res_list = {}
local url = "https://raw.githubusercontent.com/dyne/dnscrypt-proxy/master/dnscrypt-resolvers.csv"
+local _, date = pcall(require, "luci.http.date")
+if not date then
+ _, date = pcall(require, "luci.http.protocol.date")
+end
+
if not fs.access(res_input) then
if not fs.access("/lib/libustream-ssl.so") then
m = SimpleForm("error", nil, translate("No default resolver list and no SSL support available.<br />")
diff --git a/libs/luci-lib-httpclient/Makefile b/libs/luci-lib-httpclient/Makefile
index 1e7fd1bc85..b8bd428b28 100644
--- a/libs/luci-lib-httpclient/Makefile
+++ b/libs/luci-lib-httpclient/Makefile
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=HTTP(S) client library
-LUCI_DEPENDS:=+luci-base +luci-lib-nixio
+LUCI_DEPENDS:=+luci-base +luci-lib-nixio +luci-lib-httpprotoutils
include ../../luci.mk
diff --git a/libs/luci-lib-httpclient/luasrc/httpclient.lua b/libs/luci-lib-httpclient/luasrc/httpclient.lua
index 04175b3647..3e8d7277d7 100644
--- a/libs/luci-lib-httpclient/luasrc/httpclient.lua
+++ b/libs/luci-lib-httpclient/luasrc/httpclient.lua
@@ -8,7 +8,7 @@ local ltn12 = require "luci.ltn12"
local util = require "luci.util"
local table = require "table"
local http = require "luci.http"
-local date = require "luci.http.protocol.date"
+local date = require "luci.http.date"
local type, pairs, ipairs, tonumber = type, pairs, ipairs, tonumber
local unpack = unpack
diff --git a/libs/luci-lib-httpprotoutils/Makefile b/libs/luci-lib-httpprotoutils/Makefile
new file mode 100644
index 0000000000..851a362eb7
--- /dev/null
+++ b/libs/luci-lib-httpprotoutils/Makefile
@@ -0,0 +1,14 @@
+#
+# Copyright (C) 2018 The LuCI Team <luci@lists.subsignal.org>
+#
+# This is free software, licensed under the Apache License, Version 2.0 .
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=HTTP protocol utility functions
+LUCI_DEPENDS:=+luci-base
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/modules/luci-base/luasrc/http/protocol/conditionals.lua b/libs/luci-lib-httpprotoutils/luasrc/http/conditionals.lua
index d31a4e38a4..86b4db29cd 100644
--- a/modules/luci-base/luasrc/http/protocol/conditionals.lua
+++ b/libs/luci-lib-httpprotoutils/luasrc/http/conditionals.lua
@@ -3,9 +3,9 @@
-- This class provides basic ETag handling and implements most of the
-- conditional HTTP/1.1 headers specified in RFC2616 Sct. 14.24 - 14.28 .
-module("luci.http.protocol.conditionals", package.seeall)
+module("luci.http.conditionals", package.seeall)
-local date = require("luci.http.protocol.date")
+local date = require("luci.http.date")
function mk_etag( stat )
diff --git a/modules/luci-base/luasrc/http/protocol/conditionals.luadoc b/libs/luci-lib-httpprotoutils/luasrc/http/conditionals.luadoc
index 9cfe02dd50..7ce0b5ebe3 100644
--- a/modules/luci-base/luasrc/http/protocol/conditionals.luadoc
+++ b/libs/luci-lib-httpprotoutils/luasrc/http/conditionals.luadoc
@@ -4,7 +4,7 @@ LuCI http protocol implementation - HTTP/1.1 bits.
This class provides basic ETag handling and implements most of the
conditional HTTP/1.1 headers specified in RFC2616 Sct. 14.24 - 14.28 .
]]
-module "luci.http.protocol.conditionals"
+module "luci.http.conditionals"
---[[
Implement 14.19 / ETag.
diff --git a/modules/luci-base/luasrc/http/protocol/date.lua b/libs/luci-lib-httpprotoutils/luasrc/http/date.lua
index e440219a9c..72f1bdb577 100644
--- a/modules/luci-base/luasrc/http/protocol/date.lua
+++ b/libs/luci-lib-httpprotoutils/luasrc/http/date.lua
@@ -2,7 +2,7 @@
-- Licensed to the public under the Apache License 2.0.
-- This class contains functions to parse, compare and format http dates.
-module("luci.http.protocol.date", package.seeall)
+module("luci.http.date", package.seeall)
require("luci.sys.zoneinfo")
diff --git a/modules/luci-base/luasrc/http/protocol/date.luadoc b/libs/luci-lib-httpprotoutils/luasrc/http/date.luadoc
index d6f1c8d658..6028fb4837 100644
--- a/modules/luci-base/luasrc/http/protocol/date.luadoc
+++ b/libs/luci-lib-httpprotoutils/luasrc/http/date.luadoc
@@ -3,7 +3,7 @@ LuCI http protocol implementation - date helper class.
This class contains functions to parse, compare and format http dates.
]]
-module "luci.http.protocol.date"
+module "luci.http.date"
---[[
Return the time offset in seconds between the UTC and given time zone.
diff --git a/modules/luci-base/luasrc/http/protocol/mime.lua b/libs/luci-lib-httpprotoutils/luasrc/http/mime.lua
index 2b99d8e74e..0bcff8a36b 100644
--- a/modules/luci-base/luasrc/http/protocol/mime.lua
+++ b/libs/luci-lib-httpprotoutils/luasrc/http/mime.lua
@@ -3,7 +3,7 @@
-- This class provides functions to guess mime types from file extensions and
-- vice versa.
-module("luci.http.protocol.mime", package.seeall)
+module("luci.http.mime", package.seeall)
require("luci.util")
diff --git a/modules/luci-base/luasrc/http/protocol/mime.luadoc b/libs/luci-lib-httpprotoutils/luasrc/http/mime.luadoc
index 195b5fcc89..7751e2baf4 100644
--- a/modules/luci-base/luasrc/http/protocol/mime.luadoc
+++ b/libs/luci-lib-httpprotoutils/luasrc/http/mime.luadoc
@@ -4,7 +4,7 @@ LuCI http protocol implementation - mime helper class.
This class provides functions to guess mime types from file extensions and
vice versa.
]]
-module "luci.http.protocol.mime"
+module "luci.http.mime"
---[[
MIME mapping table containg extension - mimetype relations.