lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1542333 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
Date Fri, 15 Nov 2013 17:15:33 GMT
Author: markrmiller
Date: Fri Nov 15 17:15:32 2013
New Revision: 1542333

URL: http://svn.apache.org/r1542333
Log:
SOLR-5442: Python client cannot parse proxied response when served by Tomcat.
SOLR-5445: Proxied responses should propagate all headers rather than the first one for each
key.

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1542333&r1=1542332&r2=1542333&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Fri Nov 15 17:15:32 2013
@@ -87,6 +87,12 @@ Bug Fixes
 * SOLR-5438: DebugComponent throws NPE when used with grouping.
   (Tomás Fernández Löbbe via shalin)
 
+* SOLR-5442: Python client cannot parse proxied response when served by Tomcat.
+  (Patrick Hunt, Gregory Chanan, Vamsee Yarlagadda, Romain Rigaux, Mark Miller)
+
+* SOLR-5445: Proxied responses should propagate all headers rather than the 
+  first one for each key. (Patrick Hunt, Mark Miller) 
+
 Other Changes
 ---------------------
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1542333&r1=1542332&r2=1542333&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java Fri
Nov 15 17:15:32 2013
@@ -64,6 +64,7 @@ import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -92,6 +93,9 @@ import java.util.WeakHashMap;
  */
 public class SolrDispatchFilter implements Filter
 {
+  private static final String CONNECTION_HEADER = "Connection";
+  private static final String TRANSFER_ENCODING_HEADER = "Transfer-Encoding";
+
   final Logger log;
 
   protected volatile CoreContainer cores;
@@ -495,8 +499,8 @@ public class SolrDispatchFilter implemen
       
       con.setDoOutput(true);
       con.setDoInput(true);
-      for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
-        String headerName = e.nextElement().toString();
+      for (Enumeration<String> e = req.getHeaderNames(); e.hasMoreElements();) {
+        String headerName = e.nextElement();
         con.setRequestProperty(headerName, req.getHeader(headerName));
       }
       try {
@@ -518,11 +522,18 @@ public class SolrDispatchFilter implemen
         
         resp.setStatus(con.getResponseCode());
         
-        for (Iterator i = con.getHeaderFields().entrySet().iterator(); i
-            .hasNext();) {
-          Map.Entry mapEntry = (Map.Entry) i.next();
-          if (mapEntry.getKey() != null) resp.setHeader(mapEntry.getKey()
-              .toString(), ((List) mapEntry.getValue()).get(0).toString());
+        for (Iterator<Entry<String,List<String>>> i = con.getHeaderFields().entrySet().iterator();
i.hasNext();) {
+          Map.Entry<String,List<String>> mapEntry = i.next();
+          String header = mapEntry.getKey();
+          
+          // We pull out these two headers below because they can cause chunked
+          // encoding issues with Tomcat and certain clients
+          if (header != null && !header.equals(TRANSFER_ENCODING_HEADER)
+              && !header.equals(CONNECTION_HEADER)) {
+            for (String value : mapEntry.getValue()) {
+              resp.addHeader(mapEntry.getKey(), value);
+            }
+          }
         }
         
         resp.setCharacterEncoding(con.getContentEncoding());



Mime
View raw message