Mercurial > p > roundup > code
changeset 7113:5c6dd791d638
bug: handle exception when origin header is missing
Handle the KeyError raised if self.env['HTTP_ORIGIN'] is missing.
This is the bug that triggered the fix to run_cgi's top level exception
handler.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 11 Dec 2022 18:54:21 -0500 |
| parents | c0d030bd472e |
| children | 33eb82ad26ba |
| files | CHANGES.txt roundup/cgi/client.py |
| diffstat | 2 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Sun Dec 11 18:47:24 2022 -0500 +++ b/CHANGES.txt Sun Dec 11 18:54:21 2022 -0500 @@ -57,6 +57,7 @@ url. (John Rouillard) - Fix final exception handler in roundup-server to send proper Content-Length header to the client. (John Rouillard) +- Fix traceback if Origin header is missing. (John Rouillard) Features:
--- a/roundup/cgi/client.py Sun Dec 11 18:47:24 2022 -0500 +++ b/roundup/cgi/client.py Sun Dec 11 18:54:21 2022 -0500 @@ -1259,7 +1259,11 @@ "allowed to use the web interface")) def is_origin_header_ok(self, api=False): - origin = self.env['HTTP_ORIGIN'] + try: + origin = self.env['HTTP_ORIGIN'] + except KeyError: + return False + # note base https://host/... ends host with with a /, # so add it to origin. foundat = self.base.find(origin + '/')
