mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
38 lines
944 B
Python
38 lines
944 B
Python
from six.moves.http_client import HTTPConnection, HTTPSConnection
|
|
|
|
|
|
def basic():
|
|
conn = HTTPConnection('example.com')
|
|
conn.request('GET', '/path')
|
|
|
|
|
|
def indirect_caller():
|
|
conn = HTTPSConnection('example.com')
|
|
indirect_callee(conn)
|
|
|
|
|
|
def indirect_callee(conn):
|
|
conn.request('POST', '/path')
|
|
|
|
|
|
def method_not_known(method):
|
|
conn = HTTPConnection('example.com')
|
|
conn.request(method, '/path')
|
|
|
|
|
|
def sneaky_setting_host():
|
|
# We don't handle that the host is overwritten directly.
|
|
# A contrived example; you're not supposed to do this, but you certainly can.
|
|
fake = 'fakehost.com'
|
|
real = 'realhost.com'
|
|
conn = HTTPConnection(fake)
|
|
conn.host = real
|
|
conn.request('GET', '/path')
|
|
|
|
|
|
def tricky_not_attribute_node():
|
|
# A contrived example; you're not supposed to do this, but you certainly can.
|
|
conn = HTTPConnection('example.com')
|
|
req_meth = conn.request
|
|
req_meth('HEAD', '/path')
|