From 6a24a37e8e203ff0f7700fea0a3792dd387dc401 Mon Sep 17 00:00:00 2001
From: Urban Müller
Date: Thu, 4 Apr 2019 14:46:07 +0200
Subject: warn if oversized urls are generated

---
 it_html.class | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/it_html.class b/it_html.class
index 390e8ae..65d1eaa 100644
--- a/it_html.class
+++ b/it_html.class
@@ -548,7 +548,11 @@ static function U(/* ... */)
 		$u['query'] = it_url::params($u['params'] + $params);
 	}
 
-	return $schemepart . $u['path'] . ($u['query'] ? "?" . $u['query'] : "") . ($u['fragment'] ? "#" . $u['fragment'] : "");
+	$url = $schemepart . $u['path'] . ($u['query'] ? "?" . $u['query'] : "") . ($u['fragment'] ? "#" . $u['fragment'] : "");
+	if (strlen($url) >= 2000)
+		it::error(['title' => 'url too long', 'body' => $url]);
+
+	return $url;
 }
 
 
-- 
cgit v1.2.3