util.http: New module for HTTP helper functions
authorFlorian Zeitz <florob@babelmonkeys.de>
Sat, 12 Jan 2013 15:55:39 +0000 (16:55 +0100)
committerFlorian Zeitz <florob@babelmonkeys.de>
Sat, 12 Jan 2013 15:55:39 +0000 (16:55 +0100)
util/http.lua [new file with mode: 0644]

diff --git a/util/http.lua b/util/http.lua
new file mode 100644 (file)
index 0000000..5b49d1d
--- /dev/null
@@ -0,0 +1,15 @@
+-- Prosody IM
+-- Copyright (C) 2013 Florian Zeitz
+--
+-- This project is MIT/X11 licensed. Please see the
+-- COPYING file in the source package for more information.
+--
+
+local http = {};
+
+function http.contains_token(field, token)
+       field = ","..field:gsub("[ \t]", ""):lower()..",";
+       return field:find(","..token:lower()..",", 1, true) ~= nil;
+end
+
+return http;