From 25e0bad0a5e3c4c601cc5aed9387d85c20f5ff45 Mon Sep 17 00:00:00 2001 From: Vasiliy Dmitriev Date: Sat, 10 Apr 2021 09:21:37 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BF=D0=BE=D0=BD=D1=8F=D1=82=D0=BD=D1=8B=D0=B5?= =?UTF-8?q?=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BE=D0=B1=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf.d/crserver-filter.conf | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/conf.d/crserver-filter.conf b/conf.d/crserver-filter.conf index ab767ec..4466ece 100644 --- a/conf.d/crserver-filter.conf +++ b/conf.d/crserver-filter.conf @@ -33,8 +33,10 @@ server { -- проверка на пустой комментарий if message == nil then - ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR - ngx.exit(ngx.HTTP_OK) + ngx.status = ngx.HTTP_BAD_REQUEST + ngx.header.content_type = 'text/plain; charset=utf-8' + ngx.say("ОТСУТСТВУЕТ КОММЕНТАРИЙ") + ngx.exit(ngx.HTTP_BAD_REQUEST) end -- вот здесь можно написать свои проверки @@ -44,8 +46,10 @@ server { if (five_digits ~= nil or no_task ~= nil) and double_n ~= nil then return req else - ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR - ngx.exit(ngx.HTTP_OK) + ngx.status = ngx.HTTP_BAD_REQUEST + ngx.header.content_type = 'text/plain; charset=utf-8' + ngx.say("НЕВЕРНЫЙ ФОРМАТ КОММЕНТАРИЯ, КОММЕНТАРИЙ ДОЛЖЕН СОДЕРЖАТЬ #12345, ГДЕ 12345 - ЭТО НОМЕР ЗАДАЧИ") + ngx.exit(ngx.HTTP_BAD_REQUEST) end } From 9b85330b77180c1d1852e2873daa59cca059ac5a Mon Sep 17 00:00:00 2001 From: Dima Date: Wed, 14 Apr 2021 22:23:39 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D1=83=D0=BB=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D1=81?= =?UTF-8?q?=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf.d/crserver-filter.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.d/crserver-filter.conf b/conf.d/crserver-filter.conf index aebe425..e32cd23 100644 --- a/conf.d/crserver-filter.conf +++ b/conf.d/crserver-filter.conf @@ -66,7 +66,7 @@ server { ngx.say("НЕВЕРНЫЙ ФОРМАТ КОММЕНТАРИЯ") ngx.say("комментарий должен:") ngx.say("- начинаться на #12345 (где 12345 - номер задачи) или на #нетзадачи") - ngx.say("- содержать два идущих подряд переноса строки") + ngx.say("- содержать пустую строку, отделяющую заголовок комментария от тела") ngx.exit(ngx.HTTP_BAD_REQUEST) end