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

@ -411,7 +411,7 @@ public class Request implements HttpServletRequest
_parameters=_contentParameters; _parameters=_contentParameters;
else if (isNoParams(_contentParameters) || _contentParameters.size()==0) else if (isNoParams(_contentParameters) || _contentParameters.size()==0)
_parameters=_queryParameters; _parameters=_queryParameters;
else else if(_parameters == null)
{ {
_parameters = new MultiMap<>(); _parameters = new MultiMap<>();
_parameters.addAllValues(_queryParameters); _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.containsString;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith; import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
@ -1252,7 +1253,7 @@ public class RequestTest
200, TimeUnit.MILLISECONDS 200, TimeUnit.MILLISECONDS
); );
assertThat(response, containsString("200")); assertThat(response, containsString("200"));
assertThat(response, Matchers.not(containsString("Connection: close"))); assertThat(response, not(containsString("Connection: close")));
assertThat(response, containsString("Hello World")); assertThat(response, containsString("Hello World"));
response=_connector.getResponse( response=_connector.getResponse(
@ -1282,7 +1283,7 @@ public class RequestTest
"\n" "\n"
); );
assertThat(response, containsString("200")); assertThat(response, containsString("200"));
assertThat(response, Matchers.not(containsString("Connection: close"))); assertThat(response, not(containsString("Connection: close")));
assertThat(response, containsString("Hello World")); assertThat(response, containsString("Hello World"));
response=_connector.getResponse( response=_connector.getResponse(