Skip to content

Commit

Permalink
Merge pull request from GHSA-p737-p57g-4cpr
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Mar 15, 2022
1 parent e4a3141 commit a5683ac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jupyter_server/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def log_request(handler):
ns["referer"] = request.headers.get("Referer", "None")
msg = msg + " referer={referer}"
if status >= 500 and status != 502:
# log all headers if it caused an error
log_method(json.dumps(dict(request.headers), indent=2))
# Log a subset of the headers if it caused an error.
headers = {}
for header in ['Host', 'Accept', 'Referer', 'User-Agent']:
if header in request.headers:
headers[header] = request.headers[header]
log_method(json.dumps(headers, indent=2))
log_method(msg.format(**ns))
prometheus_log_method(handler)

0 comments on commit a5683ac

Please sign in to comment.