[backend/webfinger] Catch errors in GetWebFingerTemplateFromHostMetaAsync

This commit is contained in:
Laura Hausmann 2024-02-07 23:11:27 +01:00
parent 6ed944156f
commit b5bfc9a080
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -72,7 +72,9 @@ public class WebFingerService(HttpClient client, HttpRequestService httpRqSvc) {
}
private async Task<string?> GetWebFingerTemplateFromHostMetaAsync(string hostMetaUrl) {
using var res = await client.SendAsync(httpRqSvc.Get(hostMetaUrl, ["application/xrd+xml"]), HttpCompletionOption.ResponseHeadersRead);
try {
using var res = await client.SendAsync(httpRqSvc.Get(hostMetaUrl, ["application/xrd+xml"]),
HttpCompletionOption.ResponseHeadersRead);
using var stream = await res.Content.ReadAsStreamAsync();
var xml = new XmlDocument();
@ -89,4 +91,8 @@ public class WebFingerService(HttpClient client, HttpRequestService httpRqSvc) {
return null;
}
catch {
return null;
}
}
}