Skip to content

Commit

Permalink
Encoding: no ASCII chars > 127 in HTTP headers
Browse files Browse the repository at this point in the history
Had quite some trouble with this, decided to URL-encode titles and
notifications.
  • Loading branch information
Thomas-Gelf committed May 28, 2014
1 parent b0b2d21 commit 8846018
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/Icinga/Web/Controller/ActionController.php
Expand Up @@ -420,7 +420,7 @@ public function postDispatch()
$notifications = Notification::getInstance();
if ($isXhr && ! $this->isRedirect && $notifications->hasMessages()) {
foreach ($notifications->getMessages() as $m) {
header('X-Icinga-Notification: ' . $m->type . ' ' . $m->message);
header('X-Icinga-Notification: ' . rawurlencode($m->type . ' ' . $m->message));
}
}

Expand All @@ -442,7 +442,7 @@ public function postDispatch()
// TODO: Innocent exception and error log for hack attempts
throw new Exception('No way, guy');
}
header('X-Icinga-Title: ' . $this->view->title . ' :: Icinga Web');
header('X-Icinga-Title: ' . rawurlencode($this->view->title . ' :: Icinga Web'));
}
// TODO: _render=layout?
if ($this->getParam('_render') === 'layout') {
Expand Down
3 changes: 3 additions & 0 deletions public/js/icinga/loader.js
Expand Up @@ -287,6 +287,9 @@
}

var notifications = req.getResponseHeader('X-Icinga-Notification');
if (notifications) {
notifications = decodeURIComponent(notifications);
}

var target = req.getResponseHeader('X-Icinga-Container');
var newBody = false;
Expand Down

0 comments on commit 8846018

Please sign in to comment.