From 8dc76c9f0397c1cbf888dd3ed65eab606cdfd6a8 Mon Sep 17 00:00:00 2001 From: Mhonarc archives guy Date: Thu, 5 Jan 2012 13:41:14 +0000 Subject: [PATCH] Return error code 404 in certain cases --- archives/html/msgtxt.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/archives/html/msgtxt.php b/archives/html/msgtxt.php index 86f7a9d3..639c1dfd 100644 --- a/archives/html/msgtxt.php +++ b/archives/html/msgtxt.php @@ -7,6 +7,12 @@ $parts = split("@", $id, 2); header("Content-type: text/plain"); +if (strlen($parts[1]) < 4 || strlen($parts[0]) < 4) { + header("Status: 404 probably unindexed message"); + print "maybe this message is valid, but we don't have it\n"; + exit; +} + $dir = substr($parts[1], 0, 2) . "/" . substr($parts[1], 2, 2) . @@ -20,6 +26,7 @@ $dir = substr($parts[1], 0, 2) . $filename= $_SERVER['DOCUMENT_ROOT'] . "/../messages/" . $dir . "/" . $id; if (!file_exists($filename)) { + header("Status: 404 No such Message-Id"); print "No message with Message-Id " . $_GET["id"] ." found\n"; exit; } -- 2.39.5