![]() TOP ts.http.req_transform.get_downstream_bytes ¶ Sometimes we want to set Content-Length header in client_response, and this function should be called before any realĭata is returned from the transform handler. Syntax: ts.http.resp_t_downstream_bytes(NUMBER)ĭescription: This function can be used to set the total bytes to be sent to the downstream. Setting the watermark bytes above 32kb may improve the performance of the transform handler. Syntax: ts.http.resp_t_upstream_watermark_bytes(NUMBER)ĭescription: This function can be used to set the watermark bytes of the upstream transform buffer. TOP ts.http.resp_t_upstream_watermark_bytes ¶ Syntax: ts.http.resp_transform.get_upstream_watermark_bytes()ĭescription: This function can be used to retrieve the current watermark bytes for the upstream transform buffer. TOP ts.http.resp_transform.get_upstream_watermark_bytes ¶ The above example also shows the use of eos passed as a parameter to transform function. resp_cache_untransformed ( 1 ) return 0 end hook ( TS_LUA_RESPONSE_TRANSFORM, append_transform ) ts. ![]() APPEND_DATA, eos else return data, eos end end function do_remap () ts. ctx = true end if eos = 1 then return data. get_upstream_bytes () if sz ~= TS_LUA_INT64_MAX then ts. Local APPEND_DATA = 'TAIL \n ' function append_transform ( data, eos ) if ts. Syntax: ts.client_t_version(VERSION_STR)Ĭontext: do_remap or do_global_* or laterĭescription: Set the http version of the client request with the VERSION_STR Syntax: ver = ts.client_request.get_version()ĭescription: Return the http version string of the client request.Ĭurrent possible values are 1.0, 1.1, and 0.9. String like “GET” orĭescription: This function can be used to override the current client request’s method with METHOD_NAME. ĭescription: This function can be used to retrieve the current client request’s method name. HTTP / 1.1 200 OK Content - Type : text / html Server : ATS / 3.2.0 F - Header : foo Connection : Keep - Alive. These constants are usually used in ts.hook method call.Ĭontext: do_remap/do_os_response or do_global_* or laterĭescription: This table can be used to store per-request Lua context data and has a life time identical to the TS_LUA_HOOK_OS_DNS TS_LUA_HOOK_PRE_REMAP TS_LUA_HOOK_READ_CACHE_HDR TS_LUA_HOOK_TXN_CLOSE TS_LUA_HOOK_POST_REMAP TS_LUA_HOOK_CACHE_LOOKUP_COMPLETE TS_LUA_HOOK_READ_REQUEST_HDR TS_LUA_HOOK_SEND_REQUEST_HDR TS_LUA_HOOK_READ_RESPONSE_HDR TS_LUA_HOOK_SEND_RESPONSE_HDR TS_LUA_REQUEST_TRANSFORM TS_LUA_RESPONSE_TRANSFORM TS_LUA_REQUEST_CLIENT TS_LUA_RESPONSE_CLIENT FUNCTION will beĬalled when the http transaction steps in to HOOK_POINT. debug ( to_host ) return 0 endĭescription: retrieve the “to” port of the remap ruleĭescription: retrieve the “to” scheme of the remap ruleĭescription: retrieve the “to” path of the remap ruleĭescription: retrieve the “to” url of the remap ruleĭescription: retrieve the “from” host of the remap ruleĭescription: retrieve the “from” port of the remap ruleĭescription: retrieve the “from” scheme of the remap ruleĭescription: retrieve the “from” path of the remap ruleĭescription: retrieve the “from” url of the remap ruleĬontext: global or do_remap/do_os_response or do_global_* or laterĭescription: Hooks are points in http transaction processing where we can step in and do some work. The default value of ‘0’ means disabled.įunction do_remap () local to_host = ts. On demand garbage collection can be enabled by adding the following to each remap line. If garbage collection occurs does not occur immediately, memory usage may exceed this double usage. Is doubled during configuration reloads since the ATS must hold both the current and new configurations during the Memory on demand in order to prevent out of memory errors when running close to the memory limit. The garbage collector should be run in a guaranteed fashion.įor example, in Linux, total Lua memory may be limited to 2GB depending on the LuaJIT version. Reconfigurable by modifying nfig while ATS is running.īy default, the LuaJIT garbage collector will run on its own according to its own internal criteria. Not apply to global plugin instances since these exist for the life-time of the ATS process, i.e., they are not reloadable or ![]() This happens when the nfig file has been modified, and the configuration has been reloaded. Reloadable since it must be applied when all the lua states are first initialized.įor remap instances, the LuaJIT garbage collector can be set to be called automatically whenever a remap instance is created 1 ts : 2 plugin : 3 lua : 4 max_states : 64Īny per plugin –states value overrides this default value but must be less than or equal to this value.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |