On Fri, 2016-08-12 at 13:02 +0900, Koji Kawamura wrote: > Hello httpclient community, > > I'm having an issue with HTTPS and HttpAsyncRequestProducer > combination, so I would like to ask for some help. > > I've been using httpclient HttpAsyncRequestProducer to make a > non-blocking HTTP POST request. > My use case consists of two threads, one is pushing data to a channel, > and the other is reading streaming data from that channel, then > producing a POST chunked content. > > It's been working wonderfully with HTTP, but when I tested with HTTPS, > noticed it only sends first few KB of data, even if I'm using the same > client code. > If the whole data size is less that about 8KB, it works, but bigger > than that, further data is not sent. > > Debugging around AbstractContentEncoder and SSLIOSession, but I > couldn't find the exact cause of this behavior yet. But found that > Line Buffer Size is being 8192, it seems this is the threshold of the > behavior. > > Wondering if calling ContentEncoder.write(ByteBuffer) multiple times > causes this issue. It look like once about 8KB data is sent, further > write() doesn't write anything, returning 0 even if the buffer has > remaining data. >
Koji This is how non-blocking I/O works. If the underlying I/O session is unable to accept any more input the write operation returns immediately with zero bytes written instead of blocking the thread. Once the I/O session can accept more input it will trigger #produceContent event again and the producer can produce more data. Please take a look at data producers shipped with the library as reference. Hope this helps Oleg > To illustrate this issue, I wrote a simple test case which POST data > via HTTP and HTTPS. The issue is reproducible. > https://gist.github.com/ijokarumawak/6027ca64eb28fd143acd173d799ffd48 > > Has anyone encountered similar issue? I searched web and JIRA but > couldn't find similar issue.. > Any advice or insight would be appreciated, > > Thanks! > Koji > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org > For additional commands, e-mail: httpclient-users-h...@hc.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org