Open xiazcy opened 1 year ago
I've done an investigation into this. There doesn't seem to be any changes required in RDF4J to enable this functionality. Trailers should be accessed by adding interceptors to the underlying HttpClient which is already supported. Unfortunately there is a limitation to the HttpClient 4.5 API which renders the trailers inaccessible. This would only be fixed by upgrading to a newer version of HttpClient which is a bit outside of the scope of this issue.
Would this be solved by https://github.com/eclipse/rdf4j/issues/4472 ?
Would this be solved by #4472 ?
Yes it would be solved solved by an upgrade to HttpClient 5. There is also a fix which will be included in the upcoming release of HttpClient 4.5.15 although the 4.5 line is in maintenance mode and I don't necessarily expect a release anytime soon.
Problem description
Hi, I’d like to add a request to support parsing custom headers in server responses, as part of using transfer-encoding (TE) trailers HTTP header (te: trailers, https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer).
One such use case is in Neptune, where in certain cases diagnostic error messages are sent as part of response headers with TE trailers: https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-sparql-http-trailing-headers.html. You would only see a corrupt response with error message otherwise, and when using the rdf4j library to connect, the user would only see unknown record or malformed query errors. In this case, accessing and parsing the response header before deserializing the message itself would allow client access to useful diagnostic information, and avoid output of unnecessary errors.
Preferred solution
The proposed solution would involve adding the ability to get and parse server’s TE headers in the response and pass it the custom code for a proper error handling.
We are currently exploring potential implementations, which we will update here. But suggestions are appreciated. Thank you!
Are you interested in contributing a solution yourself?
Yes
Alternatives you've considered
No response
Anything else?
No response