tools: ignore URL query string in nfd-status-http-server

Change-Id: I5e071b7f036a0ef4e9a6e8b6a1eaf637aa5ad92e
This commit is contained in:
Davide Pesavento
2018-02-24 23:55:57 -05:00
parent 9e5b8af1f5
commit b922c8891c
+4 -2
View File
@@ -27,15 +27,17 @@ NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
from http.server import HTTPServer, SimpleHTTPRequestHandler
from socketserver import ThreadingMixIn
from urllib.parse import urlsplit
import argparse, ipaddress, os, socket, subprocess
class NfdStatusHandler(SimpleHTTPRequestHandler):
""" The handler class to handle requests """
def do_GET(self):
if self.path == "/":
path = urlsplit(self.path).path
if path == "/":
self.__serveReport()
elif self.path == "/robots.txt" and self.server.allowRobots:
elif path == "/robots.txt" and self.server.allowRobots:
self.send_error(404)
else:
super().do_GET()