Apache Lucene open-source search software
SOLR-5461: Request proxying should only set con.setDoOutput(true) if the request is a post.
Mark Robert Miller74deac93f819
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex ae44a74325a..39c89762219 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -113,6 +113,9 @@ Bug Fixes* SOLR-5460: SolrDispatchFilter#sendError can get a SolrCore that it does notclose. (Mark Miller)+* SOLR-5461: Request proxying should only set con.setDoOutput(true) if the+ request is a post. (Mark Miller)+Other Changes---------------------diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.javaindex 505f5ee2d29..80c3fd3f2f9 100644--- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java+++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java@@ -500,7 +500,11 @@ public class SolrDispatchFilter implements Filtercon.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 FilterInputStream is;OutputStream os;- if ("POST".equals(req.getMethod())) {+ if (isPostRequest) {is = req.getInputStream();os = con.getOutputStream(); // side effect: method is switched to POSTtry {