---------

**Commit 1:**
URI-encode forwarded location header in proxy

Right now there are situations in which ElasticSearch puts characters in
the character code range between 128 and 255 into the `Location` header.
This leads to an exception when trying to pass on that header through
the hapi proxy in versions before 15.0.0, because it validates that only
US-ASCII characters are used in headers.

To work around that situation, the `Location` header is encoded using
`encodeURI()` for now.

Closes #8705

* Original sha: 18c23c17d9
* Authored by Felix Stürmer <stuermer@weltenwort.de> on 2016-10-18T17:55:31Z

**Commit 2:**
Add test to verify umlaut in vis name

Relates to #8705

* Original sha: e100e1f5c9
* Authored by Felix Stürmer <stuermer@weltenwort.de> on 2016-10-19T09:01:46Z

**Commit 3:**
[elasticsearch/proxy] use different code path with erorr

* Original sha: fec5e1a2dc
* Authored by spalger <email@spalger.com> on 2016-10-19T19:06:39Z
This commit is contained in:
Elastic Jasper 2016-10-19 15:25:12 -04:00
parent 4f2ba78a11
commit 9c93aa6177
2 changed files with 21 additions and 1 deletions

View file

@ -20,7 +20,17 @@ function createProxy(server, method, route, config) {
xforward: true,
timeout: server.config().get('elasticsearch.requestTimeout'),
onResponse: function (err, responseFromUpstream, request, reply) {
reply(err, responseFromUpstream);
if (err) {
reply(err);
return;
}
if (responseFromUpstream.headers.location) {
// TODO: Workaround for #8705 until hapi has been updated to >= 15.0.0
responseFromUpstream.headers.location = encodeURI(responseFromUpstream.headers.location);
}
reply(null, responseFromUpstream);
}
}
},

View file

@ -74,6 +74,16 @@ bdd.describe('visualize app', function describeIndexTests() {
});
});
bdd.it('should save and load with non-ascii characters', async function () {
const vizNamewithSpecialChars = `${vizName1} with Umlaut ä`;
const message = await PageObjects.visualize.saveVisualization(vizNamewithSpecialChars);
PageObjects.common.debug(`Saved viz message with umlaut = ${message}`);
expect(message).to.be(`Visualization Editor: Saved Visualization "${vizNamewithSpecialChars}"`);
await PageObjects.visualize.waitForToastMessageGone();
});
bdd.it('should save and load', function () {
return PageObjects.visualize.saveVisualization(vizName1)
.then(function (message) {