cancel keepalive if http status not OK, this maybe a bit 2 hardm but ok for now
parent
7f2cfe734b
commit
80de74e127
|
@ -246,6 +246,13 @@ namespace OSHttpServer
|
||||||
if (m_headers["Server"] == null)
|
if (m_headers["Server"] == null)
|
||||||
sb.Append("Server: OSWebServer\r\n");
|
sb.Append("Server: OSWebServer\r\n");
|
||||||
|
|
||||||
|
if(Status != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
sb.Append("Connection: close\r\n");
|
||||||
|
Connection = ConnectionType.Close;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
int keepaliveS = m_context.TimeoutKeepAlive / 1000;
|
int keepaliveS = m_context.TimeoutKeepAlive / 1000;
|
||||||
if (Connection == ConnectionType.KeepAlive && keepaliveS > 0 && m_context.MaxRequests > 0)
|
if (Connection == ConnectionType.KeepAlive && keepaliveS > 0 && m_context.MaxRequests > 0)
|
||||||
{
|
{
|
||||||
|
@ -253,7 +260,11 @@ namespace OSHttpServer
|
||||||
sb.Append("Connection: Keep-Alive\r\n");
|
sb.Append("Connection: Keep-Alive\r\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sb.Append("Connection: close\r\n");
|
sb.Append("Connection: close\r\n");
|
||||||
|
Connection = ConnectionType.Close;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_headers["Connection"] != null)
|
if (m_headers["Connection"] != null)
|
||||||
m_headers["Connection"] = null;
|
m_headers["Connection"] = null;
|
||||||
|
|
Loading…
Reference in New Issue