You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2020/09/22 21:42:30 UTC
[lucene-solr] branch master updated: SOLR-14768: Fix multipart POST
to Solr. (#1838)
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new 7b53671 SOLR-14768: Fix multipart POST to Solr. (#1838)
7b53671 is described below
commit 7b53671920840bb6fe6906436260d6bf906156f9
Author: David Smiley <ds...@apache.org>
AuthorDate: Tue Sep 22 17:42:18 2020 -0400
SOLR-14768: Fix multipart POST to Solr. (#1838)
Regression from 8.6
Multipart POST would fail due to a NoClassDefFoundError of Jetty MultiPart. Solr cannot access many Jetty classes, which is not noticeable in our tests.
---
solr/CHANGES.txt | 5 +++--
.../org/apache/solr/servlet/SolrRequestParsers.java | 18 ++++++++----------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 109347b..a47a24b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -10,7 +10,6 @@ Consult the lucene/CHANGES.txt file for additional, low level, changes in this r
Upgrade Notes
---------------------
-
* SOLR-12847: maxShardsPerNode parameter has been removed because it was broken and
inconsistent with other replica placement strategies. Other relevant placement strategies
should be used instead, such as autoscaling policy or rules-based placement.
@@ -26,7 +25,6 @@ New Features
* SOLR-14588: Introduce Circuit Breaker Infrastructure and a JVM heap usage memory tracking circuit breaker implementation (Atri Sharma)
-
Improvements
----------------------
* LUCENE-8984: MoreLikeThis MLT is biased for uncommon fields (Andy Hind via Anshum Gupta)
@@ -248,6 +246,9 @@ Bug Fixes
Also, params with macros will be processed more strictly by LTR FeatureWeight.
(David Smiley, Cesar Rodriguez, Christine Poerschke)
+* SOLR-14768: Fix HTTP multipart POST to Solr -- a regression from 8.6.0.
+ Many Jetty classes are not classpath-visible from the Solr webapp. (David Smiley)
+
Other Changes
---------------------
diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java b/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java
index 52696ba..4a8cffa 100644
--- a/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java
+++ b/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java
@@ -62,7 +62,6 @@ import org.apache.solr.util.RTimerTree;
import org.apache.solr.util.tracing.GlobalTracer;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.MimeTypes;
-import org.eclipse.jetty.server.MultiParts;
import org.eclipse.jetty.server.Request;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -593,7 +592,7 @@ public class SolrRequestParsers {
return params;
}
- boolean isMultipart(HttpServletRequest req) {
+ static boolean isMultipart(HttpServletRequest req) {
// Jetty utilities
return MimeTypes.Type.MULTIPART_FORM_DATA.is(HttpFields.valueParameters(req.getContentType(), null));
}
@@ -618,11 +617,9 @@ public class SolrRequestParsers {
}
- /** Clean up any tmp files created by MultiPartInputStream. */
+ /** Clean up any files created by MultiPartInputStream. */
static void cleanupMultipartFiles(HttpServletRequest request) {
- // See Jetty MultiPartCleanerListener from which we drew inspiration
- MultiParts multiParts = (MultiParts) request.getAttribute(Request.MULTIPARTS);
- if (multiParts == null || multiParts.getContext() != request.getServletContext()) {
+ if (!MultipartRequestParser.isMultipart(request)) {
return;
}
@@ -630,9 +627,10 @@ public class SolrRequestParsers {
Collection<Part> parts;
try {
- parts = multiParts.getParts();
- } catch (IOException e) {
- log.warn("Errors deleting multipart tmp files", e);
+ parts = request.getParts();
+ } catch (Exception e) {
+ assert false : e.toString();
+ log.error("Couldn't get multipart parts in order to delete them", e);
return;
}
@@ -812,7 +810,7 @@ public class SolrRequestParsers {
return formdata.parseParamsAndFillStreams(req, streams, input);
}
- if (multipart.isMultipart(req)) {
+ if (MultipartRequestParser.isMultipart(req)) {
return multipart.parseParamsAndFillStreams(req, streams);
}