diff options
| author | Rémi Verschelde <remi@verschelde.fr> | 2016-06-03 18:23:59 +0200 | 
|---|---|---|
| committer | Rémi Verschelde <remi@verschelde.fr> | 2016-06-03 18:23:59 +0200 | 
| commit | 21e05167b1f3afa46de33be76b17b600cd9c640c (patch) | |
| tree | 3e9385c7272d15b13586ee43e34fc590852f9875 | |
| parent | 2ca4995a6f934b9d849679e3bbcf5722d5e238f0 (diff) | |
| parent | 4c5439f8cd787d6422a5ca30316f256227ff3405 (diff) | |
Merge pull request #5016 from J08nY/classref
Added classref for HTTPClient and HTTPRequest
| -rw-r--r-- | doc/base/classes.xml | 123 | ||||
| -rw-r--r-- | scene/main/http_request.cpp | 3 | 
2 files changed, 109 insertions, 17 deletions
| diff --git a/doc/base/classes.xml b/doc/base/classes.xml index c531482950..a380c19115 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -10552,6 +10552,40 @@ This approximation makes straight segments between each point, then subdivides t  			<description>  			</description>  		</method> +		<method name="add_fallback"> +			<argument index="0" name="data" type="DynamicFontData"> +			</argument> +			<description> +			</description> +		</method> +		<method name="set_fallback"> +			<argument index="0" name="idx" type="int"> +			</argument> +			<argument index="1" name="data" type="DynamicFontData"> +			</argument> +			<description> +			</description> +		</method> +		<method name="get_fallback" qualifiers="const"> +			<return type="DynamicFontData"> +			</return> +			<argument index="0" name="idx" type="int"> +			</argument> +			<description> +			</description> +		</method> +		<method name="remove_fallback"> +			<argument index="0" name="idx" type="int"> +			</argument> +			<description> +			</description> +		</method> +		<method name="get_fallback_count" qualifiers="const"> +			<return type="int"> +			</return> +			<description> +			</description> +		</method>  	</methods>  	<constants>  	</constants> @@ -14361,8 +14395,11 @@ This approximation makes straight segments between each point, then subdivides t  </class>  <class name="HTTPClient" inherits="Reference" category="Core">  	<brief_description> +	Hyper-text transfer protocol client.  	</brief_description>  	<description> +	Hyper-text transfer protocol client. Supports SSL and SSL server certificate verification.  +	Can be reused to connect to different hosts and make many requests.  	</description>  	<methods>  		<method name="connect"> @@ -14386,12 +14423,14 @@ This approximation makes straight segments between each point, then subdivides t  			<argument index="0" name="connection" type="StreamPeer">  			</argument>  			<description> +			Set connection to use, for this client.  			</description>  		</method>  		<method name="get_connection" qualifiers="const">  			<return type="StreamPeer">  			</return>  			<description> +			Return current connection.  			</description>  		</method>  		<method name="request_raw"> @@ -14403,9 +14442,12 @@ This approximation makes straight segments between each point, then subdivides t  			</argument>  			<argument index="2" name="headers" type="StringArray">  			</argument> -			<argument index="3" name="body" type="RawArray" default=""""> +			<argument index="3" name="body" type="RawArray">  			</argument>  			<description> +			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.  			</description>  		</method>  		<method name="request"> @@ -14451,30 +14493,35 @@ This approximation makes straight segments between each point, then subdivides t  		</method>  		<method name="close">  			<description> +			Cloces the current connection, allows for reusal of [HTTPClient].  			</description>  		</method>  		<method name="has_response" qualifiers="const">  			<return type="bool">  			</return>  			<description> +			Return whether this [HTTPClient] has a response available.  			</description>  		</method>  		<method name="is_response_chunked" qualifiers="const">  			<return type="bool">  			</return>  			<description> +			Return whether this [HTTPClient] has a response that is chunked.  			</description>  		</method>  		<method name="get_response_code" qualifiers="const">  			<return type="int">  			</return>  			<description> +			Return the HTTP status code of the response.  			</description>  		</method>  		<method name="get_response_headers">  			<return type="StringArray">  			</return>  			<description> +			Return the response headers.  			</description>  		</method>  		<method name="get_response_headers_as_dictionary"> @@ -14490,32 +14537,35 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)  			<return type="int">  			</return>  			<description> +			Return the response's body length.  			</description>  		</method>  		<method name="read_response_body_chunk">  			<return type="RawArray">  			</return>  			<description> +			Reads one chunk from the response.  			</description>  		</method>  		<method name="set_read_chunk_size">  			<argument index="0" name="bytes" type="int">  			</argument>  			<description> -			Sets the size of the buffer used and maximum bytes to read per iteration +			Sets the size of the buffer used and maximum bytes to read per iteration. see [method read_response_body_chunk]  			</description>  		</method>  		<method name="set_blocking_mode">  			<argument index="0" name="enabled" type="bool">  			</argument>  			<description> -			If set to true, execute will wait until all data is read from the response. +			If set to true, execution will block until all data is read from the response.  			</description>  		</method>  		<method name="is_blocking_mode_enabled" qualifiers="const">  			<return type="bool">  			</return>  			<description> +			Return whether blocking mode is enabled.  			</description>  		</method>  		<method name="get_status" qualifiers="const"> @@ -14688,8 +14738,11 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)  </class>  <class name="HTTPRequest" inherits="Node" category="Core">  	<brief_description> +	A Node with the ability to send HTTP requests.  	</brief_description>  	<description> +	A Node with the ability to send HTTP requests. Uses a [HTTPClient] internally, supports HTTPS.  +	Can be used to make HTTP requests or download files via HTTP.  	</description>  	<methods>  		<method name="request"> @@ -14702,76 +14755,91 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)  			<argument index="2" name="ssl_validate_domain" type="bool" default="true">  			</argument>  			<description> +			Make a HTTP GET request. The url is the complete url including "http://" or "https://" which will be parsed for a host and a port. +			The custom_headers are HTTP request headers which will be used. If User-Agent is not specified a Godot specific will be used. +			The ssl_validate_domain specifies if in case of HTTPS the server certificate should be verified.  			</description>  		</method>  		<method name="cancel_request">  			<description> +			Cancel the current request.  			</description>  		</method>  		<method name="get_http_client_status" qualifiers="const">  			<return type="int">  			</return>  			<description> +			Return the current status of the underlying [HTTPClient].  			</description>  		</method>  		<method name="set_use_threads">  			<argument index="0" name="enable" type="bool">  			</argument>  			<description> +			Make this HTTPRequest use threads.  			</description>  		</method>  		<method name="is_using_threads" qualifiers="const">  			<return type="bool">  			</return>  			<description> +			Whether this request is using threads.  			</description>  		</method>  		<method name="set_body_size_limit">  			<argument index="0" name="bytes" type="int">  			</argument>  			<description> +			Set the response body size limit.  			</description>  		</method>  		<method name="get_body_size_limit" qualifiers="const">  			<return type="int">  			</return>  			<description> +			Return current body size limit.  			</description>  		</method>  		<method name="set_max_redirects">  			<argument index="0" name="amount" type="int">  			</argument>  			<description> +			Set the maximum amount of redirects the request will follow.  			</description>  		</method>  		<method name="get_max_redirects" qualifiers="const">  			<return type="int">  			</return>  			<description> +			Return the maximum amount of redirects that will be followed.  			</description>  		</method>  		<method name="set_download_file">  			<argument index="0" name="path" type="String">  			</argument>  			<description> +			Set the file to download into. Outputs the response body into the file.  			</description>  		</method>  		<method name="get_download_file" qualifiers="const">  			<return type="String">  			</return>  			<description> +			Return the file this request will download into.  			</description>  		</method>  		<method name="get_downloaded_bytes" qualifiers="const">  			<return type="int">  			</return>  			<description> +			Return the amount of bytes this HTTPRequest downloaded.  			</description>  		</method>  		<method name="get_body_size" qualifiers="const">  			<return type="int">  			</return>  			<description> +			Return the response body length.  			</description>  		</method>  	</methods> @@ -14786,31 +14854,45 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)  			<argument index="3" name="body" type="RawArray">  			</argument>  			<description> +			This signal is emitted upon request completion.  			</description>  		</signal>  	</signals>  	<constants>  		<constant name="RESULT_SUCCESS" value="0"> +			Request successful.  		</constant>  		<constant name="RESULT_CHUNKED_BODY_SIZE_MISMATCH" value="1">  		</constant>  		<constant name="RESULT_CANT_CONNECT" value="2"> +			Request failed while connecting.  		</constant>  		<constant name="RESULT_CANT_RESOLVE" value="3"> +			Request failed while resolving.  		</constant>  		<constant name="RESULT_CONNECTION_ERROR" value="4"> +			Request failed due to connection(read/write) error.  		</constant>  		<constant name="RESULT_SSL_HANDSHAKE_ERROR" value="5"> +			Request failed on SSL handshake.  		</constant>  		<constant name="RESULT_NO_RESPONSE" value="6"> +			Request does not have a response(yet).  		</constant>  		<constant name="RESULT_BODY_SIZE_LIMIT_EXCEEDED" value="7"> +			Request exceded it's maximum size limit, see [method set_body_size_limit].  		</constant>  		<constant name="RESULT_REQUEST_FAILED" value="8"> +			Request failed. (unused)  		</constant> -		<constant name="RESULT_REDIRECT_LIMIT_REACHED" value="11"> +		<constant name="RESULT_DOWNLOAD_FILE_CANT_OPEN" value="9"> +			HTTPRequest couldn't open the download file.  		</constant>  		<constant name="RESULT_DOWNLOAD_FILE_WRITE_ERROR" value="10"> +			HTTPRequest couldn't write to the download file. +		</constant> +		<constant name="RESULT_REDIRECT_LIMIT_REACHED" value="11"> +			Request reached it's maximum redirect limit, see [method set_max_redirects].  		</constant>  	</constants>  </class> @@ -30019,6 +30101,14 @@ This method controls whether the position between two cached points is interpola  			<description>  			</description>  		</method> +		<method name="set_source_md5"> +			<argument index="0" name="idx" type="int"> +			</argument> +			<argument index="1" name="md5" type="String"> +			</argument> +			<description> +			</description> +		</method>  		<method name="remove_source">  			<argument index="0" name="idx" type="int">  			</argument> @@ -30850,7 +30940,7 @@ This method controls whether the position between two cached points is interpola  			<return type="int">  			</return>  			<description> -		    Return the current axis lock of the body. One of AXIS_LOCK_* enum. +			Return the current axis lock of the body. One of AXIS_LOCK_* enum.  			</description>  		</method>  		<method name="get_colliding_bodies" qualifiers="const"> @@ -30912,13 +31002,13 @@ This method controls whether the position between two cached points is interpola  	</signals>  	<constants>  		<constant name="MODE_STATIC" value="1"> -		Static mode. The body behaves like a [StaticBody], and can only move by user code. +			Static mode. The body behaves like a [StaticBody], and can only move by user code.  		</constant>  		<constant name="MODE_KINEMATIC" value="3"> -		Kinematic body. The body behaves like a [KinematicBody], and can only move by user code. +			Kinematic body. The body behaves like a [KinematicBody], and can only move by user code.  		</constant>  		<constant name="MODE_RIGID" value="0"> -		Rigid body. This is the "natural" state of a rigid body. It is affected by forces, and can move, rotate, and be affected by user code. +			Rigid body. This is the "natural" state of a rigid body. It is affected by forces, and can move, rotate, and be affected by user code.  		</constant>  		<constant name="MODE_CHARACTER" value="2">  		</constant> @@ -32717,8 +32807,9 @@ This method controls whether the position between two cached points is interpola  		<method name="reload">  			<return type="int">  			</return> +			<argument index="0" name="keep_state" type="bool" default="false"> +			</argument>  			<description> -			Reload the script. This will fail if there are existing instances.  			</description>  		</method>  	</methods> @@ -42769,10 +42860,10 @@ This method controls whether the position between two cached points is interpola  	</methods>  	<constants>  		<constant name="ENABLER_FREEZE_BODIES" value="1"> -		This enabler will freeze [RigidBody] nodes. +			This enabler will freeze [RigidBody] nodes.  		</constant>  		<constant name="ENABLER_PAUSE_ANIMATIONS" value="0"> -		This enabler will pause [AnimationPlayer] nodes. +			This enabler will pause [AnimationPlayer] nodes.  		</constant>  		<constant name="ENABLER_MAX" value="2">  		</constant> @@ -42807,21 +42898,21 @@ This method controls whether the position between two cached points is interpola  	</methods>  	<constants>  		<constant name="ENABLER_FREEZE_BODIES" value="1"> -		This enabler will freeze [RigidBody2D] nodes. +			This enabler will freeze [RigidBody2D] nodes.  		</constant>  		<constant name="ENABLER_PAUSE_ANIMATIONS" value="0"> -		This enabler will pause [AnimationPlayer] nodes. +			This enabler will pause [AnimationPlayer] nodes.  		</constant>  		<constant name="ENABLER_PAUSE_PARTICLES" value="2"> -		This enabler will stop [Particles2D] nodes. +			This enabler will stop [Particles2D] nodes.  		</constant>  		<constant name="ENABLER_PAUSE_ANIMATED_SPRITES" value="5">  		</constant>  		<constant name="ENABLER_PARENT_PROCESS" value="3"> -		This enabler will stop the parent's _process function. +			This enabler will stop the parent's _process function.  		</constant>  		<constant name="ENABLER_PARENT_FIXED_PROCESS" value="4"> -		This enabler will stop the parent's _fixed_process function. +			This enabler will stop the parent's _fixed_process function.  		</constant>  		<constant name="ENABLER_MAX" value="6">  		</constant> diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 328ad8fb26..2320616629 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -480,8 +480,9 @@ void HTTPRequest::_bind_methods() {  	BIND_CONSTANT( RESULT_NO_RESPONSE );  	BIND_CONSTANT( RESULT_BODY_SIZE_LIMIT_EXCEEDED );  	BIND_CONSTANT( RESULT_REQUEST_FAILED ); -	BIND_CONSTANT( RESULT_REDIRECT_LIMIT_REACHED ); +	BIND_CONSTANT( RESULT_DOWNLOAD_FILE_CANT_OPEN );  	BIND_CONSTANT( RESULT_DOWNLOAD_FILE_WRITE_ERROR ); +	BIND_CONSTANT( RESULT_REDIRECT_LIMIT_REACHED );  } |