tqcq
9453a7cc55
All checks were successful
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Successful in 1m28s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Successful in 1m56s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Successful in 1m43s
linux-arm-gcc / linux-gcc-arm (Release) (push) Successful in 1m40s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Successful in 1m59s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Successful in 1m51s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Successful in 1m32s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Successful in 1m38s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 1m27s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 1m41s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Successful in 3m17s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Successful in 1m45s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 2m10s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 2m26s
linux-x86-gcc / linux-gcc (Debug) (push) Successful in 2m35s
linux-x86-gcc / linux-gcc (Release) (push) Successful in 2m29s
Reviewed-on: #3
25 lines
685 B
Python
25 lines
685 B
Python
#!/usr/bin/python3
|
|
import http.server
|
|
import socket
|
|
import socketserver
|
|
from http.server import HTTPServer, BaseHTTPRequestHandler
|
|
|
|
PORT = 8000
|
|
|
|
class Request(BaseHTTPRequestHandler):
|
|
def do_GET(self):
|
|
code = int(self.path.split("/")[1])
|
|
|
|
self.send_response(code)
|
|
self.send_header('Content-type', 'text/plain')
|
|
self.end_headers()
|
|
|
|
class HTTPServer(socketserver.TCPServer):
|
|
def server_bind(self):
|
|
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
self.socket.bind(self.server_address)
|
|
|
|
Handler = http.server.SimpleHTTPRequestHandler
|
|
with HTTPServer(("", PORT), Request) as httpd:
|
|
httpd.serve_forever()
|