aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config/config.nim6
-rw-r--r--src/types/urimethodmap.nim4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/config/config.nim b/src/config/config.nim
index 5f8e9c17..1274e731 100644
--- a/src/config/config.nim
+++ b/src/config/config.nim
@@ -385,9 +385,13 @@ proc getMimeTypes*(config: Config): MimeTypes =
return DefaultGuess
return mimeTypes
+const DefaultURIMethodMap = parseURIMethodMap("""
+finger: cgi-bin:cha-finger?%s
+""")
+
proc getURIMethodMap*(config: Config): URIMethodMap =
let configDir = getConfigDir() / "chawan" #TODO store this in config?
- var urimethodmap: URIMethodMap
+ var urimethodmap = DefaultURIMethodMap
for p in config.external.urimethodmap:
let f = openFileExpand(configDir, p)
if f != nil:
diff --git a/src/types/urimethodmap.nim b/src/types/urimethodmap.nim
index 283564a2..f9331cfd 100644
--- a/src/types/urimethodmap.nim
+++ b/src/types/urimethodmap.nim
@@ -69,3 +69,7 @@ proc parseURIMethodMap*(this: var URIMethodMap, s: string) =
elif v.startsWith("/cgi-bin/"):
v = "cgi-bin:" & v.substr("/cgi-bin/".len)
discard this.map.hasKeyOrPut(k, v)
+
+proc parseURIMethodMap*(s: string): URIMethodMap =
+ result = URIMethodMap()
+ result.parseURIMethodMap(s)