File tree Expand file tree Collapse file tree 2 files changed +54
-25
lines changed
python/ql/test/experimental/library-tests/frameworks/tornado Expand file tree Collapse file tree 2 files changed +54
-25
lines changed Original file line number Diff line number Diff line change 1+ import tornado .web
2+
3+
4+ class BasicHandler (tornado .web .RequestHandler ):
5+ def get (self ):
6+ self .write ("BasicHandler " + self .get_argument ("xss" ))
7+
8+ def post (self ):
9+ self .write ("BasicHandler (POST)" )
10+
11+
12+ class DeepInheritance (BasicHandler ):
13+ def get (self ):
14+ self .write ("DeepInheritance" + self .get_argument ("also_xss" ))
15+
16+
17+ class FormHandler (tornado .web .RequestHandler ):
18+ def post (self ):
19+ name = self .get_body_argument ("name" )
20+ self .write (name )
21+
22+
23+ class RedirectHandler (tornado .web .RequestHandler ):
24+ def get (self ):
25+ req = self .request
26+ h = req .headers
27+ url = h ["url" ]
28+ self .redirect (url )
29+
30+
31+ def make_app ():
32+ return tornado .web .Application ([
33+ (r"/basic" , BasicHandler ),
34+ (r"/deep" , DeepInheritance ),
35+ (r"/form" , FormHandler ),
36+ (r"/redirect" , RedirectHandler ),
37+ ])
38+
39+
40+ if __name__ == "__main__" :
41+ import tornado .ioloop
42+
43+ app = make_app ()
44+ app .listen (8888 )
45+ tornado .ioloop .IOLoop .current ().start ()
46+
47+ # http://localhost:8888/basic?xss=foo
48+ # http://localhost:8888/deep?also_xss=foo
49+
50+ # curl -X POST http://localhost:8888/basic
51+ # curl -X POST http://localhost:8888/deep
52+
53+ # curl -X POST -F "name=foo" http://localhost:8888/form
54+ # curl -v -H 'url: http://example.com' http://localhost:8888/redirect
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments