PLUGIN http
USE
	TYPE com.device
DEFINE
	FUNCTION http.protocol_mesg_1_1 STR BLN -> INT ?
	TYPE http.mesg_1_1
	INTERRUPTION http.bad_mesg_1_1
	INSTRUCTION http.decode STR -> http.mesg_1_1
	INSTRUCTION http.encode http.mesg_1_1 -> STR
	INTERRUPTION http.bad_returncode
	INSTRUCTION http.new ( 'QUERY' [ 'GET' 'HEAD' 'POST' 'PUT' 'DELETE' 'CONNECT' 'OPTIONS' 'TRACE' 'PATCH' ]:method STR:uri STR:hostname | 'REPLY' INT:return_code ) -> http.mesg_1_1
	INSTRUCTION http.query http.mesg_1_1 -> BLN
	INSTRUCTION http.reply http.mesg_1_1 -> BLN
	INTERRUPTION http.bad_mesgtype
	INSTRUCTION http.get_method http.mesg_1_1 -> STR
	INSTRUCTION http.set_method MUTABLE http.mesg_1_1 STR
	INSTRUCTION http.get_uri http.mesg_1_1 -> STR
	INSTRUCTION http.set_uri MUTABLE http.mesg_1_1 STR
	INSTRUCTION http.get_returncode http.mesg_1_1 -> INT
	INSTRUCTION http.set_returncode MUTABLE http.mesg_1_1 INT
	INSTRUCTION http.get_header http.mesg_1_1 STR:key -> STR ?:value
	INSTRUCTION http.set_header MUTABLE http.mesg_1_1 STR:key STR ?:value
	INSTRUCTION http.get_headers http.mesg_1_1 -> PTR
	INSTRUCTION http.set_headers MUTABLE http.mesg_1_1 PTR
	INSTRUCTION http.get_payload http.mesg_1_1 -> STR
	INSTRUCTION http.set_payload MUTABLE http.mesg_1_1 STR 'LENGTH' ?
