Http Request node , wont work 🥀

Godot Version

4.6

Question

i an trying to download an image and show it by godot . for first and test ; i wrote this code ; but it pushes the error :

E 0:00:30:094 _do_handshake: TLS handshake error: -9984
<C++ Source> modules/mbedtls/stream_peer_mbedtls.cpp:88 @ _do_handshake()

and the program just prints an empty Array . ( [ ] )

the code :

extends Control

var url = "http://s19.picofile.com/file/8436956218/10622479_860.jpg"

func move ():
	get_tree().create_tween().tween_property($CPUParticles2D,"position",Vector2(79,99),2)
	await get_tree().create_timer(2).timeout
	get_tree().create_tween().tween_property($CPUParticles2D,"position",Vector2(1046,99),2)
	await get_tree().create_timer(2).timeout
	get_tree().create_tween().tween_property($CPUParticles2D,"position",Vector2(1046,572),2)
	await get_tree().create_timer(2).timeout
	get_tree().create_tween().tween_property($CPUParticles2D,"position",Vector2(79,572),2)
	await get_tree().create_timer(2).timeout
	move()
func _ready() -> void:
	move()
	$HTTPRequest.request(url)


func _on_http_request_request_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray) -> void:
	print(body)

the move function is not important , it is for an particle moving effect .

please help me

Based on this, it seems like Godot cannot find your PCs default certificate storage.
The error you’re seeing usually means that Godot can’t make a secure connection, since it failed to verify the server’s certificate.

If you’re not planning to ship this game, you can temporarily get around this by creating an unsafe client, which should bypass this, like so:

var client_options = TLSOptions.client_unsafe()
$HTTPRequest.set_tls_options(client_options)
$HTTPRequest.request(url)

However, make sure you fix this issue before you release your game.

What OS, and which version of said OS are you running?

windows 10

And which patch? Since for all I know, you could be running a Windows 10 version from 2017 and I would not be surprised if that didn’t work right.

Also another test you can do, are you able to open that same URL in your browser with no issues? Do you see the HTTPS cerfiticate in your URL when you open it, or does it say “Not Secure” at the top?

and i want to export the game for android

yes i tried , and it has no problem and it is safe

By the way, I know this is not your question, but your move() code is incredibly inefficient and WILL cause issues in the future.
You can simplify it by doing the following:

func move():
	var tween = get_tree().create_tween().set_loops()
	tween.tween_property($CPUParticles2D, "position", Vector2(79, 99), 2)
	tween.tween_property($CPUParticles2D, "position", Vector2(1046, 99), 2)
	tween.tween_property($CPUParticles2D, "position", Vector2(1046, 572), 2)
	tween.tween_property($CPUParticles2D, "position", Vector2(79, 572), 2)

And then you ONLY have to call the function once in your ready function, and never again.

good ; thanks :rose::moai:

this is the version of my windows :

Edition Windows 10 Enterprise
Version 22H2
Installed on ‎8/‎25/‎2020
OS build 19045.3448
Experience Windows Feature Experience Pack 1000.19044.1000.0

At this point I don’t think this is a Godot specific issue, as I was unable to reproduce it, and it seems like the website itself works just fine where the image is hosted.
If you try another image, lets say, this one:

https://picsum.photos/200/300.jpg

Does it work or gives you the same error message?

yes ; it works ; thanks . is this picsum site an picture uploader ?

It’s a test image website, but if that one works for you, then it seems like an issue with the website somehow. I recommend trying to upload your image somewhere else. I don’t know any good ones unfortunately.

thanks buddy ; god bless you for helping :rose:

no need to you upload it ; i will find a good uploader myslef .

thanks

1 Like