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

FunctionDescription
ts.client_request.get_methodRetrieves the current client request's method name. Returns a string like "GET" or "POST".
ts.client_request.set_methodOverrides the current client request's method with METHOD_NAME.
ts.client_request.get_versionReturns the HTTP version string of the client request.
ts.client_request.set_versionSets the HTTP version of the client request with the VERSION_STR.
ts.client_request.get_uriRetrieves the client request's path.
ts.client_request.set_uriOverrides the client request's path.
ts.client_request.get_uri_argsRetrieves the client request's query string.
ts.client_request.set_uri_argsOverrides the client request's query string.
ts.client_request.get_uri_paramsRetrieves the client request's parameter string.
ts.client_request.set_uri_paramsOverrides the client request's parameter string.
ts.client_request.get_urlRetrieves the whole client request's URL.
ts.client_request.header.HEADERSets, adds to, clears, or gets the current client request's HEADER.
ts.client_request.get_headersReturns a Lua table holding all the headers for the current client request.
ts.client_request.client_addr.get_addrGets the socket address of the client.
ts.client_request.client_addr.get_incoming_portGets the incoming port of the request.
ts.client_request.get_url_hostReturns the host field of the request URL.
ts.client_request.set_url_hostSets 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_portReturns the port field of the request URL as a Lua number.
ts.client_request.set_url_portSets 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_schemeReturns the scheme field of the request URL.
ts.client_request.set_url_schemeSets 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.

Entradas relacionadas: