Re: [Resin-interest] chunked encoding issue in HmuxResponse
On Sep 14, 2009, at 5:11 AM, Wu Wesley wrote: affected version: Resin 4.0.0 4.0.1 reproducible: every time HmuxResponse.writeHeadersInt should not always return false, otherwise in ResponseStream write-chunk5 will never happen if _chunkedEncoding==false. this result in UTF8Writer produces a reproducible error. I've just filed this as http://bugs.caucho.com/view.php?id=3686, although we've already redesigned that code significantly, so it may not apply -- Scott I modified HmuxResponse.writeHeadersInt to add some lines below: // add by wesley start boolean hasContentLength = false; // add by wesley end if (_contentLength = 0) { cb.clear(); cb.append(_contentLength); _req.writeHeader(Content-Length, cb); // add by wesley start hasContentLength = true; // add by wesley end } else if (length = 0) { cb.clear(); cb.append(length); _req.writeHeader(Content-Length, cb); // add by wesley start hasContentLength = true; // add by wesley end } ... // add by wesley start boolean isChunked = false; if (!hasContentLength !isHead) { isChunked = true; } return isChunked; // add by wesley start } and everything goes fine. -Wesley ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] chunked encoding issue in HmuxResponse
Thanks Scott. I found my resolution will cause another bug :( so don't use my code. waiting for the 4.0.2 :) - Wesley 2009/9/17 Scott Ferguson f...@caucho.com On Sep 14, 2009, at 5:11 AM, Wu Wesley wrote: affected version: Resin 4.0.0 4.0.1 reproducible: every time HmuxResponse.writeHeadersInt should not always return false, otherwise in ResponseStream write-chunk5 will never happen if _chunkedEncoding==false. this result in UTF8Writer produces a reproducible error. I've just filed this as http://bugs.caucho.com/view.php?id=3686, although we've already redesigned that code significantly, so it may not apply -- Scott I modified HmuxResponse.writeHeadersInt to add some lines below: // add by wesley start boolean hasContentLength = false; // add by wesley end if (_contentLength = 0) { cb.clear(); cb.append(_contentLength); _req.writeHeader(Content-Length, cb); // add by wesley start hasContentLength = true; // add by wesley end } else if (length = 0) { cb.clear(); cb.append(length); _req.writeHeader(Content-Length, cb); // add by wesley start hasContentLength = true; // add by wesley end } ... // add by wesley start boolean isChunked = false; if (!hasContentLength !isHead) { isChunked = true; } return isChunked; // add by wesley start } and everything goes fine. -Wesley ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
[Resin-interest] chunked encoding issue in HmuxResponse
affected version: Resin 4.0.0 4.0.1 reproducible: every time HmuxResponse.writeHeadersInt should not always return false, otherwise in ResponseStream write-chunk5 will never happen if _chunkedEncoding==false. this result in UTF8Writer produces a reproducible error. I modified HmuxResponse.writeHeadersInt to add some lines below: // add by wesley start boolean hasContentLength = false; // add by wesley end if (_contentLength = 0) { cb.clear(); cb.append(_contentLength); _req.writeHeader(Content-Length, cb); // add by wesley start hasContentLength = true; // add by wesley end } else if (length = 0) { cb.clear(); cb.append(length); _req.writeHeader(Content-Length, cb); // add by wesley start hasContentLength = true; // add by wesley end } ... // add by wesley start boolean isChunked = false; if (!hasContentLength !isHead) { isChunked = true; } return isChunked; // add by wesley start } and everything goes fine. -Wesley ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest