From 2182feb052fd903b27e5d586480956bd6342b4ad Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Wed, 30 Jul 2014 11:46:54 +0200 Subject: [PATCH] Added support for probing HTTP, enough to tell browsers to stop calling. --- src/core/probe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/probe.c b/src/core/probe.c index dfed19e..b27d86a 100644 --- a/src/core/probe.c +++ b/src/core/probe.c @@ -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 &&