set_config
The set_config method specifies settings to use for sending the HTTP request (in the form of a section from a configuration file). For example, you can specify the proxy server to use by setting the parameters ProxyHost and ProxyPort, or specify the SSL version to use by setting SSLMethod.
Syntax
set_config( config, section )
Arguments
| Argument | Description |
|---|---|
config
|
(LuaConfig) The LuaConfig object that contains the settings for sending the HTTP request. To obtain a LuaConfig object, see the function get_config or LuaConfig:new. |
section
|
(string) The name of the configuration section from which to read the settings. |
Example
The following example creates a new LuaConfig object from a string. Usually you would read the configuration settings from the configuration file using the function get_config. It then uses the LuaConfig object to provide settings for a LuaHttpRequest named request.
local config_string = [===[ [HTTP] ProxyHost=proxy.domain.com ProxyPort=8080 SSLMethod=NEGOTIATE ]===] local config = LuaConfig:new(config_string) request:set_config(config, "HTTP")