@@ -49,12 +49,11 @@ local newproxy = newproxy
4949local cur_level = ngx .config .subsystem == " http" and
5050 require (" ngx.errlog" ).get_sys_filter_level ()
5151local ngx_var = ngx .var
52- local re_find = ngx .re .find
5352local re_match = ngx .re .match
5453local ngx_re = require (" ngx.re" )
55- local ngx_null = ngx .null
5654local empty_table = {}
5755local str_find = string.find
56+ local str_lower = string.lower
5857
5958
6059setmetatable (empty_table , {__newindex = function ()
132131local _M = { _VERSION = 1.7 }
133132
134133-- expose radix tree api for test
135- _M ._symbols = radix
134+ _M ._symbols = radix
136135
137136
138137local function has_suffix (s , suffix )
@@ -304,13 +303,14 @@ function pre_insert_route(self, path, route, global_opts)
304303 h = h :sub (2 )
305304 end
306305
306+ h = str_lower (h )
307307 insert_tab (route_opts .hosts , is_wildcard )
308308 insert_tab (route_opts .hosts , h )
309309 end
310310
311311 elseif type (hosts ) == " string" then
312312 local is_wildcard = false
313- local host = hosts
313+ local host = str_lower ( hosts )
314314 if host :sub (1 , 1 ) == ' *' then
315315 is_wildcard = true
316316 host = host :sub (2 )
624624
625625
626626local function match_route (self , path , opts , args )
627+ if opts .host then
628+ opts .host = str_lower (opts .host )
629+ end
630+
627631 if opts .matched then
628632 clear_tab (opts .matched )
629633 end
0 commit comments