summaryrefslogtreecommitdiff
path: root/doc/classes/HTTPClient.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/HTTPClient.xml')
-rw-r--r--doc/classes/HTTPClient.xml47
1 files changed, 24 insertions, 23 deletions
diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml
index 5a9d12d01b..97178bc94d 100644
--- a/doc/classes/HTTPClient.xml
+++ b/doc/classes/HTTPClient.xml
@@ -4,7 +4,8 @@
Low-level hyper-text transfer protocol client.
</brief_description>
<description>
- Hyper-text transfer protocol client (sometimes called "User Agent"). Used to make HTTP requests to download web content, upload files and other data or to communicate with various services, among other use cases. [b]See the [HTTPRequest] node for a higher-level alternative.[/b]
+ Hyper-text transfer protocol client (sometimes called "User Agent"). Used to make HTTP requests to download web content, upload files and other data or to communicate with various services, among other use cases.
+ See the [HTTPRequest] node for a higher-level alternative.
[b]Note:[/b] This client only needs to connect to a host once (see [method connect_to_host]) to send multiple requests. Because of this, methods that take URLs usually take just the part after the host instead of the full URL, as the client is already connected to a host. See [method request] for a full example and to get started.
A [HTTPClient] should be reused between multiple requests or to connect to different hosts instead of creating one client per request. Supports SSL and SSL server certificate verification. HTTP status codes in the 2xx range indicate success, 3xx redirection (i.e. "try again, but over here"), 4xx something was wrong with the request, and 5xx something went wrong on the server's side.
For more information on HTTP, see https://developer.mozilla.org/en-US/docs/Web/HTTP (or read RFC 2616 to get it straight from the source: https://tools.ietf.org/html/rfc2616).
@@ -27,15 +28,15 @@
</method>
<method name="connect_to_host">
<return type="int" enum="Error" />
- <argument index="0" name="host" type="String" />
- <argument index="1" name="port" type="int" default="-1" />
- <argument index="2" name="use_ssl" type="bool" default="false" />
- <argument index="3" name="verify_host" type="bool" default="true" />
+ <param index="0" name="host" type="String" />
+ <param index="1" name="port" type="int" default="-1" />
+ <param index="2" name="use_ssl" type="bool" default="false" />
+ <param index="3" name="verify_host" type="bool" default="true" />
<description>
Connects 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.
- If no [code]port[/code] is specified (or [code]-1[/code] is used), it is automatically set to 80 for HTTP and 443 for HTTPS (if [code]use_ssl[/code] is enabled).
- [code]verify_host[/code] will check the SSL identity of the host if set to [code]true[/code].
+ If no [param port] is specified (or [code]-1[/code] is used), it is automatically set to 80 for HTTP and 443 for HTTPS (if [param use_ssl] is enabled).
+ [param verify_host] will check the SSL identity of the host if set to [code]true[/code].
</description>
</method>
<method name="get_response_body_length" qualifiers="const">
@@ -96,7 +97,7 @@
</method>
<method name="query_string_from_dict">
<return type="String" />
- <argument index="0" name="fields" type="Dictionary" />
+ <param index="0" name="fields" type="Dictionary" />
<description>
Generates a GET/POST application/x-www-form-urlencoded style query string from a provided dictionary, e.g.:
[codeblocks]
@@ -134,10 +135,10 @@
</method>
<method name="request">
<return type="int" enum="Error" />
- <argument index="0" name="method" type="int" enum="HTTPClient.Method" />
- <argument index="1" name="url" type="String" />
- <argument index="2" name="headers" type="PackedStringArray" />
- <argument index="3" name="body" type="String" default="&quot;&quot;" />
+ <param index="0" name="method" type="int" enum="HTTPClient.Method" />
+ <param index="1" name="url" type="String" />
+ <param index="2" name="headers" type="PackedStringArray" />
+ <param index="3" name="body" type="String" default="&quot;&quot;" />
<description>
Sends a request to the connected host.
The URL parameter is usually just the part after the host, so for [code]https://somehost.com/index.php[/code], it is [code]/index.php[/code]. When sending requests to an HTTP proxy server, it should be an absolute URL. For [constant HTTPClient.METHOD_OPTIONS] requests, [code]*[/code] is also allowed. For [constant HTTPClient.METHOD_CONNECT] requests, it should be the authority component ([code]host:port[/code]).
@@ -157,15 +158,15 @@
var result = new HTTPClient().Request(HTTPClient.Method.Post, "index.php", headers, queryString);
[/csharp]
[/codeblocks]
- [b]Note:[/b] The [code]request_data[/code] parameter is ignored if [code]method[/code] is [constant HTTPClient.METHOD_GET]. This is because GET methods can't contain request data. As a workaround, you can pass request data as a query string in the URL. See [method String.uri_encode] for an example.
+ [b]Note:[/b] The [param body] parameter is ignored if [param method] is [constant HTTPClient.METHOD_GET]. This is because GET methods can't contain request data. As a workaround, you can pass request data as a query string in the URL. See [method String.uri_encode] for an example.
</description>
</method>
<method name="request_raw">
<return type="int" enum="Error" />
- <argument index="0" name="method" type="int" enum="HTTPClient.Method" />
- <argument index="1" name="url" type="String" />
- <argument index="2" name="headers" type="PackedStringArray" />
- <argument index="3" name="body" type="PackedByteArray" />
+ <param index="0" name="method" type="int" enum="HTTPClient.Method" />
+ <param index="1" name="url" type="String" />
+ <param index="2" name="headers" type="PackedStringArray" />
+ <param index="3" name="body" type="PackedByteArray" />
<description>
Sends a raw request to the connected host.
The URL parameter is usually just the part after the host, so for [code]https://somehost.com/index.php[/code], it is [code]/index.php[/code]. When sending requests to an HTTP proxy server, it should be an absolute URL. For [constant HTTPClient.METHOD_OPTIONS] requests, [code]*[/code] is also allowed. For [constant HTTPClient.METHOD_CONNECT] requests, it should be the authority component ([code]host:port[/code]).
@@ -175,20 +176,20 @@
</method>
<method name="set_http_proxy">
<return type="void" />
- <argument index="0" name="host" type="String" />
- <argument index="1" name="port" type="int" />
+ <param index="0" name="host" type="String" />
+ <param index="1" name="port" type="int" />
<description>
Sets the proxy server for HTTP requests.
- The proxy server is unset if [code]host[/code] is empty or [code]port[/code] is -1.
+ The proxy server is unset if [param host] is empty or [param port] is -1.
</description>
</method>
<method name="set_https_proxy">
<return type="void" />
- <argument index="0" name="host" type="String" />
- <argument index="1" name="port" type="int" />
+ <param index="0" name="host" type="String" />
+ <param index="1" name="port" type="int" />
<description>
Sets the proxy server for HTTPS requests.
- The proxy server is unset if [code]host[/code] is empty or [code]port[/code] is -1.
+ The proxy server is unset if [param host] is empty or [param port] is -1.
</description>
</method>
</methods>