fix: server keys and destination resolution when server name contains port

This commit is contained in:
Timo Kösters 2020-09-15 21:46:10 +02:00
parent 005e00e9b1
commit dd749b8aee
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
3 changed files with 49 additions and 14 deletions

View file

@ -17,7 +17,6 @@ use ruma::{
directory::{IncomingFilter, IncomingRoomNetwork},
EventId, ServerName,
};
use serde_json::json;
use std::{
collections::BTreeMap,
convert::TryFrom,
@ -58,7 +57,13 @@ where
let actual_destination = "https://".to_owned()
+ &request_well_known(globals, &destination.as_str())
.await
.unwrap_or(destination.as_str().to_owned() + ":8448");
.unwrap_or_else(|| {
let mut destination = destination.as_str().to_owned();
if destination.find(':').is_none() {
destination += ":8448";
}
destination
});
let mut http_request = request
.try_into_http_request(&actual_destination, Some(""))