aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-03-01 16:08:07 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-03-01 16:08:07 +0300
commit2eaa4fc9ab517b0ef0c21272766551ab3191c5ea (patch)
treeee5b05e220da118525ebc1b26069014778442609
parentget.py: don't import cgitb (diff)
downloadlinux-status-2eaa4fc9ab517b0ef0c21272766551ab3191c5ea.tar.gz
linux-status-2eaa4fc9ab517b0ef0c21272766551ab3191c5ea.zip
get.py: don't import cgi
I only use it for FieldsStorage, and it can be trivially replaced with urllib.parse while being really bad for performance.
Diffstat (limited to '')
-rwxr-xr-xcgi-bin/get.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cgi-bin/get.py b/cgi-bin/get.py
index 500f081..da8f4c7 100755
--- a/cgi-bin/get.py
+++ b/cgi-bin/get.py
@@ -6,7 +6,6 @@
# Distributed under the MIT License.
import abc
-import cgi
from collections import namedtuple
from concurrent.futures import ThreadPoolExecutor
import json
@@ -16,6 +15,7 @@ import shlex
import socket
import subprocess
from subprocess import DEVNULL, PIPE, STDOUT
+import urllib.parse
def split_by(xs, sep):
@@ -308,8 +308,8 @@ def systemd_users():
def do():
- params = cgi.FieldStorage()
- what = params['what'].value
+ params = urllib.parse.parse_qs(os.environ['QUERY_STRING'])
+ what = params['what'][0]
if what == 'status':
response = StatusTask().complete()
elif what == 'timers':