1
0
mirror of https://github.com/graygnuorg/pound.git synced 2026-10-23 22:28:53 +03:00
Files
pound/tests/fallthrough.at
Sergey Poznyakoff 191c765cc4 Fall-through services
A fall-through service is defined for its side effects: modifying
the request or changing log suppression status. If it matches, its
statements are applied to the request and service selection process
continues from the next service.

* src/pound.h (SERVICE): New field: fall_through.
(POUND_HTTP): New field: log_suppress_mask.
* src/config.c (svc_defn): New statement: FallThrough.
(service_finalize): Make sure fall-through statements don't contain
backends or response rewrites.
* src/pound-mode.el: Recognize the FallThrough keyword.
* src/log.c (http_log): Use phttp->log_suppress_mask.
* src/svc.c (select_service): Rewrite. Don't break on finding a
matching fall-through service.
Apply log_suppress_mask bits from any matching service to the phttp
object.

* tests/fallthrough.at: New test.
* tests/Makefile.am: Add new test.
* tests/testsuite.at: Likewise.

* NEWS: Document changes.
* doc/pound.8: Likewise.
* doc/pound.texi: Likewise.
2026-07-07 08:53:28 +03:00

68 lines
1.2 KiB
Plaintext

# This file is part of pound testsuite. -*- autotest -*-
# Copyright (C) 2026 Sergey Poznyakoff
#
# Pound is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Pound is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pound. If not, see <http://www.gnu.org/licenses/>.
AT_SETUP([FallThrough services])
AT_KEYWORDS([cond fallthrough])
PT_CHECK([
ListenHTTP
Service
SetHeader "FT-1: passed"
FallThrough
End
Service
Host "one"
Backend
End
End
Service
SetHeader "FT-2: passed"
FallThrough
End
Service
Host "two"
Backend
End
End
End
],
[GET /echo/foo
Host: one
end
200
x-orig-header-FT-1: passed
-x-orig-header-FT-2:
end
GET /echo/foo
Host: two
end
200
x-orig-header-FT-1: passed
x-orig-header-FT-2: passed
end
GET /echo/foo
Host: any
end
503
-x-orig-header-FT-1:
-x-orig-header-FT-2:
end
])
AT_CLEANUP