Issue #25232: Fix CGIRequestHandler's splitting of URL query
Patch from Xiang Zhang.
diff --git a/Lib/CGIHTTPServer.py b/Lib/CGIHTTPServer.py
index 8f8ae56..7a4593e 100644
--- a/Lib/CGIHTTPServer.py
+++ b/Lib/CGIHTTPServer.py
@@ -120,11 +120,7 @@
break
# find an explicit query string, if present.
- i = rest.rfind('?')
- if i >= 0:
- rest, query = rest[:i], rest[i+1:]
- else:
- query = ''
+ rest, _, query = rest.partition('?')
# dissect the part after the directory name into a script name &
# a possible additional path, to be stored in PATH_INFO.