Encoding: no ASCII chars > 127 in HTTP headers

Had quite some trouble with this, decided to URL-encode titles and
notifications.
This commit is contained in:
Thomas Gelf 2014-05-28 21:34:36 +00:00
parent b0b2d21751
commit 88460189cd
2 changed files with 5 additions and 2 deletions

View File

@ -420,7 +420,7 @@ class ActionController extends Zend_Controller_Action
$notifications = Notification::getInstance(); $notifications = Notification::getInstance();
if ($isXhr && ! $this->isRedirect && $notifications->hasMessages()) { if ($isXhr && ! $this->isRedirect && $notifications->hasMessages()) {
foreach ($notifications->getMessages() as $m) { foreach ($notifications->getMessages() as $m) {
header('X-Icinga-Notification: ' . $m->type . ' ' . $m->message); header('X-Icinga-Notification: ' . rawurlencode($m->type . ' ' . $m->message));
} }
} }
@ -442,7 +442,7 @@ class ActionController extends Zend_Controller_Action
// TODO: Innocent exception and error log for hack attempts // TODO: Innocent exception and error log for hack attempts
throw new Exception('No way, guy'); 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? // TODO: _render=layout?
if ($this->getParam('_render') === 'layout') { if ($this->getParam('_render') === 'layout') {

View File

@ -287,6 +287,9 @@
} }
var notifications = req.getResponseHeader('X-Icinga-Notification'); var notifications = req.getResponseHeader('X-Icinga-Notification');
if (notifications) {
notifications = decodeURIComponent(notifications);
}
var target = req.getResponseHeader('X-Icinga-Container'); var target = req.getResponseHeader('X-Icinga-Container');
var newBody = false; var newBody = false;