Hi Oleg,

Thank you very much for your quick reply.

I looked at the example, ZeroCopyPost.java and its super class
BaseZeroCopyRequestProducer.
As you described, produceContent can be called multiple times when
underlying I/O session gets ready to send more data.

I wrote a loop code inside the produceContent, and it was the cause of
this issue.
After I fixed the code to let the framework handle that, data is sent correctly!

I updated the Gist with the corrected implementation.
https://gist.github.com/ijokarumawak/6027ca64eb28fd143acd173d799ffd48

Thanks again for this great product and your help :)


Koji

> 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

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to