Traffic Server Client Request and Response API Functions
Classified in Computers
Written at on English with a size of 5.13 KB.
Traffic Server Client Request and Response API Functions
This document describes the Traffic Server API functions related to client requests and responses.
Client Request Functions
Function | Description |
---|---|
ts.client_request.get_method | Retrieves the current client request's method name. Returns a string like "GET" or "POST". |
ts.client_request.set_method | Overrides the current client request's method with METHOD_NAME. |
ts.client_request.get_version | Returns the HTTP version string of the client request. |
ts.client_request.set_version | Sets the HTTP version of the client request with the VERSION_STR. |
ts.client_request.get_uri | Retrieves the client request's path. |
ts.client_request.set_uri | Overrides the client request's path. |
ts.client_request.get_uri_args | Retrieves the client request's query string. |
ts.client_request.set_uri_args | Overrides the client request's query string. |
ts.client_request.get_uri_params | Retrieves the client request's parameter string. |
ts.client_request.set_uri_params | Overrides the client request's parameter string. |
ts.client_request.get_url | Retrieves the whole client request's URL. |
ts.client_request.header.HEADER | Sets, adds to, clears, or gets the current client request's HEADER. |
ts.client_request.get_headers | Returns a Lua table holding all the headers for the current client request. |
ts.client_request.client_addr.get_addr | Gets the socket address of the client. |
ts.client_request.client_addr.get_incoming_port | Gets the incoming port of the request. |
ts.client_request.get_url_host | Returns the host field of the request URL. |
ts.client_request.set_url_host | Sets the host field of the request URL with str. Used to change the origin server address. Return TS_LUA_REMAP_DID_REMAP(_STOP) in do_remap. |
ts.client_request.get_url_port | Returns the port field of the request URL as a Lua number. |
ts.client_request.set_url_port | Sets the port field of the request URL with NUMBER. Used to change the origin server address. Return TS_LUA_REMAP_DID_REMAP(_STOP) in do_remap. |
ts.client_request.get_url_scheme | Returns the scheme field of the request URL. |
ts.client_request.set_url_scheme | Sets the scheme field of the request URL with str. Used to change the server request scheme. Return TS_LUA_REMAP_DID_REMAP(_STOP) in do_remap. |
HTTP and Cache Functions
ts.http.set_cache_url
Modifies the cache key for the client request.
ts.http.get_cache_lookup_url
Gets the cache lookup URL for the client request.
ts.http.set_cache_lookup_url
Sets the cache lookup URL for the client request.
ts.http.get_parent_proxy
Gets the parent proxy host and port.
ts.http.set_parent_proxy
Sets the parent proxy host and name.
ts.http.get_parent_selection_url
Gets the parent selection URL for the client request.
ts.http.set_parent_selection_url
Sets the parent selection URL for the client request.
ts.http.get_client_protocol_stack
Gets client protocol stack information.
Client Response Functions
ts.client_response.get_status
Retrieves the status code of the response to the client. Returns a Lua number.
ts.client_response.set_status
Sets the status code of the response to the client.
ts.client_response.get_version
Returns the HTTP version string of the response to the client.
ts.client_response.set_version
Sets the HTTP version of the response to the client with the VERSION_STR.
ts.client_response.header.HEADER
Sets, adds to, clears, or gets the current client response's HEADER.
ts.client_response.get_headers
Returns a Lua table holding all the headers for the current client response.
ts.client_response.set_error_resp
Sets the error response to the client.