/
BirdLeon
/
ROBLOX2016
Обзор
Документация
Войти
/
BirdLeon
/
ROBLOX2016
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
Library/cpp-netlib/libs/network/test/server/cgi_server.py
34 строки
948 B
PatoFlamejanteTV
full source code
19 дек 2024, 19:11
19 дек 2024, 19:11
05db15d
Код
Авторство
О чём код?
#!/usr/bin/python # # Copyright Divye Kapoor 2008. # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http:#www.boost.org/LICENSE_1_0.txt) # # This program sets up a CGI HTTP Server at port 8000 on localhost # It will be used to test the http::client interface of the library import CGIHTTPServer import BaseHTTPServer import threading from threading import Thread, Event stop_serving = Event() server_thread = None def run(server_class=BaseHTTPServer.HTTPServer, handler_class=CGIHTTPServer.CGIHTTPRequestHandler): server_address = ('',8000) httpd = server_class(server_address, handler_class) while not stop_serving.isSet(): httpd.handle_request() def start_server(): server_thread = Thread(None, run, "HTTP Server",(), None, None) server_thread.start() server_thread.join() if __name__ == '__main__': start_server()