Changeset 6421

Show
Ignore:
Timestamp:
11/13/10 14:52:34 (3 years ago)
Author:
jow
Message:

luci-0.9: merge r6420

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/branches/luci-0.9/libs/web/luasrc/dispatcher.lua

    r6082 r6421  
    5050function build_url(...) 
    5151    local path = {...} 
    52     local sn = http.getenv("SCRIPT_NAME") or "" 
     52    local url = { http.getenv("SCRIPT_NAME") or "" } 
     53 
     54    local k, v 
    5355    for k, v in pairs(context.urltoken) do 
    54         sn = sn .. "/;" .. k .. "=" .. http.urlencode(v) 
    55     end 
    56     return sn .. ((#path > 0) and "/" .. table.concat(path, "/") or "") 
     56        url[#url+1] = "/;" 
     57        url[#url+1] = http.urlencode(k) 
     58        url[#url+1] = "=" 
     59        url[#url+1] = http.urlencode(v) 
     60    end 
     61 
     62    local p 
     63    for _, p in ipairs(path) do 
     64        if p:match("^[a-zA-Z0-9_%-%./,;]+$") then 
     65            url[#url+1] = "/" 
     66            url[#url+1] = p 
     67        end 
     68    end 
     69 
     70    return table.concat(url, "") 
    5771end 
    5872 
     
    179193        local tkey, tval 
    180194        if t then 
    181             tkey, tval = s:match(";(%w+)=(.*)") 
     195            tkey, tval = s:match(";(%w+)=([a-fA-F0-9]*)") 
    182196        end 
    183197