Hyper-text transfer protocol client.
Hyper-text transfer protocol client. Supports SSL and SSL server certificate verification. Can be reused to connect to different hosts and make many requests.
Cloces the current connection, allows for reusal of [code]HTTPClient[/code].
Connect to a host. This needs to be done before any requests are sent. The host should not have http:// prepended but will strip the protocol identifier if provided. verify_host will check the SSL identity of the host if set to true.
Return current connection.
Return the response's body length.
Return the HTTP status code of the response.
Return the response headers.
Returns all response headers as dictionary where the case-sensitivity of the keys and values is kept like the server delivers it. A value is a simple String, this string can have more than one value where "; " is used as separator. Structure: ("key":"value1; value2") Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
Returns a STATUS_* enum constant. Need to call [method poll] in order to get status updates.
Return whether this [code]HTTPClient[/code] has a response available.
Return whether blocking mode is enabled.
Return whether this [code]HTTPClient[/code] has a response that is chunked.
This needs to be called in order to have any request processed. Check results with [method get_status]
Generates a GET/POST application/x-www-form-urlencoded style query string from a provided dictionary, e.g.: [codeblock] var fields = {"username": "user", "password": "pass"} String queryString = httpClient.query_string_from_dict(fields) returns:= "username=user&password=pass" [/codeblock]
Reads one chunk from the response.
Sends a request to the connected host. The url is what is normally behind the hostname, i.e. in [code]http://somehost.com/index.php[/code], url would be "index.php". Headers are HTTP request headers. To create a POST request with query strings to push to the server, do: [codeblock] var fields = {"username" : "user", "password" : "pass"} var queryString = httpClient.query_string_from_dict(fields) var headers = ["Content-Type: application/x-www-form-urlencoded", "Content-Length: " + str(queryString.length())] var result = httpClient.request(httpClient.METHOD_POST, "index.php", headers, queryString) [/codeblock]
Sends a raw request to the connected host. The url is what is normally behind the hostname, i.e. in [code]http://somehost.com/index.php[/code], url would be "index.php". Headers are HTTP request headers. Sends body raw, as a byte array, does not encode it in any way.
If set to true, execution will block until all data is read from the response.
Set connection to use, for this client.
Sets the size of the buffer used and maximum bytes to read per iteration. see [method read_response_body_chunk]