Added check to see if the request is empty

This commit is contained in:
spmoolman 2016-11-10 10:07:08 +02:00
parent 262626ffe5
commit 2c2d8c808a

View file

@ -61,6 +61,11 @@ namespace AsterNET.FastAGI
var reader = new AGIReader(socket);
var writer = new AGIWriter(socket);
AGIRequest request = reader.ReadRequest();
//Added check for when the request is empty
//eg. telnet to the service
if (request.Request.Count > 0)
{
var channel = new AGIChannel(writer, reader, _SC511_CAUSES_EXCEPTION, _SCHANGUP_CAUSES_EXCEPTION);
AGIScript script = mappingStrategy.DetermineScript(request);
Thread.SetData(_channel, channel);
@ -85,6 +90,14 @@ namespace AsterNET.FastAGI
#endif
}
}
else
{
var error = "A connection was made with no requests";
#if LOGGER
logger.Error(error);
#endif
}
}
catch (AGIHangupException)
{
}