Does http.server
(http
being a Python 3.x module) support ipv6? For instance, using this command-line code (which starts a webserver):
python -m http.server [port]
Python 3 http server is a built-in Python module that provides typical GET and HEAD request handlers. Any directory on our system can be turned into a web server with this module.
You can run python http server on any port, default port is 8000. Try to use port number greater than 1024 to avoid conflicts. Then open your favourite browser and type localhost:9000 .
Warning http. server is not recommended for production. It only implements basic security checks. It doesn't state what security vulnerabilities the server is exposed to.
Starting with Python 3.8, python -m http.server
supports IPv6 (see documentation and bug report with implementation history).
To listen on all all available interfaces:
python -m http.server --bind ::
Python 3.8 is was released on 2019-10-14.
Yes, it does. When defining your server, do it like this, as seen here.
import socket from http.server import HTTPServer class HTTPServerV6(HTTPServer): address_family = socket.AF_INET6
and then listen like this:
server = HTTPServerV6(('::', 8080), MyHandler) server.serve_forever()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With