@@ -7,6 +7,7 @@ local wbproto = require "resty.websocket.protocol"
77local new_tab = wbproto .new_tab
88local _recv_frame = wbproto .recv_frame
99local _send_frame = wbproto .send_frame
10+ local ngx = ngx
1011local http_ver = ngx .req .http_version
1112local req_sock = ngx .req .socket
1213local ngx_header = ngx .header
@@ -16,8 +17,9 @@ local char = string.char
1617local str_find = string.find
1718local sha1_bin = ngx .sha1_bin
1819local base64 = ngx .encode_base64
19- local ngx = ngx
2020local read_body = ngx .req .read_body
21+ local ngx_send_headers = ngx .send_headers
22+ local ngx_flush = ngx .flush
2123local band = bit .band
2224local rshift = bit .rshift
2325local type = type
@@ -93,11 +95,11 @@ function _M.new(self, opts)
9395 ngx_header [" Content-Type" ] = nil
9496
9597 ngx .status = 101
96- local ok , err = ngx . send_headers ()
98+ local ok , err = ngx_send_headers ()
9799 if not ok then
98100 return nil , " failed to send response header: " .. (err or " unknown" )
99101 end
100- ok , err = ngx . flush (true )
102+ ok , err = ngx_flush (true )
101103 if not ok then
102104 return nil , " failed to flush response header: " .. (err or " unknown" )
103105 end
0 commit comments