Skip to content

Commit

Permalink
Fix: Read the text avoiding file descriptor.
Browse files Browse the repository at this point in the history
  • Loading branch information
nesitor authored and hoh committed Jun 26, 2023
1 parent 18d39d7 commit abb68e8
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions runtimes/aleph-debian-11-python/init1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/python3 -OO
import base64
import logging
from pathlib import Path

logging.basicConfig(
level=logging.DEBUG,
Expand Down Expand Up @@ -329,20 +330,19 @@ async def make_request(session, scope):


def show_loading():
with open("/root/loading.html", "r") as f:
body = {
"body": f.read()
}
headers = {
"headers": [
[b'Content-Type', b'text/html'],
[b'Connection', b'keep-alive'],
[b'Keep-Alive', b'timeout=5'],
[b'Transfer-Encoding', b'chunked']
],
"status": 503,
}
return headers, body
body = {
"body": Path("/root/loading.html").read_text()
}
headers = {
"headers": [
[b'Content-Type', b'text/html'],
[b'Connection', b'keep-alive'],
[b'Keep-Alive', b'timeout=5'],
[b'Transfer-Encoding', b'chunked']
],
"status": 503,
}
return headers, body


async def run_executable_http(scope: dict) -> Tuple[Dict, Dict, str, Optional[bytes]]:
Expand Down

0 comments on commit abb68e8

Please sign in to comment.