hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Using Chunked encoding
Date Fri, 12 Jan 2007 10:56:09 GMT
On Fri, 2007-01-12 at 16:15 +0530, Asankha C. Perera wrote:
> Hi Oleg
> 
> I think I found the issue in
> DefaultNHttpServerConnection:produceOutput(). If the content encoder
> has completed, I think you should flush the buffer before you reset as
> follows, but I leave this upto you to verify.
> 
> thanks
> asankha
> 

Yep, look like you nailed it. I'll review the fix a little more
thoroughly (as well as bits of code which may also have similar issue
with flushing the buffer) and will commit your fix tomorrow night the
latest. Meanwhile you should probably fork the
DefaultNHttpServerConnection class in your project. 

Many thanks for this contribution.

Cheers

Oleg



>     public void produceOutput(final NHttpServiceHandler handler) {
>         try {
>             if (this.outbuf.hasData()) {
>                 this.outbuf.flush(this.session.channel());
>             }
>             if (!this.outbuf.hasData()) {
>                 if (this.closed) {
>                     this.session.close();
>                 } else {
>                     if (this.contentEncoder != null) {
>                         handler.outputReady(this,
> this.contentEncoder);
>                         if (this.contentEncoder.isCompleted()) {
> this.outbuf.flush(this.session.channel());
>                             resetOutput();
>                         }
>                     }
>                 }
>                 if (this.contentEncoder == null) {
>                     this.session.clearEvent(EventMask.WRITE);
>                 }
>             }
>         } catch (IOException ex) {
>             handler.exception(this, ex);
>         } finally {
>             // Finally set the buffered output flag
>             this.hasBufferedOutput = this.contentEncoder != null &&
> this.outbuf.hasData();
>         }
>     }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> httpcomponents-dev-unsubscribe@jakarta.apache.org For additional
> commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


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


Mime
View raw message