Added support for probing HTTP, enough to tell browsers to stop calling.

This commit is contained in:
Jan Vidar Krey 2014-07-30 11:46:54 +02:00
parent 48b76f7bd1
commit 2182feb052
1 changed files with 9 additions and 0 deletions

View File

@ -71,6 +71,15 @@ static void probe_net_event(struct net_connection* con, int events, void *arg)
probe_destroy(probe);
return;
}
else if ((memcmp(probe_recvbuf, "GET ", 4) == 0) ||
(memcmp(probe_recvbuf, "POST", 4) == 0) ||
(memcmp(probe_recvbuf, "HEAD", 4) == 0))
{
/* Looks like HTTP - Not supported, but we log it. */
LOG_TRACE("Probed HTTP connection. Not supported closing connection (%s)", ip_convert_to_string(&probe->addr));
const char* buf = "501 Not implemented\r\n\r\n";
net_con_send(con, buf, strlen(buf));
}
#ifdef SSL_SUPPORT
else if (bytes >= 11 &&
probe_recvbuf[0] == 22 &&