SOLR-5461: Request proxying should only set con.setDoOutput(true) if the

request is a post.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1543088 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-11-18 17:18:37 +00:00
parent d88ee060b5
commit 74deac93f8
2 changed files with 9 additions and 2 deletions

View File

@ -113,6 +113,9 @@ Bug Fixes
* SOLR-5460: SolrDispatchFilter#sendError can get a SolrCore that it does not
close. (Mark Miller)
* SOLR-5461: Request proxying should only set con.setDoOutput(true) if the
request is a post. (Mark Miller)
Other Changes
---------------------

View File

@ -500,7 +500,11 @@ public class SolrDispatchFilter implements Filter
con.setRequestMethod(req.getMethod());
con.setUseCaches(false);
con.setDoOutput(true);
boolean isPostRequest = "POST".equals(req.getMethod());
if (isPostRequest) {
con.setDoOutput(true);
}
con.setDoInput(true);
for (Enumeration<String> e = req.getHeaderNames(); e.hasMoreElements();) {
String headerName = e.nextElement();
@ -511,7 +515,7 @@ public class SolrDispatchFilter implements Filter
InputStream is;
OutputStream os;
if ("POST".equals(req.getMethod())) {
if (isPostRequest) {
is = req.getInputStream();
os = con.getOutputStream(); // side effect: method is switched to POST
try {