maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [maven-wagon] chrisbeckey commented on a change in pull request #72: [MNG-6975] Wagon-HTTP, set content-type when determinable from file extension
Date Fri, 07 Aug 2020 14:19:36 GMT

chrisbeckey commented on a change in pull request #72:
URL: https://github.com/apache/maven-wagon/pull/72#discussion_r467070592



##########
File path: wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
##########
@@ -279,6 +332,20 @@ public boolean isStreaming()
     private static final boolean SSL_ALLOW_ALL =
         Boolean.valueOf( System.getProperty( "maven.wagon.http.ssl.allowall", "false" ) );
 
+    /**
+     * If enabled, then the content-type HTTP header will be set using the file extension
+     * or the stream header to determine the type, <b>enabled by default</b>
+     */
+    private static final boolean AUTOSET_CONTENT_TYPE =
+            Boolean.valueOf( System.getProperty( "maven.wagon.http.autocontenttype", "true"
) );
+
+    /**
+     * If enabled, then an when determining the content type will result in a fatal exception
+     * <b>disabled by default</b>
+     * This flag is only effective when maven.wagon.http.autocontenttype is set.
+     */
+    private static final boolean AUTOSET_CONTENT_TYPE_FATAL =

Review comment:
       I think that the following behavior is simple to explain and therefore favored:
   1.) if autoset is enabled then a content-type header will always be written and defaults
to application/octet-stream when the type cannot be determined
   2.) if autoset is not enabled then the content-type is not written (unless it is done externally
to the wagon library)
   
   So, no exception and the second flag to control the exception behavior is not needed.
   How does that sound?
   Finally, should autoset behavior be enabled or disabled by default? disabled maintains
current behavior, enabled could be said to be consistent with the content-length header, which
is always provided.




----------------------------------------------------------------
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.

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



Mime
View raw message