summaryrefslogtreecommitdiffstatshomepage
ModeNameSize
-rw-r--r--.gitignore80logstatsplain
-rw-r--r--.gitmodules78logstatsplain
-rw-r--r--COPYING18009logstatsplain
-rw-r--r--Makefile2945logstatsplain
-rw-r--r--README3107logstatsplain
-rw-r--r--cache.c10165logstatsplain
-rw-r--r--cache.h983logstatsplain
-rw-r--r--cgit.c13729logstatsplain
-rw-r--r--cgit.css6895logstatsplain
-rw-r--r--cgit.h5072logstatsplain
-rw-r--r--cgit.png1840logstatsplain
-rw-r--r--cgitrc.5.txt10875logstatsplain
-rw-r--r--cmd.c3492logstatsplain
-rw-r--r--cmd.h271logstatsplain
-rw-r--r--configfile.c1426logstatsplain
-rw-r--r--configfile.h220logstatsplain
-rwxr-xr-xgen-version.sh392logstatsplain
m---------git @ 97a7a820logstats
-rw-r--r--html.c4904logstatsplain
-rw-r--r--html.h870logstatsplain
-rw-r--r--parsing.c4444logstatsplain
-rw-r--r--scan-tree.c2900logstatsplain
-rw-r--r--scan-tree.h43logstatsplain
-rw-r--r--shared.c7516logstatsplain
d---------tests549logstatsplain
-rw-r--r--ui-atom.c2963logstatsplain
-rw-r--r--ui-atom.h112logstatsplain
-rw-r--r--ui-blob.c1677logstatsplain
-rw-r--r--ui-blob.h137logstatsplain
-rw-r--r--ui-clone.c2414logstatsplain
-rw-r--r--ui-clone.h211logstatsplain
-rw-r--r--ui-commit.c2876logstatsplain
-rw-r--r--ui-commit.h109logstatsplain
-rw-r--r--ui-diff.c7757logstatsplain
-rw-r--r--ui-diff.h259logstatsplain
-rw-r--r--ui-log.c3776logstatsplain
-rw-r--r--ui-log.h177logstatsplain
-rw-r--r--ui-patch.c3082logstatsplain
-rw-r--r--ui-patch.h105logstatsplain
-rw-r--r--ui-plain.c1680logstatsplain
-rw-r--r--ui-plain.h120logstatsplain
-rw-r--r--ui-refs.c4406logstatsplain
-rw-r--r--ui-refs.h182logstatsplain
-rw-r--r--ui-repolist.c4091logstatsplain
-rw-r--r--ui-repolist.h146logstatsplain
-rw-r--r--ui-shared.c17718logstatsplain
-rw-r--r--ui-shared.h2265logstatsplain
-rw-r--r--ui-snapshot.c5576logstatsplain
-rw-r--r--ui-snapshot.h215logstatsplain
-rw-r--r--ui-stats.c9689logstatsplain
-rw-r--r--ui-stats.h582logstatsplain
-rw-r--r--ui-summary.c1689logstatsplain
-rw-r--r--ui-summary.h142logstatsplain
-rw-r--r--ui-tag.c1712logstatsplain
-rw-r--r--ui-tag.h101logstatsplain
-rw-r--r--ui-tree.c5074logstatsplain
-rw-r--r--ui-tree.h119logstatsplain
an class="mi">5, ...) http["path"] = select(6, ...) http["host"] = select(7, ...) http["https"] = select(8, ...) cgit = {} cgit["repo"] = select(9, ...) cgit["page"] = select(10, ...) cgit["url"] = select(11, ...) cgit["login"] = select(12, ...) end function filter_close() return action() end function filter_write(str) post = parse_qs(str) end -- -- -- Utility functions based on keplerproject/wsapi. -- -- function url_decode(str) if not str then return "" end str = string.gsub(str, "+", " ") str = string.gsub(str, "%%(%x%x)", function(h) return string.char(tonumber(h, 16)) end) str = string.gsub(str, "\r\n", "\n") return str end function url_encode(str) if not str then return "" end str = string.gsub(str, "\n", "\r\n") str = string.gsub(str, "([^%w ])", function(c) return string.format("%%%02X", string.byte(c)) end) str = string.gsub(str, " ", "+") return str end function parse_qs(qs) local tab = {} for key, val in string.gmatch(qs, "([^&=]+)=([^&=]*)&?") do tab[url_decode(key)] = url_decode(val) end return tab end function get_cookie(cookies, name) cookies = string.gsub(";" .. cookies .. ";", "%s*;%s*", ";") return url_decode(string.match(cookies, ";" .. name .. "=(.-);")) end -- -- -- Cookie construction and validation helpers. -- -- local crypto = require("crypto") -- Returns value of cookie if cookie is valid. Otherwise returns nil. function validate_value(expected_field, cookie) local i = 0 local value = "" local field = "" local expiration = 0 local salt = "" local hmac = "" if cookie == nil or cookie:len() < 3 or cookie:sub(1, 1) == "|" then return nil end for component in string.gmatch(cookie, "[^|]+") do if i == 0 then field = component elseif i == 1 then value = component elseif i == 2 then expiration = tonumber(component) if expiration == nil then expiration = -1 end elseif i == 3 then salt = component elseif i == 4 then hmac = component else break end i = i + 1 end if hmac == nil or hmac:len() == 0 then return nil end -- Lua hashes strings, so these comparisons are time invariant. if hmac ~= crypto.hmac.digest("sha1", field .. "|" .. value .. "|" .. tostring(expiration) .. "|" .. salt, secret) then return nil end if expiration == -1 or (expiration ~= 0 and expiration <= os.time()) then return nil end if url_decode(field) ~= expected_field then return nil end return url_decode(value) end function secure_value(field, value, expiration) if value == nil or value:len() <= 0 then return "" end local authstr = "" local salt = crypto.hex(crypto.rand.bytes(16)) value = url_encode(value) field = url_encode(field) authstr = field .. "|" .. value .. "|" .. tostring(expiration) .. "|" .. salt authstr = authstr .. "|" .. crypto.hmac.digest("sha1", authstr, secret) return authstr end function set_cookie(cookie, value) html("Set-Cookie: " .. cookie .. "=" .. value .. "; HttpOnly") if http["https"] == "yes" or http["https"] == "on" or http["https"] == "1" then html("; secure") end html("\n") end function redirect_to(url) html("Status: 302 Redirect\n") html("Cache-Control: no-cache, no-store\n") html("Location: " .. url .. "\n") end function not_found() html("Status: 404 Not Found\n") html("Cache-Control: no-cache, no-store\n\n") end