summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Worker/HttpServer.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2018-06-10 13:34:39 +0100
committersr55 <[email protected]>2018-06-10 13:34:39 +0100
commit4a6a1bf9702977b1ea89a516c02bef64fb1b6e98 (patch)
treee6ffc90d8f81cc60df67d2741dc7580dc814b207 /win/CS/HandBrake.Worker/HttpServer.cs
parent0bbe6e4bde56799acd6c8096c04f80ca3aa27fb0 (diff)
WinGui: HandBrake.Worker tidyup.
Diffstat (limited to 'win/CS/HandBrake.Worker/HttpServer.cs')
-rw-r--r--win/CS/HandBrake.Worker/HttpServer.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/win/CS/HandBrake.Worker/HttpServer.cs b/win/CS/HandBrake.Worker/HttpServer.cs
index 4f23fa190..a920a85b3 100644
--- a/win/CS/HandBrake.Worker/HttpServer.cs
+++ b/win/CS/HandBrake.Worker/HttpServer.cs
@@ -57,13 +57,16 @@ namespace HandBrake.Worker
(c) =>
{
var context = c as HttpListenerContext;
+ if (context == null)
+ {
+ return;
+ }
+
try
{
- string requestType = context.Request.HttpMethod;
string path = context.Request.RawUrl.TrimStart('/');
- Func<HttpListenerRequest, string> actionToPerform;
- if (apiHandlers.TryGetValue(path, out actionToPerform))
+ if (this.apiHandlers.TryGetValue(path, out var actionToPerform))
{
string rstr = actionToPerform(context.Request);
byte[] buf = Encoding.UTF8.GetBytes(rstr);
@@ -84,7 +87,6 @@ namespace HandBrake.Worker
}
finally
{
- // always close the stream
context?.Response.OutputStream.Close();
}
},