You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2020/07/03 11:21:40 UTC

[GitHub] [jena] afs commented on a change in pull request #772: JENA-1934: Better error handling for bad HTML forms

afs commented on a change in pull request #772:
URL: https://github.com/apache/jena/pull/772#discussion_r449531367



##########
File path: jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/Dispatcher.java
##########
@@ -373,11 +382,23 @@ public static Operation chooseOperation(HttpAction action) {
 
         // -- Any other queryString
         // Query string now unexpected.
+
         // Place for an extension point.
         boolean hasParams = request.getParameterMap().size() > 0;
         if ( hasParams ) {
+            // One nasty case:
+            // Bad HTML form (content-type  application/x-www-form-urlencoded), but body is not an HTML form.
+            //  map is one entry, and the key is all of the body,
+            if ( WebContent.contentTypeHTMLForm.equals(request.getContentType()) ) {
+                ServletOps.errorBadRequest("Malformed request: unrecognized HTML form request");
+                return null;
+            }

Review comment:
       Ah. I came across it with `curl` but from what you say, code defaults POST to a HTML form if there is no content-type given. I guess the common case other that forms is "just send this file, the other end knows what to do" (i.e. ignore the content-type).
   
   Fuseki dispatch is quite complicated and HTML forms are a possibility for SPARQL Update and SPARQL Query so it's not just simply ignoring `application/x-www-form-urlencoded`.
   
   




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



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org