Commit c703d147 authored by Martin van Es's avatar Martin van Es
Browse files

Correctly set Content-type headers

parent c791278b
......@@ -4,7 +4,7 @@ import copy
import signal
from lxml import etree as ET
from flask import Flask
from flask import Flask, Response
from urllib.parse import unquote
from dateutil import parser, tz
from datetime import datetime
......@@ -34,13 +34,14 @@ def sign(eid):
sha1 = hasher(entityID)
response = Response()
response.headers['Content-Type'] = "application/samlmetadata+xml"
if sha1 in signed:
signed_entity = signed[sha1]
if signed_entity.valid_until >
print(f"serve {sha1}")
return signed[sha1].md
if sha1 in idps: = signed[sha1].md
elif sha1 in idps:
print(f"sign {sha1}")
valid_until = idps[sha1].valid_until
......@@ -51,14 +52,19 @@ def sign(eid): = signed_xml
signed_entity.valid_until = idps[sha1].valid_until
signed[sha1] = signed_entity
return signed_xml = signed_xml
except Exception as e:
print(f" {e}")
else: = "No valid metadata\n"
response.headers['Content-type'] = "text/html"
response.status = 404
return response
return "No valid metadata\n", 404
print(f"serve {sha1}")
return response
def read_metadata(signum, frm):
print("\n--- SIGHUP ---")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment