From a729bf17e251c58469aaf2f7ab7712c04154f3b6 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Sat, 12 Jan 2013 16:55:39 +0100 Subject: util.http: New module for HTTP helper functions --- util/http.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 util/http.lua (limited to 'util') diff --git a/util/http.lua b/util/http.lua new file mode 100644 index 00000000..5b49d1d0 --- /dev/null +++ b/util/http.lua @@ -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; -- cgit v1.2.3