diff options
author | Saiyang Gou <gousaiyang@163.com> | 2021-04-23 10:19:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-23 10:19:08 (GMT) |
commit | 927b841c215a1ca36c9b3203eadc67ce05b1ed07 (patch) | |
tree | dd5ff8d45bb64842451574b82eaac25a7b5dfd59 /Lib/http | |
parent | 32980fb669a6857276da18895fcc0cb6f6fbb544 (diff) | |
download | cpython-927b841c215a1ca36c9b3203eadc67ce05b1ed07.zip cpython-927b841c215a1ca36c9b3203eadc67ce05b1ed07.tar.gz cpython-927b841c215a1ca36c9b3203eadc67ce05b1ed07.tar.bz2 |
bpo-37363: Add audit events to the `http.client` module (GH-21321)
Add audit events to the `http.client` module
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Lib/http')
-rw-r--r-- | Lib/http/client.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py index c526380..4b1f692 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -74,6 +74,7 @@ import http import io import re import socket +import sys import collections.abc from urllib.parse import urlsplit @@ -931,6 +932,7 @@ class HTTPConnection: def connect(self): """Connect to the host and port specified in __init__.""" + sys.audit("http.client.connect", self, self.host, self.port) self.sock = self._create_connection( (self.host,self.port), self.timeout, self.source_address) self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) @@ -978,8 +980,10 @@ class HTTPConnection: break if encode: datablock = datablock.encode("iso-8859-1") + sys.audit("http.client.send", self, datablock) self.sock.sendall(datablock) return + sys.audit("http.client.send", self, data) try: self.sock.sendall(data) except TypeError: |