Working Code

Create a Plugin with this code, for Working Sammi Socket Connection.
This commit is contained in:
Mario Steele 2025-04-30 04:09:20 -05:00
parent 03c0c804b0
commit eacd8d72af
5 changed files with 33 additions and 5 deletions

View file

@ -90,7 +90,7 @@ func _send_request(peer: StreamPeer) -> void:
if ssl:
proto = "https"
var request_str := "GET %s://%s:%d%s HTTP/1.1\r\n" % [proto, host, port, query]
var request_str := "GET %s HTTP/1.1\r\n" % [query]
if (ssl and port == 443) or (not ssl and port == 80):
request_str += "Host: %s\r\n" % host
else:
@ -108,7 +108,7 @@ func _send_request(peer: StreamPeer) -> void:
]
request_str += "Accept: %s\r\n\r\n" % accept
print_rich("[color=cyan]Request Headers:",request_str,"[/color]--EOH--")
print_rich("[color=cyan]Request Headers:\n",request_str,"[/color]--EOH--")
peer.put_data(request_str.to_utf8_buffer())
func _handle_response(peer: StreamPeer) -> void: