moonbridge

diff moonbridge_http.lua @ 177:b03857995d57

Bugfix in headers metatable (causes lowercase headers to not be properly processed)
author jbe
date Thu Jun 18 22:27:57 2015 +0200 (2015-06-18)
parents b2d024220782
children f6eea95879d4
line diff
     1.1 --- a/moonbridge_http.lua	Thu Jun 18 22:16:08 2015 +0200
     1.2 +++ b/moonbridge_http.lua	Thu Jun 18 22:27:57 2015 +0200
     1.3 @@ -235,7 +235,7 @@
     1.4      repeat
     1.5        -- table for caching nil values:
     1.6        local headers_value_nil = {}
     1.7 -      -- create a new request object with metatable:
     1.8 +      -- create a new request object (methods are added later):
     1.9        local request  -- allow references to local variable
    1.10        request = {
    1.11          -- allow access to underlying socket:
    1.12 @@ -247,14 +247,11 @@
    1.13          headers = setmetatable({}, {
    1.14            __index = function(self, key)
    1.15              local lowerkey = string.lower(key)
    1.16 -            if lowerkey == key then
    1.17 -              return
    1.18 -            end
    1.19              local result = rawget(self, lowerkey)
    1.20              if result == nil then
    1.21                result = {}
    1.22 +              self[lowerkey] = result
    1.23              end
    1.24 -            self[lowerkey] = result
    1.25              self[key] = result
    1.26              return result
    1.27            end

Impressum / About Us