Skip to content

Commit

Permalink
Revert "Add CORS headers to dream server to ease integration with thi…
Browse files Browse the repository at this point in the history
…rd-party web interfaces" (#371)

This reverts commit 91e826e.
  • Loading branch information
bakkot authored Sep 5, 2022
1 parent a20113d commit 95c088b
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions ldm/dream/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ class DreamServer(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == "/":
self.send_response(200)
self.send_header("Access-Control-Allow-Origin", "*")
self.send_header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
self.send_header("Content-type", "text/html")
self.end_headers()
with open("./static/dream_web/index.html", "rb") as content:
Expand All @@ -35,8 +33,6 @@ def do_GET(self):
elif self.path == "/cancel":
self.canceled.set()
self.send_response(200)
self.send_header("Access-Control-Allow-Origin", "*")
self.send_header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
self.send_header("Content-type", "application/json")
self.end_headers()
self.wfile.write(bytes('{}', 'utf8'))
Expand All @@ -59,8 +55,6 @@ def do_GET(self):

def do_POST(self):
self.send_response(200)
self.send_header("Access-Control-Allow-Origin", "*")
self.send_header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
self.send_header("Content-type", "application/json")
self.end_headers()

Expand Down Expand Up @@ -205,11 +199,6 @@ def image_progress(sample, step):
print(f"Canceled.")
return

def do_OPTIONS(self):
self.send_response(200)
self.send_header("Access-Control-Allow-Origin", "*")
self.send_header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
self.end_headers()

class ThreadingDreamServer(ThreadingHTTPServer):
def __init__(self, server_address):
Expand Down

0 comments on commit 95c088b

Please sign in to comment.