2
0

class_httprequest.rst 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the HTTPRequest.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_HTTPRequest:
  5. HTTPRequest
  6. ===========
  7. **Inherits:** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. A node with the ability to send HTTP requests.
  12. Member Functions
  13. ----------------
  14. +------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`cancel_request<class_HTTPRequest_cancel_request>` **(** **)** |
  16. +------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`int<class_int>` | :ref:`get_body_size<class_HTTPRequest_get_body_size>` **(** **)** const |
  18. +------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`String<class_string>` | :ref:`get_download_file<class_HTTPRequest_get_download_file>` **(** **)** const |
  20. +------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`get_downloaded_bytes<class_HTTPRequest_get_downloaded_bytes>` **(** **)** const |
  22. +------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`get_http_client_status<class_HTTPRequest_get_http_client_status>` **(** **)** const |
  24. +------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`request<class_HTTPRequest_request>` **(** :ref:`String<class_string>` url, :ref:`PoolStringArray<class_poolstringarray>` custom_headers=PoolStringArray( ), :ref:`bool<class_bool>` ssl_validate_domain=true, :ref:`int<class_int>` method=0, :ref:`String<class_string>` request_data="" **)** |
  26. +------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`set_download_file<class_HTTPRequest_set_download_file>` **(** :ref:`String<class_string>` path **)** |
  28. +------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. Signals
  30. -------
  31. .. _class_HTTPRequest_request_completed:
  32. - **request_completed** **(** :ref:`int<class_int>` result, :ref:`int<class_int>` response_code, :ref:`PoolStringArray<class_poolstringarray>` headers, :ref:`PoolByteArray<class_poolbytearray>` body **)**
  33. This signal is emitted upon request completion.
  34. Member Variables
  35. ----------------
  36. .. _class_HTTPRequest_body_size_limit:
  37. - :ref:`int<class_int>` **body_size_limit** - Maximum allowed size for response bodies.
  38. .. _class_HTTPRequest_max_redirects:
  39. - :ref:`int<class_int>` **max_redirects** - Maximum number of allowed redirects.
  40. .. _class_HTTPRequest_use_threads:
  41. - :ref:`bool<class_bool>` **use_threads** - If ``true`` multithreading is used to improve performance.
  42. Numeric Constants
  43. -----------------
  44. - **RESULT_SUCCESS** = **0** --- Request successful.
  45. - **RESULT_CHUNKED_BODY_SIZE_MISMATCH** = **1**
  46. - **RESULT_CANT_CONNECT** = **2** --- Request failed while connecting.
  47. - **RESULT_CANT_RESOLVE** = **3** --- Request failed while resolving.
  48. - **RESULT_CONNECTION_ERROR** = **4** --- Request failed due to connection(read/write) error.
  49. - **RESULT_SSL_HANDSHAKE_ERROR** = **5** --- Request failed on SSL handshake.
  50. - **RESULT_NO_RESPONSE** = **6** --- Request does not have a response(yet).
  51. - **RESULT_BODY_SIZE_LIMIT_EXCEEDED** = **7** --- Request exceeded its maximum size limit, see :ref:`set_body_size_limit<class_HTTPRequest_set_body_size_limit>`.
  52. - **RESULT_REQUEST_FAILED** = **8** --- Request failed. (Unused)
  53. - **RESULT_DOWNLOAD_FILE_CANT_OPEN** = **9** --- HTTPRequest couldn't open the download file.
  54. - **RESULT_DOWNLOAD_FILE_WRITE_ERROR** = **10** --- HTTPRequest couldn't write to the download file.
  55. - **RESULT_REDIRECT_LIMIT_REACHED** = **11** --- Request reached its maximum redirect limit, see :ref:`set_max_redirects<class_HTTPRequest_set_max_redirects>`.
  56. Description
  57. -----------
  58. A node with the ability to send HTTP requests. Uses :ref:`HTTPClient<class_httpclient>` internally.
  59. Can be used to make HTTP requests, i.e. download or upload files or web content via HTTP.
  60. Member Function Description
  61. ---------------------------
  62. .. _class_HTTPRequest_cancel_request:
  63. - void **cancel_request** **(** **)**
  64. Cancels the current request.
  65. .. _class_HTTPRequest_get_body_size:
  66. - :ref:`int<class_int>` **get_body_size** **(** **)** const
  67. Returns the response body length.
  68. .. _class_HTTPRequest_get_download_file:
  69. - :ref:`String<class_string>` **get_download_file** **(** **)** const
  70. Returns the file this request will download into.
  71. .. _class_HTTPRequest_get_downloaded_bytes:
  72. - :ref:`int<class_int>` **get_downloaded_bytes** **(** **)** const
  73. Returns the amount of bytes this HTTPRequest downloaded.
  74. .. _class_HTTPRequest_get_http_client_status:
  75. - :ref:`int<class_int>` **get_http_client_status** **(** **)** const
  76. Returns the current status of the underlying :ref:`HTTPClient<class_httpclient>`. See ``STATUS\_\*`` enum on :ref:`HTTPClient<class_httpclient>`.
  77. .. _class_HTTPRequest_request:
  78. - :ref:`int<class_int>` **request** **(** :ref:`String<class_string>` url, :ref:`PoolStringArray<class_poolstringarray>` custom_headers=PoolStringArray( ), :ref:`bool<class_bool>` ssl_validate_domain=true, :ref:`int<class_int>` method=0, :ref:`String<class_string>` request_data="" **)**
  79. .. _class_HTTPRequest_set_download_file:
  80. - void **set_download_file** **(** :ref:`String<class_string>` path **)**
  81. Sets the file to download into. Outputs the response body into the file if set.