Skip to content

Instantly share code, notes, and snippets.

@chrisklaiber
Created February 15, 2018 16:16
Show Gist options
  • Save chrisklaiber/54511886e8e4c18126792fc634f44d57 to your computer and use it in GitHub Desktop.
Save chrisklaiber/54511886e8e4c18126792fc634f44d57 to your computer and use it in GitHub Desktop.
Python SimpleHTTPServer over IPv6. Run as `python -m SimpleHTTPServer6 [PORT]`
import BaseHTTPServer
import SimpleHTTPServer
import socket
class HTTPServer6(BaseHTTPServer.HTTPServer):
address_family = socket.AF_INET6
if __name__ == '__main__':
SimpleHTTPServer.test(ServerClass=HTTPServer6)
@Menci
Copy link

Menci commented Mar 17, 2019

We can simply execute in bash:

echo -e 'import BaseHTTPServer\nimport SimpleHTTPServer\nimport socket\nclass HTTPServer6(BaseHTTPServer.HTTPServer):\n address_family = socket.AF_INET6\nif __name__ == "__main__":\n SimpleHTTPServer.test(ServerClass=HTTPServer6)' | python2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment