1
0
mirror of https://github.com/graygnuorg/pound.git synced 2026-10-28 11:35:07 +03:00
Files
pound/tests/error.at
Sergey Poznyakoff edfea27f25 New special backend: Error
* NEWS: Document changes.
* doc/pound.8: Likewise.
* src/config.c: New configuration directive: Error (Service section).
* src/http.c (error_response): New function.
(do_http): Handle the BE_ERROR backend type.
* src/pound.h (BE_ERROR): New backend type.
(struct be_error): New data type.
(BACKEND): Add be_error field.
(http_status_to_pound,pound_to_http_status): New protos.
* src/svc.c: Handle the BE_ERROR backend type.

* tests/error.at: New file.
* tests/Makefile.am: Add new test.
* tests/testsuite.at: Likewise.
* tests/errfile.at: Pop the ERR501 define.
2023-02-03 17:31:00 +02:00

78 lines
1.3 KiB
Plaintext

# This file is part of pound testsuite. -*- autotest -*-
# Copyright (C) 2023 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([Error backend])
AT_KEYWORDS([error])
PT_CHECK([ListenHTTP
Service
Error 404
End
End
],
[GET /foo/bar
end
404
end
])
m4_pushdef([ERR404],
[<html>
<head><title>Custom Not Found Error</title></head>
<body>
<p>The requested resource is not found on that server.</p>
<p>This is custom error page was supplied using the Err404 directive.</p>
</body>
])
AT_DATA([404.html],[ERR404])
PT_CHECK([ListenHTTP
Err404 "404.html"
Service
Error 404
End
End
],
[GET /foo/bar
end
404
ERR404
end
])
PT_CHECK([ListenHTTP
Service
Error 404 "404.html"
End
End
],
[GET /foo/bar
end
404
ERR404
end
])
m4_popdef([ERR404])
AT_CLEANUP