MLE-31224: Support isolated HTTP and XDBC requests#610
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Backports “isolation support” logic to determine whether requests are forwarded (for both HTTP and XDBC paths) so MLCP can correctly enable host restriction behavior when running behind forwarding/isolation layers.
Changes:
- Updated split-query construction to evaluate both HTTP and XDBC forwarded-header checks.
- Added
xdmp:is-forwarded()-based logic (with backward-compatible fallbacks) for forwarded detection in XQuery snippets. - Ignored
.vscodeworkspace settings via.gitignore.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main/java/com/marklogic/mapreduce/MarkLogicInputFormat.java | Adds both HTTP and XDBC forwarded checks to the split query and consumes the extra result item. |
| src/main/java/com/marklogic/mapreduce/ContentOutputFormat.java | Updates forwarded-detection XQuery strings to prefer xdmp:is-forwarded() with backward-compatible fallbacks. |
| .gitignore | Adds .vscode to ignored paths. |
Comments suppressed due to low confidence (1)
src/main/java/com/marklogic/mapreduce/MarkLogicInputFormat.java:417
- The parsing of the split query results assumes the extra forwarded-header booleans are always present; with the additional XDBC header query this now does two unguarded
result.next()calls. If the server returns an unexpected sequence (e.g., query error/empty item), this will throwNoSuchElementExceptionand surface as an opaque failure. Consider addinghasNext()checks and throwing anIOExceptionwith a clear message (similar toContentOutputFormat.initialize).
if (!advancedMode && result.hasNext()) {
ResultItem item = result.next();
if (getForwardHeader) {
forwardHeaderExists = item.asString().equals("true");
item = result.next();
forwardHeaderExists |= item.asString().equals("true");
item = result.next();
if (forwardHeaderExists) {
restrictHosts = true;
jobConf.setBoolean(INPUT_RESTRICT_HOSTS, true);
if (LOG.isDebugEnabled()) {
LOG.debug("HTTP compliant mode enabled since x-forwarded-for exists");
}
} // delay disable http mode since the output host may need it
}
localHost = item.asString();
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
NeoSaber
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport isolation support from develop to develop-11.3.
Tests: