Commit adec6d7b authored by Thomas's avatar Thomas
Browse files

Return error status if invalid request is received.

parent 3545f8c3
...@@ -28,14 +28,15 @@ namespace pEp.DPE ...@@ -28,14 +28,15 @@ namespace pEp.DPE
if (context.Request.HttpMethod != "POST") if (context.Request.HttpMethod != "POST")
{ {
Log.Warning("Process request: Ignoring request of type " + context.Request.HttpMethod); Log.Warning("Process request: Ignoring request of type " + context.Request.HttpMethod);
return;
} }
string request = null; string request = null;
try try
{ {
using (var stream = context.Request.InputStream) using (Stream stream = context.Request.InputStream)
using (var sr = new StreamReader(stream)) using (StreamReader sr = new StreamReader(stream))
{ {
request = sr.ReadToEnd(); request = sr.ReadToEnd();
} }
...@@ -43,6 +44,8 @@ namespace pEp.DPE ...@@ -43,6 +44,8 @@ namespace pEp.DPE
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("ProcessRequest: Error getting request. " + ex.ToString()); Log.Error("ProcessRequest: Error getting request. " + ex.ToString());
context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
context.Response.Close();
return; return;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment