fix(sender,receiver): fixed bug with sender and receiver trying to connect to https with http address

to fix this bug i had to change the way a user can support a relay
address. the user can no longer provide the address in the form
"0.0.0.0:8000" instead he has to use "ws://0.0.0.0:8000" or
"wss://0.0.0.0:8000" the switch between ws/http or wss/https is handle
by the program
This commit is contained in:
Patryk Hegenberg 2024-05-02 21:22:17 +02:00
parent d098ea41f6
commit 42e4a63a6a
7 changed files with 25 additions and 13 deletions

View file

@ -1,5 +1,5 @@
use crate::sender::http_client::send_info;
use crate::sender::util::hash_random_name;
use crate::sender::util::{hash_random_name, replace_protocol};
use crate::shared::{
packets::{
list_packet, packet::Value, ChunkPacket, HandshakePacket, HandshakeResponsePacket,
@ -135,7 +135,7 @@ fn on_create_room(
let send_url = url.to_string();
let h_name = hash_name.to_string();
let server_url = String::from("http://") + relay.as_str();
let server_url = replace_protocol(relay.as_str());
let res = std::thread::spawn(move || {
tokio::runtime::Builder::new_current_thread()
.enable_all()