On 19/02/15 21:56, Martynas Jusevičius wrote:
Hey,

I have some code that adds query parameters to SPARQL Protocol requests.

According to my quick research, the final HTTP query string depends on
com.hp.hpl.jena.sparql.engine.http.Params.httpString():

     public String httpString()
     {
         StringBuffer sbuff = new StringBuffer() ;
         boolean first = true ;
         for (Pair p : pairs())
         {
             if ( !first )
                 sbuff.append('&') ;
             sbuff.append(p.getName()) ;
             sbuff.append('=') ;
             String x = p.getValue() ;
             x = Convert.encWWWForm(x) ;
             sbuff.append(x) ;
             first = false ;
         }
         return sbuff.toString() ;
     }

I see the parameter values being encoded, but not the names, for some
reason? Looks like a bug to me.

Same - could you raise a JIRA so it does not get forgotten about?


Also, the code depends on URLEncoder.encode(), which implements
"application/x-www-form-urlencoded", aka HTML form encoding.

To my understanding, this is different from the URI syntax spec:
https://tools.ietf.org/html/rfc3986

One of the differences is space encoded as "+" vs. "%20".

Am I right that the incorrect encoding is used here (and probably in
similar places)?

Yes - and we have various encoders for different HTTP usages so it looks like it's just usage of old code.

        Andy



Martynas
graphityhq.com


Reply via email to