Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jdk-connector can not stream when POST/PUTing an entity with a known size #5472

Open
nicobrevin opened this issue Nov 17, 2023 · 1 comment

Comments

@nicobrevin
Copy link

nicobrevin commented Nov 17, 2023

It looks like the jdk-connector does not stream a request entity when the Content-Length is known: it has to be buffered or chunked, whereas the HttpUrlConnector can (albeit incredibly slowly because of the default 8KB buffer size) transfer an input stream directly when the content length is set on the request.

Having said this, this is fairly minor as the chunked support seems decent and the back-end I'm talking to (openstack swift) is happy to accept a chunked request.

(Sorry, last one I hope)

@nicobrevin nicobrevin changed the title jdk-connector can not stream an entity with a known size jdk-connector can not stream when POST/PUTing an entity with a known size Nov 17, 2023
@jansupol
Copy link
Contributor

The entity is either chunked when requested so, or buffered, otherwise. When I try to send InputStream and set the Content-Length header, it cannot reproduce your issue.

The HttpUrlConnector uses 4KB default buffer, but you can set the size, for instance by

   ClientConfig config = new ClientConfig();
   config.connectorProvider(new HttpUrlConnectorProvider().chunkSize(BUFFER_SIZE));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants