Merge pull request #77 from Spmoolman/master

Added check to see if the request is empty
This commit is contained in:
Ben Merrills 2016-11-10 18:36:56 +00:00 committed by GitHub
commit 714482d903

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)
{
}