mirror of
https://github.com/graygnuorg/pound.git
synced 2026-10-23 22:28:53 +03:00
Instead of direct-descent, use LALR(1) parser, assisted by a table-driven context-dependent token recognizer. * configure.ac: Detect bison and flex. * src/.gitignore: Add generated files. * src/Makefile.am: Add generated files. * src/cctype.h: Enclose in #ifdef protection. * src/mem.h: Likewise. * src/cfg-gram.y: New file. * src/cfg-lex.l: New file. * src/cfgdef.c: New file. * src/cfgdef.h: New file. * src/cfgparser.c: Remove. * src/cfgparser.h: Remove. * src/config.c: Rewrite. * src/extern.h (FEATURE_DEPRECATED): New feature. * src/list.h (DLIST_CONCAT): New macro. * src/pndlua.c: Rewrite configuration support. * src/pound.c: Likewise. * src/pound.h: Likewise. * src/poundctl.c: Likewise. * src/pound-mode.el: Minor change. * tests/bemix.at: Update expected output. * tests/checkurl.at: Likewise. * tests/config.at: Likewise. * tests/lstset.at: Likewise. * tests/set.at: Likewise. * tests/lua-service.at: Remove the out-of-place flag.
346 lines
4.2 KiB
Plaintext
346 lines
4.2 KiB
Plaintext
# This file is part of pound testsuite. -*- autotest -*-
|
|
# Copyright (C) 2023-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([Basic set directives])
|
|
AT_KEYWORDS([set rewrite])
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
SetURL "/echo/other"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /one
|
|
end
|
|
|
|
200
|
|
x-orig-uri: /echo/other
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
SetPath "/echo/other"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /one
|
|
end
|
|
|
|
200
|
|
x-orig-uri: /echo/other
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
SetPath -encode "/echo/one&other"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /one
|
|
end
|
|
|
|
200
|
|
x-orig-uri: /echo/one%26other
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
SetQuery "foo=10&quux=b%20ar"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /echo/one
|
|
end
|
|
|
|
200
|
|
x-orig-uri: /echo/one?foo=10&quux=b%20ar
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
DeleteQuery
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /echo/one?foo=10&quux=b%20ar
|
|
end
|
|
|
|
200
|
|
x-orig-uri: /echo/one
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
SetQueryParam "foo" "10"
|
|
SetQueryParam "quux" "b%20ar"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /echo/one
|
|
end
|
|
|
|
200
|
|
x-orig-uri: /echo/one?foo=10&quux=b%20ar
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
SetQueryParam "quux" -encode "foo & bar"
|
|
SetQueryParam "foo" -encode "q?"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /echo/one?foo=10
|
|
end
|
|
|
|
200
|
|
x-orig-uri: /echo/one?foo=q%3F&quux=foo%20%26%20bar
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
SetQueryParam "foo"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /echo/one?foo=10&quux=b%20ar
|
|
end
|
|
|
|
200
|
|
x-orig-uri: /echo/one?quux=b%20ar
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
SetHeader "X-Foo: bar baz"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /echo/one
|
|
end
|
|
|
|
200
|
|
x-orig-header-x-foo: bar baz
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
DeleteHeader -beg "X-Accept"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /echo/foo
|
|
X-Accept: *
|
|
X-Accept-Ex: foo
|
|
end
|
|
|
|
200
|
|
-x-orig-header-X-Accept:
|
|
-x-orig-header-X-Accept-Ex:
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
DeleteHeader -beg "X-Accept:"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /echo/foo
|
|
X-Accept: *
|
|
X-Accept-Ex: foo
|
|
end
|
|
|
|
200
|
|
-x-orig-header-X-Accept:
|
|
x-orig-header-X-Accept-Ex: foo
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
DeleteHeader ["X-Accept:[[:space:]]*bar"]
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /echo/foo
|
|
X-Accept: *
|
|
X-Accept-Ex: foo
|
|
end
|
|
|
|
200
|
|
x-orig-header-X-Accept: *
|
|
x-orig-header-X-Accept-Ex: foo
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
DeleteHeader ["X-Accept:[[:space:]]*bar"]
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /echo/foo
|
|
X-Accept: bar
|
|
X-Accept-Ex: foo
|
|
end
|
|
|
|
200
|
|
-x-orig-header-X-Accept:
|
|
x-orig-header-X-Accept-Ex: foo
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
Rewrite
|
|
SetPath "/echo/other"
|
|
SetQueryParam "foo" "bar"
|
|
SetQueryParam "qux" "x%2Fuq"
|
|
SetHeader "x-foo: bar baz"
|
|
DeleteHeader -beg -icase "x-bar:"
|
|
End
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /one
|
|
X-Bar: qux
|
|
end
|
|
|
|
200
|
|
x-orig-uri: /echo/other?foo=bar&qux=x%2Fuq
|
|
x-orig-header-x-foo: bar baz
|
|
-x-orig-header-X-Bar:
|
|
end
|
|
])
|
|
|
|
PT_CHECK([ListenHTTP
|
|
Service
|
|
SetPath ["/echo/other"]
|
|
SetQueryParam "foo" "bar"
|
|
SetQueryParam "qux" "x%2Fuq"
|
|
SetHeader "x-foo: bar baz"
|
|
DeleteHeader -beg -icase "x-bar:"
|
|
|
|
Backend
|
|
Address
|
|
Port
|
|
End
|
|
End
|
|
End
|
|
],
|
|
[GET /one
|
|
X-Bar: qux
|
|
end
|
|
|
|
200
|
|
x-orig-uri: /echo/other?foo=bar&qux=x%2Fuq
|
|
x-orig-header-x-foo: bar baz
|
|
-x-orig-header-X-Bar:
|
|
end
|
|
])
|
|
|
|
AT_CLEANUP
|