Merge pull request #2825 from eclipse/jetty-9.4.x-issue-2824-request-parameters

Issue #2824 - Request.getParameters() should not reparse or recreate _parameters Map
This commit is contained in:
Joakim Erdfelt 2018-08-21 11:10:01 -05:00 committed by GitHub
commit 8b7a88608a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -370,7 +370,7 @@ public class Request implements HttpServletRequest
/* ------------------------------------------------------------ */
private MultiMap<String> getParameters()
{
if (!_contentParamsExtracted)
if (!_contentParamsExtracted)
{
// content parameters need boolean protection as they can only be read
// once, but may be reset to null by a reset
@ -411,7 +411,7 @@ public class Request implements HttpServletRequest
_parameters=_contentParameters;
else if (isNoParams(_contentParameters) || _contentParameters.size()==0)
_parameters=_queryParameters;
else
else if(_parameters == null)
{
_parameters = new MultiMap<>();
_parameters.addAllValues(_queryParameters);

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.server;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@ -1060,7 +1061,7 @@ public class RequestTest
String response = _connector.getResponse(request);
assertThat(response, containsString(" 200 OK"));
}
@Test
public void testPartialRead() throws Exception
{
@ -1252,7 +1253,7 @@ public class RequestTest
200, TimeUnit.MILLISECONDS
);
assertThat(response, containsString("200"));
assertThat(response, Matchers.not(containsString("Connection: close")));
assertThat(response, not(containsString("Connection: close")));
assertThat(response, containsString("Hello World"));
response=_connector.getResponse(
@ -1282,7 +1283,7 @@ public class RequestTest
"\n"
);
assertThat(response, containsString("200"));
assertThat(response, Matchers.not(containsString("Connection: close")));
assertThat(response, not(containsString("Connection: close")));
assertThat(response, containsString("Hello World"));
response=_connector.getResponse(