Skip to content

Commit 3e9d073

Browse files
committed
Eliminate hang with unauthorized use of REST interface.
A /rest/ connection by a valid user without authorization for REST would hang. The response didn't include content-type and content-length. This keept the connection open until timeout.
1 parent c7fe0ff commit 3e9d073

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Fixed:
2323
chrome. I don't expect this to be a major problem since a front
2424
end server (apache, Nginx...) is usually customer facing and
2525
terminates SSL.
26+
- Fix hang when valid user without authorization for REST tries to use
27+
the rest interface.
2628

2729
Features:
2830

roundup/cgi/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,10 @@ def handle_rest(self):
607607

608608
if not self.db.security.hasPermission('Rest Access', self.userid):
609609
self.response_code = 403
610-
self.write(s2b('{ "error": { "status": 403, "msg": "Forbidden." } }'))
610+
output = s2b('{ "error": { "status": 403, "msg": "Forbidden." } }')
611+
self.setHeader("Content-Length", str(len(output)))
612+
self.setHeader("Content-Type", "application/json")
613+
self.write(output)
611614
return
612615

613616
self.check_anonymous_access()

0 commit comments

Comments
 (0)