commit b75b1d94ffb663b0171f465e4d3a3b60ca6488ac
parent 9c51f4b6b9e3e67dd24f9cbc690407fa89627f8b
Author: Solderpunk <solderpunk@sdf.org>
Date: Tue, 13 Aug 2019 20:17:40 +0300
Initial implementation of input support.
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/av98.py b/av98.py
@@ -126,6 +126,12 @@ class GeminiItem():
self.host if self.port == standard_ports[self.scheme] else self.host + ":" + str(self.port),
new_path, "", "", ""))
+ def add_query(self, query):
+ new_url = urllib.parse.urlunparse((self.scheme,
+ self.host if self.port == standard_ports[self.scheme] else self.host + ":" + str(self.port),
+ self.path, "", query, ""))
+ return GeminiItem(new_url)
+
def absolutise_url(self, relative_url):
"""
Convert a relative URL to an absolute URL by using the URL of this
@@ -257,7 +263,9 @@ Slow internet connection? Use 'set timeout' to be more patient.""")
# Handle non-SUCCESS headers, which don't have a response body
# Inputs
if status.startswith("1"):
- print("User input not supported.")
+ user_input = input(meta)
+ new_gi = gi.add_query(user_input)
+ self._go_to_gi(new_gi)
return
# Redirects
elif status.startswith("3"):