You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Dmitry Lukyanov <dl...@ukr.net> on 2010/09/25 14:25:12 UTC

Problem to receive last chunk of https response with httpcore-nio

Hello,

I'm a wso2 esb (synapse) user/developer.
I got a problem with https nio transport.
I tried versions 4.1 alpha1 and 4.1 beta2.

The problem: 
transport failed to receive large (50k) response through nio https.
The connection is keep-alive and chunked. Every time I received only response divisible 
by 8192 and last chunk is never returned.

After digging the logs and code I found that last chunk not returned because 
of the code in this class org.apache.http.impl.nio.reactor.SSLIOSession.java

I changed one line in the code and now it's working.
Now I want to ask somebody who knows the code if this change is ok,
and maybe it should be applied to httpcore:

public synchronized boolean isAppInputReady() throws IOException {
    int bytesRead = receiveEncryptedData();
    if (bytesRead == -1) {
        this.endOfStream = true;
    }
    doHandshake();
    decryptData();
   
    // CHANGED CODE:
    return (this.appEventMask & SelectionKey.OP_READ) > 0
        && (this.inPlain.position() > 0 || (this.endOfStream && this.status == ACTIVE) 
                                          || this.appBufferStatus.hasBufferedInput() );
    // ORIGINAL CODE:
    //return (this.appEventMask & SelectionKey.OP_READ) > 0
    //    && (this.inPlain.position() > 0 || (this.endOfStream && this.status == ACTIVE));

}

--
Regards,
  Dmitry

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Problem to receive last chunk of https response with httpcore-nio

Posted by Dmitry Lukyanov <dl...@ukr.net>.
just registered an issue
https://issues.apache.org/jira/browse/HTTPCORE-236
--
Regards,
  Dmitry

--- Original Message ---
 От кого: "Oleg Kalnichevski"  
 Кому: "HttpComponents Project"  
 Дата: 25 September 2010, 15:45:50 
 Тема: Re: Problem to receive last chunk of https response with httpcore-nio 
 


> On Sat, 2010-09-25 at 15:25 +0300, Dmitry Lukyanov wrote:
> > Hello,
> > 
> > I'm a wso2 esb (synapse) user/developer.
> > I got a problem with https nio transport.
> > I tried versions 4.1 alpha1 and 4.1 beta2.
> > 
> > The problem: 
> > transport failed to receive large (50k) response through nio https.
> > The connection is keep-alive and chunked. Every time I received only response divisible 
> > by 8192 and last chunk is never returned.
> > 
> > After digging the logs and code I found that last chunk not returned because 
> > of the code in this class org.apache.http.impl.nio.reactor.SSLIOSession.java
> > 
> > I changed one line in the code and now it's working.
> > Now I want to ask somebody who knows the code if this change is ok,
> > and maybe it should be applied to httpcore:
> > 
> 
> Dmitry
> 
> Could you please raise a JIRA for this issue [1] and attach your changes
> (preferably in udiff format) to it?
> 
> Oleg
> 
> [1] https://issues.apache.org/jira/browse/HTTPCORE
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Problem to receive last chunk of https response with httpcore-nio

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2010-09-25 at 15:25 +0300, Dmitry Lukyanov wrote:
> Hello,
> 
> I'm a wso2 esb (synapse) user/developer.
> I got a problem with https nio transport.
> I tried versions 4.1 alpha1 and 4.1 beta2.
> 
> The problem: 
> transport failed to receive large (50k) response through nio https.
> The connection is keep-alive and chunked. Every time I received only response divisible 
> by 8192 and last chunk is never returned.
> 
> After digging the logs and code I found that last chunk not returned because 
> of the code in this class org.apache.http.impl.nio.reactor.SSLIOSession.java
> 
> I changed one line in the code and now it's working.
> Now I want to ask somebody who knows the code if this change is ok,
> and maybe it should be applied to httpcore:
> 

Dmitry

Could you please raise a JIRA for this issue [1] and attach your changes
(preferably in udiff format) to it?

Oleg

[1] https://issues.apache.org/jira/browse/HTTPCORE



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Problem to receive last chunk of https response with httpcore-nio

Posted by "Asankha C. Perera" <as...@apache.org>.
Hi Dmitry
> I'm a wso2 esb (synapse) user/developer.
> I got a problem with https nio transport.
> I tried versions 4.1 alpha1 and 4.1 beta2.
>
> The problem:
> transport failed to receive large (50k) response through nio https.
> The connection is keep-alive and chunked. Every time I received only response divisible
> by 8192 and last chunk is never returned.
>    
I originally wrote the Synapse NIO transport many years back.. I now 
develop the Open Source UltraESB (AGPL) which still uses the excellent 
HttpComponents/NIO 4.1-beta-1

I just tested the UltraESB with payloads of 10K and 100K for both 
incoming and outgoing SSL payloads and things work fine! Hence the bug 
seems to be in the Synapse/WSO2 ESB code - can you confirm exactly which 
of these you use and the version?

cheers
asankha

-- 
Asankha C. Perera
AdroitLogic, http://adroitlogic.org

http://esbmagic.blogspot.com





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org