|
1 | 1 | from pyramid.view import view_config
|
2 | 2 | from pyramid.config import Configurator
|
3 | 3 | from pyramid.response import Response
|
| 4 | +from pyramid.httpexceptions import HTTPMultipleChoices, HTTPMovedPermanently, HTTPFound, HTTPSeeOther, HTTPUseProxy, HTTPTemporaryRedirect, HTTPPermanentRedirect |
4 | 5 | from wsgiref.simple_server import make_server
|
5 | 6 |
|
6 | 7 | def ignore(*args, **kwargs): pass
|
@@ -45,6 +46,8 @@ def test1(request): # $ requestHandler
|
45 | 46 |
|
46 | 47 | request.text, # $ tainted
|
47 | 48 |
|
| 49 | + request.matchdict, # $ tainted |
| 50 | + |
48 | 51 | request.path, # $ tainted
|
49 | 52 | request.path_info, # $ tainted
|
50 | 53 | request.path_info_peek(), # $ tainted
|
@@ -87,12 +90,23 @@ def test3(ctx, req): # $ requestHandler
|
87 | 90 | resp.set_cookie(value="there", name="hi") # $ CookieWrite CookieName="hi" CookieValue="there"
|
88 | 91 | return "Ok" # $ HttpResponse responseBody="Ok" mimetype=text/html
|
89 | 92 |
|
| 93 | +@view_config(route_name="test4", renderer="string") # $ routeSetup |
| 94 | +def test4(request): # $ requestHandler |
| 95 | + a = HTTPMultipleChoices("redirect") # $HttpResponse mimetype=text/html HttpRedirectResponse redirectLocation="redirect" |
| 96 | + b = HTTPMovedPermanently(location="redirect") # $HttpResponse mimetype=text/html HttpRedirectResponse redirectLocation="redirect" |
| 97 | + c = HTTPFound(location="redirect") # $HttpResponse mimetype=text/html HttpRedirectResponse redirectLocation="redirect" |
| 98 | + d = HTTPSeeOther(location="redirect") # $HttpResponse mimetype=text/html HttpRedirectResponse redirectLocation="redirect" |
| 99 | + e = HTTPUseProxy(location="redirect") # $HttpResponse mimetype=text/html HttpRedirectResponse redirectLocation="redirect" |
| 100 | + f = HTTPTemporaryRedirect(location="redirect") # $HttpResponse mimetype=text/html HttpRedirectResponse redirectLocation="redirect" |
| 101 | + g = HTTPPermanentRedirect(location="redirect") # $HttpResponse mimetype=text/html HttpRedirectResponse redirectLocation="redirect" |
| 102 | + raise a |
| 103 | + |
90 | 104 | if __name__ == "__main__":
|
91 | 105 | with Configurator() as config:
|
92 |
| - for i in range(1,4): |
| 106 | + for i in range(1,5): |
93 | 107 | config.add_route(f"test{i}", f"/test{i}")
|
94 | 108 | config.add_view(test2, route_name="test2") # $ routeSetup
|
95 | 109 | config.scan()
|
96 |
| - server = make_server('127.0.0.1', 8000, config.make_wsgi_app()) |
| 110 | + server = make_server('127.0.0.1', 8080, config.make_wsgi_app()) |
97 | 111 | print("serving")
|
98 | 112 | server.serve_forever()
|
0 commit comments