two-images: construction reproductible de rocky10 et debian13 par Packer, test de démarrage syonad/two#53
Some checks failed
Tests / check (push) Failing after 39s
Some checks failed
Tests / check (push) Failing after 39s
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
commit
fe401b9a12
18 changed files with 937 additions and 0 deletions
25
metadata.py
Normal file
25
metadata.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
root = os.path.realpath(sys.argv[1])
|
||||
request = sys.stdin.buffer.readline().decode("latin-1").split()
|
||||
while sys.stdin.buffer.readline() not in (b"\r\n", b"\n", b""):
|
||||
pass
|
||||
name = request[1].lstrip("/") if len(request) > 1 else ""
|
||||
path = os.path.realpath(os.path.join(root, name))
|
||||
out = sys.stdout.buffer
|
||||
if name and os.path.dirname(path) == root and os.path.isfile(path):
|
||||
with open(path, "rb") as f:
|
||||
body = f.read()
|
||||
out.write(b"HTTP/1.0 200 OK\r\n")
|
||||
else:
|
||||
body = b""
|
||||
out.write(b"HTTP/1.0 404 Not Found\r\n")
|
||||
out.write(b"Content-Length: %d\r\nConnection: close\r\n\r\n" % len(body))
|
||||
out.write(body)
|
||||
out.flush()
|
||||
|
||||
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue