Skip to content

Commit 8ab14c5

Browse files
committed
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.
1 parent cc78e66 commit 8ab14c5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Fixed:
5757
url. (John Rouillard)
5858
- Fix final exception handler in roundup-server to send proper
5959
Content-Length header to the client. (John Rouillard)
60+
- Fix traceback if Origin header is missing. (John Rouillard)
6061

6162
Features:
6263

roundup/cgi/client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,11 @@ def check_anonymous_access(self):
12591259
"allowed to use the web interface"))
12601260

12611261
def is_origin_header_ok(self, api=False):
1262-
origin = self.env['HTTP_ORIGIN']
1262+
try:
1263+
origin = self.env['HTTP_ORIGIN']
1264+
except KeyError:
1265+
return False
1266+
12631267
# note base https://host/... ends host with with a /,
12641268
# so add it to origin.
12651269
foundat = self.base.find(origin + '/')

0 commit comments

Comments
 (0)