summaryrefslogtreecommitdiffstats
path: root/admin/serve-doc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /admin/serve-doc
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.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