chao6118 commented on issue #12869:
URL: https://github.com/apache/apisix/issues/12869#issuecomment-3723715279

   > “API disabled in the context of body_filter_by_lua” body_filter_by_lua 
cannot use cosocket. 
ref:https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#cosockets-not-available-everywhere
   > 
   > > Due to internal limitations in the Nginx core, the cosocket API is 
disabled in the following contexts: 
[set_by_lua*](https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#set_by_lua),
 
[log_by_lua*](https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#log_by_lua),
 
[header_filter_by_lua*](https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#header_filter_by_lua),
 and 
[body_filter_by_lua](https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#body_filter_by_lua).
   
   
[/apisix/apisix/patch.lua](https://github.com/apache/apisix/blob/master/apisix/patch.lua)
  function _M.patch()
       -- make linter happy
       -- luacheck: ignore
       ngx_socket.tcp = function ()
           local phase = get_phase()
           if phase ~= "init" and phase ~= "init_worker" and phase ~= 
"body_filter" then
               return patch_tcp_socket(original_tcp())
           end
   
           return luasocket_tcp()
       end
   
       ngx_socket.udp = function ()
           return patch_udp_socket(original_udp())
       end
   end 
   Is this the way to adjust


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to