Method HttpClient():setOption() Foundation

Changes a HttpClient option.

:setOption( <cName>[, <xValue>] ) --> self
<cName> is a character string identifying an option.
The expression <xValue> specifies the value for a option. The data type and value is dependent on the HttpClient option designated by <cName>.

:setOption() returns the object executing the method.


The method :setOption() changes a HttpClient option. The option is identified by the character string passed in the parameter <cName>. The method :setOption() must be called before one of the methods :send(), :sendAsync() or :getFile() is executed for the first time. Afterwards, the options can no longer be changed.

The following table lists the valid options and their respective values.

Available options
Option-Name Value *) Description
disable-redirect n/a Disables automatic redirects.
secure-protocol "ssl-2.0", "ssl-3.0", "tls-1.0", "tls-1.1", "tls-1.2", "tls-1.3" Enforces a specific Transport Layer Security protocol for communication.
  1. n/a indicates no xValue parameter required


Disables automatic redirects. By default, HTTP clients automatically follow redirects by re-sending the request to the redirected address. If redirect is disabled, it cannot be enabled without creating a new HttpClient object.


By default, all secure protocols of the operating system are offered to the server. Using the "secure-protocol" option, the offered secure protocols can be restricted to either a single or a specific set of desired secure protocols. In order to enforce usage of a single secure protocol, a character string with the desired TLS protocol version must be passed in the <xValue> parameter. If the communication is to be limited to more than one TLS protocol version, the desired versions must be passed in an array. Example: {"tls-1.1","tls-1.2"}


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.