mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Python: Model RequestHandler from standard library explicitly
This commit is contained in:
@@ -1616,6 +1616,20 @@ private module Stdlib {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The entry-point for handling a request with a `BaseHTTPRequestHandler` subclass.
|
||||
*
|
||||
* Not essential for any functionality, but provides a consistent modeling.
|
||||
*/
|
||||
private class RequestHandlerFunc extends HTTP::Server::RequestHandler::Range {
|
||||
RequestHandlerFunc() {
|
||||
this = any(HTTPRequestHandlerClassDef cls).getAMethod() and
|
||||
this.getName() = "do_" + HTTP::httpVerb()
|
||||
}
|
||||
|
||||
override Parameter getARoutedParameter() { none() }
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** Gets an HTTP verb */
|
||||
/** Gets an HTTP verb, in upper case */
|
||||
string httpVerb() {
|
||||
result = "GET" or
|
||||
result = "POST" or
|
||||
|
||||
@@ -78,7 +78,7 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||
ensure_tainted(form)
|
||||
|
||||
|
||||
def do_GET(self): # $ MISSING: requestHandler
|
||||
def do_GET(self): # $ requestHandler
|
||||
# send_response will log a line to stderr
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "text/plain; charset=utf-8")
|
||||
@@ -88,7 +88,7 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||
print(self.headers)
|
||||
|
||||
|
||||
def do_POST(self): # $ MISSING: requestHandler
|
||||
def do_POST(self): # $ requestHandler
|
||||
form = cgi.FieldStorage(
|
||||
self.rfile,
|
||||
self.headers,
|
||||
|
||||
Reference in New Issue
Block a user