我使用netty 4.0.9(或12)HttpUploadClient方式发送大(> 8K)的帖子请求。 但是,在第一个块发送到服务器后,服务器发回“100 continue”。 ChunkedWriteHandler没有处理“100 Continue”来发送剩余的块。 相反,100继续传递到顶部处理程序的上游,无法处理。 如何修改ChunkedWriteHandler来处理“100 Continue”响应以恢复发送剩余的块以完成大的post请求?
I have used the netty 4.0.9 (or 12) HttpUploadClient way to send large (>8K) post request. However, after the first chunk sent to the server, the server sent back "100 continue". The ChunkedWriteHandler did not handle the "100 Continue" to send the remaining chunk. Instead, the 100 Continue was passed upstream the top handler which can't handle. How can the ChunkedWriteHandler be modified to handle the "100 Continue" response to resume sending the remaining chunk to finish the large post request?
最满意答案
ChunkedWriteHandler是一个与协议无关的处理程序,因此您不应添加特定于HTTP的任何内容。
相反,您可以更新管道中的最后一个处理程序,以便它理解100-Continue消息。 在编写任何块之前,最好先等待100-Continue响应。
或者,您可以从请求中删除Expect: 100-continue标头,然后HTTP服务器将不会发送此类响应。
This bug is fixed in 4.0.15 for the AbstractMemoryHttpData.java getChunk() function.
The exception was IllegalReferenceCountException in AbstractByteBuf.java.
However, in the ChunkedWriteHandler.java doFlush(), there is catch(final Throwable t), which may prevent any future other exception to propagate unless explicitly check it.
更多推荐
发布评论