Software / code / prosody
Comparison
plugins/mod_http.lua @ 4678:9613673f916a
mod_http: Fix specifying method in app route keys
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 24 Apr 2012 16:02:30 +0100 |
| parent | 4669:0e0a72679f77 |
| child | 4696:4700e318add1 |
comparison
equal
deleted
inserted
replaced
| 4677:05d8b4099cf5 | 4678:9613673f916a |
|---|---|
| 17 return path; | 17 return path; |
| 18 end | 18 end |
| 19 | 19 |
| 20 local function get_http_event(host, app_path, key) | 20 local function get_http_event(host, app_path, key) |
| 21 local method, path = key:match("^(%S+)%s+(.+)$"); | 21 local method, path = key:match("^(%S+)%s+(.+)$"); |
| 22 if not method and key:sub(1,1) == "/" then | 22 if not method then |
| 23 if key:sub(1,1) ~= "/" then | |
| 24 return nil; | |
| 25 end | |
| 23 method, path = "GET", key; | 26 method, path = "GET", key; |
| 24 else | |
| 25 return nil; | |
| 26 end | 27 end |
| 27 path = normalize_path(path); | 28 path = normalize_path(path); |
| 28 return method:upper().." "..host..app_path..path; | 29 return method:upper().." "..host..app_path..path; |
| 29 end | 30 end |
| 30 | 31 |