Module resty.aws.request.http.socket

Socket compatibility module to enable the init-phase, by falling back to LuaSocket.

File originally copied from lua-resty-socket. There should be no need to invoke anything in this module from user code.

NOTE: see comments in the http module regarding compatibility!!

Functions

disable_luasocket (phase, disable) disables LuaSocket use for a specific phase.
force_luasocket (phase, force) forces LuaSocket use for a specific phase.
set_luasec_defaults (defaults) Sets LuaSec defaults to use for tls connections.
tcp (...) creates a tcp socket compatible with ngx.socket.tcp.


Functions

disable_luasocket (phase, disable)
disables LuaSocket use for a specific phase. An override for the automatic phase/socket-type detection. This setting is a module global setting.

Parameters:

  • phase string the phase name
  • disable bool set to true to disable, or false/nil to enable

Returns:

    the previous value of this setting.

Usage:

    local old_setting = sock.disable_luasocket("init", true)
    -- do something
    sock.disable_luasocket("init", old_setting)
force_luasocket (phase, force)
forces LuaSocket use for a specific phase. An override for the automatic phase/socket-type detection. This setting is a module global setting.

Parameters:

  • phase string the phase name
  • force bool set to true to force, or false/nil to auto-detect

Returns:

    the previous value of this setting.

Usage:

    local old_setting = sock.force_luasocket("timer", true)
    -- do something
    sock.force_luasocket("timer", old_setting)
set_luasec_defaults (defaults)
Sets LuaSec defaults to use for tls connections.

Parameters:

  • defaults a table with the following fields:
    • protocol see luasec docs protocol
    • key see luasec docs key
    • cert see luasec docs certificate
    • cafile see luasec docs cafile
    • options see luasec docs options
tcp (...)
creates a tcp socket compatible with ngx.socket.tcp. The socket will fall back to LuaSocket where cosockets are not supported.

Parameters:

  • ... same as ngx.socket.tcp

Returns:

    a co-sockets compatible TCP socket
generated by LDoc 1.4.6 Last updated 2022-08-19 03:23:13