summaryrefslogtreecommitdiffstats
path: root/admin/serve-doc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2024-11-09 17:08:52 +0100
committerDaniel Baumann <daniel@debian.org>2024-11-09 17:08:52 +0100
commit7ae5754b6d5f4f5ce4c4894a9d0f7247731e4d29 (patch)
tree4d551ffc1d3e175c528c69f06e22a9ac2ac41854 /admin/serve-doc
parentInitial commit. (diff)
downloadceph-19-7ae5754b6d5f4f5ce4c4894a9d0f7247731e4d29.tar.xz
ceph-19-7ae5754b6d5f4f5ce4c4894a9d0f7247731e4d29.zip
Adding upstream version 19.2.0.upstream/19.2.0upstream
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'admin/serve-doc')
-rwxr-xr-xadmin/serve-doc33
1 files changed, 33 insertions, 0 deletions
diff --git a/admin/serve-doc b/admin/serve-doc
new file mode 100755
index 000000000..fa2805938
--- /dev/null
+++ b/admin/serve-doc
@@ -0,0 +1,33 @@
+#!/usr/bin/python3
+
+from __future__ import print_function
+
+import http.server
+import socketserver
+import os
+import sys
+
+path = os.path.dirname(sys.argv[0])
+os.chdir(path)
+os.chdir('..')
+os.chdir('build-doc/output/html')
+
+class ReusingTCPServer(http.server.SimpleHTTPRequestHandler):
+ allow_reuse_address = True
+
+ def send_head(self):
+ # horrible kludge because SimpleHTTPServer is buggy wrt
+ # slash-redirecting of requests with query arguments, and will
+ # redirect to /foo?q=bar/ -- wrong slash placement
+ self.path = self.path.split('?', 1)[0]
+ return http.server.SimpleHTTPRequestHandler.send_head(self)
+
+httpd = socketserver.TCPServer(
+ ("", 8080),
+ ReusingTCPServer,
+ )
+try:
+ print("Serving doc at port: http://localhost:8080")
+ httpd.serve_forever()
+except KeyboardInterrupt:
+ pass