class_httprequest.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/HTTPRequest.xml.
  6. .. _class_HTTPRequest:
  7. HTTPRequest
  8. ===========
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A node with the ability to send HTTP(S) requests.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A node with the ability to send HTTP requests. Uses :ref:`HTTPClient<class_HTTPClient>` internally.
  15. Can be used to make HTTP requests, i.e. download or upload files or web content via HTTP.
  16. \ **Warning:** See the notes and warnings on :ref:`HTTPClient<class_HTTPClient>` for limitations, especially regarding SSL security.
  17. \ **Example of contacting a REST API and printing one of its returned fields:**\
  18. ::
  19. func _ready():
  20. # Create an HTTP request node and connect its completion signal.
  21. var http_request = HTTPRequest.new()
  22. add_child(http_request)
  23. http_request.connect("request_completed", self, "_http_request_completed")
  24. # Perform a GET request. The URL below returns JSON as of writing.
  25. var error = http_request.request("https://httpbin.org/get")
  26. if error != OK:
  27. push_error("An error occurred in the HTTP request.")
  28. # Perform a POST request. The URL below returns JSON as of writing.
  29. # Note: Don't make simultaneous requests using a single HTTPRequest node.
  30. # The snippet below is provided for reference only.
  31. var body = to_json({"name": "Godette"})
  32. error = http_request.request("https://httpbin.org/post", [], true, HTTPClient.METHOD_POST, body)
  33. if error != OK:
  34. push_error("An error occurred in the HTTP request.")
  35. # Called when the HTTP request is completed.
  36. func _http_request_completed(result, response_code, headers, body):
  37. var response = parse_json(body.get_string_from_utf8())
  38. # Will print the user agent string used by the HTTPRequest node (as recognized by httpbin.org).
  39. print(response.headers["User-Agent"])
  40. \ **Example of loading and displaying an image using HTTPRequest:**\
  41. ::
  42. func _ready():
  43. # Create an HTTP request node and connect its completion signal.
  44. var http_request = HTTPRequest.new()
  45. add_child(http_request)
  46. http_request.connect("request_completed", self, "_http_request_completed")
  47. # Perform the HTTP request. The URL below returns a PNG image as of writing.
  48. var error = http_request.request("https://via.placeholder.com/512")
  49. if error != OK:
  50. push_error("An error occurred in the HTTP request.")
  51. # Called when the HTTP request is completed.
  52. func _http_request_completed(result, response_code, headers, body):
  53. var image = Image.new()
  54. var error = image.load_png_from_buffer(body)
  55. if error != OK:
  56. push_error("Couldn't load the image.")
  57. var texture = ImageTexture.new()
  58. texture.create_from_image(image)
  59. # Display the image in a TextureRect node.
  60. var texture_rect = TextureRect.new()
  61. add_child(texture_rect)
  62. texture_rect.texture = texture
  63. .. rst-class:: classref-introduction-group
  64. Tutorials
  65. ---------
  66. - :doc:`../tutorials/networking/http_request_class`
  67. - :doc:`../tutorials/networking/ssl_certificates`
  68. .. rst-class:: classref-reftable-group
  69. Properties
  70. ----------
  71. .. table::
  72. :widths: auto
  73. +-----------------------------+----------------------------------------------------------------------------+-----------+
  74. | :ref:`int<class_int>` | :ref:`body_size_limit<class_HTTPRequest_property_body_size_limit>` | ``-1`` |
  75. +-----------------------------+----------------------------------------------------------------------------+-----------+
  76. | :ref:`int<class_int>` | :ref:`download_chunk_size<class_HTTPRequest_property_download_chunk_size>` | ``65536`` |
  77. +-----------------------------+----------------------------------------------------------------------------+-----------+
  78. | :ref:`String<class_String>` | :ref:`download_file<class_HTTPRequest_property_download_file>` | ``""`` |
  79. +-----------------------------+----------------------------------------------------------------------------+-----------+
  80. | :ref:`int<class_int>` | :ref:`max_redirects<class_HTTPRequest_property_max_redirects>` | ``8`` |
  81. +-----------------------------+----------------------------------------------------------------------------+-----------+
  82. | :ref:`float<class_float>` | :ref:`timeout<class_HTTPRequest_property_timeout>` | ``0.0`` |
  83. +-----------------------------+----------------------------------------------------------------------------+-----------+
  84. | :ref:`bool<class_bool>` | :ref:`use_threads<class_HTTPRequest_property_use_threads>` | ``false`` |
  85. +-----------------------------+----------------------------------------------------------------------------+-----------+
  86. .. rst-class:: classref-reftable-group
  87. Methods
  88. -------
  89. .. table::
  90. :widths: auto
  91. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | void | :ref:`cancel_request<class_HTTPRequest_method_cancel_request>` **(** **)** |
  93. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`int<class_int>` | :ref:`get_body_size<class_HTTPRequest_method_get_body_size>` **(** **)** |const| |
  95. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`int<class_int>` | :ref:`get_downloaded_bytes<class_HTTPRequest_method_get_downloaded_bytes>` **(** **)** |const| |
  97. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`Status<enum_HTTPClient_Status>` | :ref:`get_http_client_status<class_HTTPRequest_method_get_http_client_status>` **(** **)** |const| |
  99. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`request<class_HTTPRequest_method_request>` **(** :ref:`String<class_String>` url, :ref:`PoolStringArray<class_PoolStringArray>` custom_headers=PoolStringArray( ), :ref:`bool<class_bool>` ssl_validate_domain=true, :ref:`Method<enum_HTTPClient_Method>` method=0, :ref:`String<class_String>` request_data="" **)** |
  101. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`request_raw<class_HTTPRequest_method_request_raw>` **(** :ref:`String<class_String>` url, :ref:`PoolStringArray<class_PoolStringArray>` custom_headers=PoolStringArray( ), :ref:`bool<class_bool>` ssl_validate_domain=true, :ref:`Method<enum_HTTPClient_Method>` method=0, :ref:`PoolByteArray<class_PoolByteArray>` request_data_raw=PoolByteArray( ) **)** |
  103. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | void | :ref:`set_http_proxy<class_HTTPRequest_method_set_http_proxy>` **(** :ref:`String<class_String>` host, :ref:`int<class_int>` port **)** |
  105. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | void | :ref:`set_https_proxy<class_HTTPRequest_method_set_https_proxy>` **(** :ref:`String<class_String>` host, :ref:`int<class_int>` port **)** |
  107. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. .. rst-class:: classref-section-separator
  109. ----
  110. .. rst-class:: classref-descriptions-group
  111. Signals
  112. -------
  113. .. _class_HTTPRequest_signal_request_completed:
  114. .. rst-class:: classref-signal
  115. **request_completed** **(** :ref:`int<class_int>` result, :ref:`int<class_int>` response_code, :ref:`PoolStringArray<class_PoolStringArray>` headers, :ref:`PoolByteArray<class_PoolByteArray>` body **)**
  116. Emitted when a request is completed.
  117. .. rst-class:: classref-section-separator
  118. ----
  119. .. rst-class:: classref-descriptions-group
  120. Enumerations
  121. ------------
  122. .. _enum_HTTPRequest_Result:
  123. .. rst-class:: classref-enumeration
  124. enum **Result**:
  125. .. _class_HTTPRequest_constant_RESULT_SUCCESS:
  126. .. rst-class:: classref-enumeration-constant
  127. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_SUCCESS** = ``0``
  128. Request successful.
  129. .. _class_HTTPRequest_constant_RESULT_CHUNKED_BODY_SIZE_MISMATCH:
  130. .. rst-class:: classref-enumeration-constant
  131. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_CHUNKED_BODY_SIZE_MISMATCH** = ``1``
  132. .. _class_HTTPRequest_constant_RESULT_CANT_CONNECT:
  133. .. rst-class:: classref-enumeration-constant
  134. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_CANT_CONNECT** = ``2``
  135. Request failed while connecting.
  136. .. _class_HTTPRequest_constant_RESULT_CANT_RESOLVE:
  137. .. rst-class:: classref-enumeration-constant
  138. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_CANT_RESOLVE** = ``3``
  139. Request failed while resolving.
  140. .. _class_HTTPRequest_constant_RESULT_CONNECTION_ERROR:
  141. .. rst-class:: classref-enumeration-constant
  142. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_CONNECTION_ERROR** = ``4``
  143. Request failed due to connection (read/write) error.
  144. .. _class_HTTPRequest_constant_RESULT_SSL_HANDSHAKE_ERROR:
  145. .. rst-class:: classref-enumeration-constant
  146. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_SSL_HANDSHAKE_ERROR** = ``5``
  147. Request failed on SSL handshake.
  148. .. _class_HTTPRequest_constant_RESULT_NO_RESPONSE:
  149. .. rst-class:: classref-enumeration-constant
  150. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_NO_RESPONSE** = ``6``
  151. Request does not have a response (yet).
  152. .. _class_HTTPRequest_constant_RESULT_BODY_SIZE_LIMIT_EXCEEDED:
  153. .. rst-class:: classref-enumeration-constant
  154. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_BODY_SIZE_LIMIT_EXCEEDED** = ``7``
  155. Request exceeded its maximum size limit, see :ref:`body_size_limit<class_HTTPRequest_property_body_size_limit>`.
  156. .. _class_HTTPRequest_constant_RESULT_REQUEST_FAILED:
  157. .. rst-class:: classref-enumeration-constant
  158. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_REQUEST_FAILED** = ``8``
  159. Request failed (currently unused).
  160. .. _class_HTTPRequest_constant_RESULT_DOWNLOAD_FILE_CANT_OPEN:
  161. .. rst-class:: classref-enumeration-constant
  162. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_DOWNLOAD_FILE_CANT_OPEN** = ``9``
  163. HTTPRequest couldn't open the download file.
  164. .. _class_HTTPRequest_constant_RESULT_DOWNLOAD_FILE_WRITE_ERROR:
  165. .. rst-class:: classref-enumeration-constant
  166. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_DOWNLOAD_FILE_WRITE_ERROR** = ``10``
  167. HTTPRequest couldn't write to the download file.
  168. .. _class_HTTPRequest_constant_RESULT_REDIRECT_LIMIT_REACHED:
  169. .. rst-class:: classref-enumeration-constant
  170. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_REDIRECT_LIMIT_REACHED** = ``11``
  171. Request reached its maximum redirect limit, see :ref:`max_redirects<class_HTTPRequest_property_max_redirects>`.
  172. .. _class_HTTPRequest_constant_RESULT_TIMEOUT:
  173. .. rst-class:: classref-enumeration-constant
  174. :ref:`Result<enum_HTTPRequest_Result>` **RESULT_TIMEOUT** = ``12``
  175. .. rst-class:: classref-section-separator
  176. ----
  177. .. rst-class:: classref-descriptions-group
  178. Property Descriptions
  179. ---------------------
  180. .. _class_HTTPRequest_property_body_size_limit:
  181. .. rst-class:: classref-property
  182. :ref:`int<class_int>` **body_size_limit** = ``-1``
  183. .. rst-class:: classref-property-setget
  184. - void **set_body_size_limit** **(** :ref:`int<class_int>` value **)**
  185. - :ref:`int<class_int>` **get_body_size_limit** **(** **)**
  186. Maximum allowed size for response bodies (``-1`` means no limit). When only small files are expected, this can be used to prevent disallow receiving files that are too large, preventing potential denial of service attacks.
  187. .. rst-class:: classref-item-separator
  188. ----
  189. .. _class_HTTPRequest_property_download_chunk_size:
  190. .. rst-class:: classref-property
  191. :ref:`int<class_int>` **download_chunk_size** = ``65536``
  192. .. rst-class:: classref-property-setget
  193. - void **set_download_chunk_size** **(** :ref:`int<class_int>` value **)**
  194. - :ref:`int<class_int>` **get_download_chunk_size** **(** **)**
  195. The size of the buffer used and maximum bytes to read per iteration. See :ref:`HTTPClient.read_chunk_size<class_HTTPClient_property_read_chunk_size>`.
  196. Set this to a lower value (e.g. 4096 for 4 KiB) when downloading small files to decrease memory usage at the cost of download speeds.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_HTTPRequest_property_download_file:
  200. .. rst-class:: classref-property
  201. :ref:`String<class_String>` **download_file** = ``""``
  202. .. rst-class:: classref-property-setget
  203. - void **set_download_file** **(** :ref:`String<class_String>` value **)**
  204. - :ref:`String<class_String>` **get_download_file** **(** **)**
  205. The file to download into. If set to a non-empty string, the request output will be written to the file located at the path. If a file already exists at the specified location, it will be overwritten as soon as body data begins to be received.
  206. \ **Note:** Folders are not automatically created when the file is created. If :ref:`download_file<class_HTTPRequest_property_download_file>` points to a subfolder, it's recommended to create the necessary folders beforehand using :ref:`Directory.make_dir_recursive<class_Directory_method_make_dir_recursive>` to ensure the file can be written.
  207. .. rst-class:: classref-item-separator
  208. ----
  209. .. _class_HTTPRequest_property_max_redirects:
  210. .. rst-class:: classref-property
  211. :ref:`int<class_int>` **max_redirects** = ``8``
  212. .. rst-class:: classref-property-setget
  213. - void **set_max_redirects** **(** :ref:`int<class_int>` value **)**
  214. - :ref:`int<class_int>` **get_max_redirects** **(** **)**
  215. Maximum number of allowed redirects. This is used to prevent endless redirect loops.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_HTTPRequest_property_timeout:
  219. .. rst-class:: classref-property
  220. :ref:`float<class_float>` **timeout** = ``0.0``
  221. .. rst-class:: classref-property-setget
  222. - void **set_timeout** **(** :ref:`float<class_float>` value **)**
  223. - :ref:`float<class_float>` **get_timeout** **(** **)**
  224. If set to a value greater than ``0.0`` before the request starts, the HTTP request will time out after ``timeout`` seconds have passed and the request is not *completed* yet. For small HTTP requests such as REST API usage, set :ref:`timeout<class_HTTPRequest_property_timeout>` to a value between ``10.0`` and ``30.0`` to prevent the application from getting stuck if the request fails to get a response in a timely manner. For file downloads, leave this to ``0.0`` to prevent the download from failing if it takes too much time.
  225. .. rst-class:: classref-item-separator
  226. ----
  227. .. _class_HTTPRequest_property_use_threads:
  228. .. rst-class:: classref-property
  229. :ref:`bool<class_bool>` **use_threads** = ``false``
  230. .. rst-class:: classref-property-setget
  231. - void **set_use_threads** **(** :ref:`bool<class_bool>` value **)**
  232. - :ref:`bool<class_bool>` **is_using_threads** **(** **)**
  233. If ``true``, multithreading is used to improve performance.
  234. .. rst-class:: classref-section-separator
  235. ----
  236. .. rst-class:: classref-descriptions-group
  237. Method Descriptions
  238. -------------------
  239. .. _class_HTTPRequest_method_cancel_request:
  240. .. rst-class:: classref-method
  241. void **cancel_request** **(** **)**
  242. Cancels the current request.
  243. .. rst-class:: classref-item-separator
  244. ----
  245. .. _class_HTTPRequest_method_get_body_size:
  246. .. rst-class:: classref-method
  247. :ref:`int<class_int>` **get_body_size** **(** **)** |const|
  248. Returns the response body length.
  249. \ **Note:** Some Web servers may not send a body length. In this case, the value returned will be ``-1``. If using chunked transfer encoding, the body length will also be ``-1``.
  250. .. rst-class:: classref-item-separator
  251. ----
  252. .. _class_HTTPRequest_method_get_downloaded_bytes:
  253. .. rst-class:: classref-method
  254. :ref:`int<class_int>` **get_downloaded_bytes** **(** **)** |const|
  255. Returns the amount of bytes this HTTPRequest downloaded.
  256. .. rst-class:: classref-item-separator
  257. ----
  258. .. _class_HTTPRequest_method_get_http_client_status:
  259. .. rst-class:: classref-method
  260. :ref:`Status<enum_HTTPClient_Status>` **get_http_client_status** **(** **)** |const|
  261. Returns the current status of the underlying :ref:`HTTPClient<class_HTTPClient>`. See :ref:`Status<enum_HTTPClient_Status>`.
  262. .. rst-class:: classref-item-separator
  263. ----
  264. .. _class_HTTPRequest_method_request:
  265. .. rst-class:: classref-method
  266. :ref:`Error<enum_@GlobalScope_Error>` **request** **(** :ref:`String<class_String>` url, :ref:`PoolStringArray<class_PoolStringArray>` custom_headers=PoolStringArray( ), :ref:`bool<class_bool>` ssl_validate_domain=true, :ref:`Method<enum_HTTPClient_Method>` method=0, :ref:`String<class_String>` request_data="" **)**
  267. Creates request on the underlying :ref:`HTTPClient<class_HTTPClient>`. If there is no configuration errors, it tries to connect using :ref:`HTTPClient.connect_to_host<class_HTTPClient_method_connect_to_host>` and passes parameters onto :ref:`HTTPClient.request<class_HTTPClient_method_request>`.
  268. Returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` if request is successfully created. (Does not imply that the server has responded), :ref:`@GlobalScope.ERR_UNCONFIGURED<class_@GlobalScope_constant_ERR_UNCONFIGURED>` if not in the tree, :ref:`@GlobalScope.ERR_BUSY<class_@GlobalScope_constant_ERR_BUSY>` if still processing previous request, :ref:`@GlobalScope.ERR_INVALID_PARAMETER<class_@GlobalScope_constant_ERR_INVALID_PARAMETER>` if given string is not a valid URL format, or :ref:`@GlobalScope.ERR_CANT_CONNECT<class_@GlobalScope_constant_ERR_CANT_CONNECT>` if not using thread and the :ref:`HTTPClient<class_HTTPClient>` cannot connect to host.
  269. \ **Note:** When ``method`` is :ref:`HTTPClient.METHOD_GET<class_HTTPClient_constant_METHOD_GET>`, the payload sent via ``request_data`` might be ignored by the server or even cause the server to reject the request (check `RFC 7231 section 4.3.1 <https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1>`__ for more details). As a workaround, you can send data as a query string in the URL. See :ref:`String.http_escape<class_String_method_http_escape>` for an example.
  270. .. rst-class:: classref-item-separator
  271. ----
  272. .. _class_HTTPRequest_method_request_raw:
  273. .. rst-class:: classref-method
  274. :ref:`Error<enum_@GlobalScope_Error>` **request_raw** **(** :ref:`String<class_String>` url, :ref:`PoolStringArray<class_PoolStringArray>` custom_headers=PoolStringArray( ), :ref:`bool<class_bool>` ssl_validate_domain=true, :ref:`Method<enum_HTTPClient_Method>` method=0, :ref:`PoolByteArray<class_PoolByteArray>` request_data_raw=PoolByteArray( ) **)**
  275. Creates request on the underlying :ref:`HTTPClient<class_HTTPClient>` using a raw array of bytes for the request body. If there is no configuration errors, it tries to connect using :ref:`HTTPClient.connect_to_host<class_HTTPClient_method_connect_to_host>` and passes parameters onto :ref:`HTTPClient.request<class_HTTPClient_method_request>`.
  276. Returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` if request is successfully created. (Does not imply that the server has responded), :ref:`@GlobalScope.ERR_UNCONFIGURED<class_@GlobalScope_constant_ERR_UNCONFIGURED>` if not in the tree, :ref:`@GlobalScope.ERR_BUSY<class_@GlobalScope_constant_ERR_BUSY>` if still processing previous request, :ref:`@GlobalScope.ERR_INVALID_PARAMETER<class_@GlobalScope_constant_ERR_INVALID_PARAMETER>` if given string is not a valid URL format, or :ref:`@GlobalScope.ERR_CANT_CONNECT<class_@GlobalScope_constant_ERR_CANT_CONNECT>` if not using thread and the :ref:`HTTPClient<class_HTTPClient>` cannot connect to host.
  277. .. rst-class:: classref-item-separator
  278. ----
  279. .. _class_HTTPRequest_method_set_http_proxy:
  280. .. rst-class:: classref-method
  281. void **set_http_proxy** **(** :ref:`String<class_String>` host, :ref:`int<class_int>` port **)**
  282. Sets the proxy server for HTTP requests.
  283. The proxy server is unset if ``host`` is empty or ``port`` is -1.
  284. .. rst-class:: classref-item-separator
  285. ----
  286. .. _class_HTTPRequest_method_set_https_proxy:
  287. .. rst-class:: classref-method
  288. void **set_https_proxy** **(** :ref:`String<class_String>` host, :ref:`int<class_int>` port **)**
  289. Sets the proxy server for HTTPS requests.
  290. The proxy server is unset if ``host`` is empty or ``port`` is -1.
  291. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  292. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  293. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  294. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`