zentol commented on a change in pull request #6595: [FLINK-10115][rest] Ignore
content-length limit for file uploads
URL: https://github.com/apache/flink/pull/6595#discussion_r211561089
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/rest/FileUploadHandler.java
##########
@@ -134,12 +140,18 @@ protected void channelRead0(final ChannelHandlerContext
ctx, final HttpObject ms
}
if (httpContent instanceof LastHttpContent) {
+ LOG.trace("Finalizing multipart file
upload.");
ctx.channel().attr(UPLOADED_FILES).set(new FileUploads(currentUploadDir));
- ctx.fireChannelRead(currentHttpRequest);
if (currentJsonPayload != null) {
+
currentHttpRequest.headers().set(HttpHeaders.Names.CONTENT_LENGTH,
currentJsonPayload.length);
+
currentHttpRequest.headers().set(HttpHeaders.Names.CONTENT_TYPE,
RestConstants.REST_CONTENT_TYPE);
+
ctx.fireChannelRead(currentHttpRequest);
ctx.fireChannelRead(httpContent.replace(Unpooled.wrappedBuffer(currentJsonPayload)));
} else {
-
ctx.fireChannelRead(ReferenceCountUtil.retain(httpContent));
Review comment:
Forwarding a single httpContent object that may or may not contain content
always seemed fishy to me, so we now always send an `EMPTY_LAST_CONTENT` object
instead.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services