diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-08-25 10:54:48 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2018-08-25 10:54:48 +0200 |
commit | b098b3973dd4a38184882a4a5b84aad2bdd5835a (patch) | |
tree | 0dba397b70a6bcb26f24c70e3b806d3ba677a7ea /tex/context/base/mkiv/util-soc-imp-headers.lua | |
parent | 994bed45a8c8f6833acbdb9250eb4ad531717111 (diff) | |
download | context-b098b3973dd4a38184882a4a5b84aad2bdd5835a.tar.gz |
2018-08-25 10:12:00
Diffstat (limited to 'tex/context/base/mkiv/util-soc-imp-headers.lua')
-rw-r--r-- | tex/context/base/mkiv/util-soc-imp-headers.lua | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tex/context/base/mkiv/util-soc-imp-headers.lua b/tex/context/base/mkiv/util-soc-imp-headers.lua index ee889956c..ef51910a5 100644 --- a/tex/context/base/mkiv/util-soc-imp-headers.lua +++ b/tex/context/base/mkiv/util-soc-imp-headers.lua @@ -5,7 +5,10 @@ local next = next local lower = string.lower local concat = table.concat -local socket = socket or require("socket") +local socket = socket or require("socket") + +local headers = { } +socket.headers = headers local canonic = { ["accept"] = "Accept", @@ -101,7 +104,7 @@ local canonic = { ["x-mailer"] = "X-Mailer", } -setmetatable(canonic, { +headers.canonic = setmetatable(canonic, { __index = function(t,k) socket.report("invalid header: %s",k) t[k] = k @@ -109,7 +112,7 @@ setmetatable(canonic, { end }) -local function normalizeheaders(headers) +function headers.normalize(headers) if not headers then return { } end @@ -122,7 +125,7 @@ local function normalizeheaders(headers) return concat(normalized,"\r\n") end -local function lowerheaders(lowered,headers) +function headers.lower(lowered,headers) if not lowered then return { } end @@ -135,10 +138,8 @@ local function lowerheaders(lowered,headers) return lowered end -socket.headers = { - canonic = canonic, - normalize = normalizeheaders, - lower = lowerheaders, -} +socket.headers = headers + +package.loaded["socket.headers"] = headers -return socket.headers +return headers |