kwin commented on code in PR #895:
URL: https://github.com/apache/maven/pull/895#discussion_r1038147559


##########
maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java:
##########
@@ -209,6 +211,76 @@ public DefaultRepositorySystemSession 
newRepositorySession(MavenExecutionRequest
 
                 XmlPlexusConfiguration config = new 
XmlPlexusConfiguration(dom);
                 configProps.put("aether.connector.wagon.config." + 
server.getId(), config);
+
+                // Translate to proper resolver configuration properties as 
well (as Plexus XML above is Wagon specific
+                // only)
+                // but support only configuration/httpConfiguration/all, not 
the per-method nonsense
+                // 
https://maven.apache.org/guides/mini/guide-http-settings.html
+                Map<String, String> headers = null;
+                Integer connectTimeout = null;
+                Integer requestTimeout = null;
+
+                PlexusConfiguration httpHeaders = 
config.getChild("httpHeaders", false);
+                if (httpHeaders != null) {
+                    PlexusConfiguration[] properties = 
httpHeaders.getChildren("property");
+                    if (properties != null && properties.length > 0) {
+                        headers = new HashMap<>();
+                        for (PlexusConfiguration property : properties) {
+                            headers.put(
+                                    property.getChild("name").getValue(),
+                                    property.getChild("value").getValue());
+                        }
+                    }
+                }
+
+                PlexusConfiguration connectTimeoutXml = 
config.getChild("connectTimeout", false);
+                if (connectTimeoutXml != null) {
+                    connectTimeout = 
Integer.parseInt(connectTimeoutXml.getValue());
+                } else {
+                    // fallback configuration name
+                    PlexusConfiguration httpConfiguration = 
config.getChild("httpConfiguration", false);
+                    if (httpConfiguration != null) {

Review Comment:
   maybe instead of the nested if, just `config.getChild("httpConfiguration", 
true).getChild("all", true).getChild("connectionTimeout", false)`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to