[ 
https://issues.apache.org/jira/browse/JENA-2257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17480041#comment-17480041
 ] 

Andy Seaborne commented on JENA-2257:
-------------------------------------

Count the number of characters (not codepoints!) that need encoding without 
producing the string. The length is "string length + 2*number of characters".

Except java.net.http also gets involved - it does the unicode->ASCII.

It would be possible to handle 414 internally and retry, though that might end 
up in the situation where many requests do a double network operation.

I believe that nowadays the practical limit is 4K - it used to be 1K - due to 
proxies. Some proxies truncate the URI (414 is a server response not a proxy 
transfer response).

So maybe the best thing is to set the limit lower like1K or 512, and use that 
to allow for encoding. There isn't a perfect answer as far as I am aware.

GET with a query string isn't cached by proxies.

The bug needs fixing (in-progress). Being near to release, better handling 
might have to wait.

 

> QueryExecHTTP#actualSendMode ignores query length causing HTTP 414
> ------------------------------------------------------------------
>
>                 Key: JENA-2257
>                 URL: https://issues.apache.org/jira/browse/JENA-2257
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ, SPARQL
>    Affects Versions: Jena 4.3.2
>            Reporter: Jan Martin Keil
>            Assignee: Andy Seaborne
>            Priority: Major
>
> {_}QueryExecHTTP#actualSendMode(){_}, called in {_}QueryExecHTTP#query(String 
> reqAcceptHeader){_}, does not consider the length of the query. In case of 
> long queries, this causes _414 Request-URI Too Long_ errors, even if 
> {_}sendMode=={_}{_}QuerySendMode{_}{_}.asGetWithLimitBody{_} (default):
> {quote}HttpException: 414 Request-URI Too Long
>     at 
> org.apache.jena.sparql.engine.http.QueryExceptionHTTP.rewrap(QueryExceptionHTTP.java:49)
>     at 
> org.apache.jena.sparql.exec.http.QueryExecHTTP.executeQuery(QueryExecHTTP.java:493)
>     at 
> org.apache.jena.sparql.exec.http.QueryExecHTTP.query(QueryExecHTTP.java:483)
>     at 
> org.apache.jena.sparql.exec.http.QueryExecHTTP.execRdfWorker(QueryExecHTTP.java:339)
>     at 
> org.apache.jena.sparql.exec.http.QueryExecHTTP.execGraph(QueryExecHTTP.java:287)
>     at 
> org.apache.jena.sparql.exec.http.QueryExecHTTP.construct(QueryExecHTTP.java:244)
>     at 
> org.apache.jena.sparql.exec.QueryExecutionAdapter.execConstruct(QueryExecutionAdapter.java:129)
> {quote}
> Workarounds:
>  * _QuerySendMode.systemDefault = QuerySendMode.asPost;_
>  * _QueryExecution.service(…).sendMode(QuerySendMode.asPost)_



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to