http set verifymode

From Onset Developer Wiki
Revision as of 17:01, 24 January 2020 by BlueMountains (talk | contribs) (Created page with "{{Info|Function|Server|1.0.3}} {{FuncDescription|If this is an https request this setting controls of the peer certificate is verified.)}} {{FuncSyntax|http_set_verifymode(h...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
http set verifymode

Type: Function
Context: Server
Introduced: v1.0.3

Description

If this is an https request this setting controls of the peer certificate is verified.)

Syntax

http_set_verifymode(http, verifymode)

Parameters

  • http
    The http identifier.
  • body
    Modes: "verify_none", "verify_peer" (Default)

Return Value

  • Returns true on success.

Example

function test_get()
	local r = http_create()
	http_set_resolver_protocol(r, "any")
	http_set_protocol(r, "https")
	http_set_host(r, "postman-echo.com")
	http_set_port(r, 443)
	http_set_verifymode(r, "verify_peer")
	http_set_target(r, "/get?foo=bar&onset=nice")
	http_set_verb(r, "get")
	http_set_timeout(r, 30)
	http_set_version(r, 11)
	http_set_keepalive(r, false)
	http_set_field(r, "user-agent", "Onset Server "..GetGameVersionString())
	
	if http_send(r, OnGetComplete, "Str L", 88.88, 1337) == false then
		print("HTTP REQ NOT SENT :(")
		http_destroy(r)
	end
end

function OnGetComplete(a, b, c)
	print("OnGetComplete", a, b, c)
end

See also