Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont crash on net.pipe urls #159

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/fiskaltrust.Launcher/ProcessHost/ProcessHostPlebeian.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ private async Task StartHosting(string[] uris)
{
var url = new Uri(uri);
var hostingType = GetHostingType(url);
if (hostingType is null)
{
continue;
}

Action<WebApplication>? addEndpointsInner = hostingType switch
{
Expand All @@ -145,18 +149,18 @@ private async Task StartHosting(string[] uris)
case PackageType.SCU:
if (instanceInterface == typeof(IDESSCD))
{
await _hosting.HostService(url, hostingType, (IDESSCD)instance, addEndpoints);
await _hosting.HostService(url, hostingType.Value, (IDESSCD)instance, addEndpoints);
}
else if (instanceInterface == typeof(IITSSCD))
{
await _hosting.HostService(url, hostingType, (IITSSCD)instance, addEndpoints);
await _hosting.HostService(url, hostingType.Value, (IITSSCD)instance, addEndpoints);
}
break;
case PackageType.Queue:
await _hosting.HostService(url, hostingType, (IPOS)instance, addEndpoints);
await _hosting.HostService(url, hostingType.Value, (IPOS)instance, addEndpoints);
break;
case PackageType.Helper:
await _hosting.HostService(url, hostingType, (IHelper)instance, addEndpoints);
await _hosting.HostService(url, hostingType.Value, (IHelper)instance, addEndpoints);
break;
default:
throw new NotImplementedException();
Expand Down Expand Up @@ -201,13 +205,14 @@ private static (object, Action<WebApplication>, Type) GetScu(IServiceProvider se
throw new Exception("Could not resolve SCU with supported country. (Curently supported are DE and IT)");
}

private static HostingType GetHostingType(Uri url)
private static HostingType? GetHostingType(Uri url)
{
return url.Scheme.ToLowerInvariant() switch
{
"grpc" => HostingType.GRPC,
"rest" => HostingType.REST,
"http" or "https" or "net.tcp" => HostingType.SOAP,
"net.pipe" => null,
_ => throw new NotImplementedException($"The hosting type for the URL {url} is currently not supported.")
};
}
Expand Down
3 changes: 3 additions & 0 deletions src/fiskaltrust.Launcher/Services/HostingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ private WebApplication CreateSoapHost<T>(WebApplicationBuilder builder, Uri uri,
case "net.tcp":
builder.AddServiceEndpoint(instance.GetType(), typeof(T), CreateNetTcpBinding(), uri, null);
break;
case "net.pipe":
_logger.LogWarning("net.pipe url support will be added in an upcomming version of the launcher 2.0.");
break;
default:
throw new Exception();
};
Expand Down
Loading