|
|
|
|
|
|
|
|
import urllib.parse |
|
|
import urllib.parse |
|
|
|
|
|
|
|
|
class newHandler(http.server.BaseHTTPRequestHandler): |
|
|
class newHandler(http.server.BaseHTTPRequestHandler): |
|
|
|
|
|
|
|
|
def do_GET(self): |
|
|
def do_GET(self): |
|
|
self.send_response(200) |
|
|
self.send_response(200) |
|
|
self.end_headers() |
|
|
self.end_headers() |
|
|
|
|
|
|
|
|
path = parseUrl.path |
|
|
path = parseUrl.path |
|
|
query = parseUrl.query |
|
|
query = parseUrl.query |
|
|
|
|
|
|
|
|
#query_components = urllib.parse.parse_qsl(query) |
|
|
|
|
|
|
|
|
query_components = urllib.parse.parse_qsl(query) |
|
|
|
|
|
|
|
|
msg = query |
|
|
|
|
|
|
|
|
ende = int(query_components[1][1]) |
|
|
|
|
|
start = int(query_components[0][1]) |
|
|
|
|
|
|
|
|
self.wfile.write(msg.encode('utf-8')) |
|
|
|
|
|
|
|
|
msg = "<table border='1'>" |
|
|
|
|
|
|
|
|
|
|
|
while(start <= ende): |
|
|
|
|
|
msg += "<tr><td>" + str(start) + "</td>" + "<td>" + str(start*start) + "</td>" + "</tr>" |
|
|
|
|
|
start += 1 |
|
|
|
|
|
|
|
|
|
|
|
msg += "</table>" |
|
|
|
|
|
|
|
|
|
|
|
self.wfile.write(msg.encode('utf-8')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PORT = 4096 |
|
|
PORT = 4096 |