I am running the netty http upload example and have one additional requirement that to authentication before upload files; i understand that to upload big files we are using multipart mode to upload, and the server side will read POST request by multiple times.
So my idea is that set token in the request body as first parameter, and when reading chunks I can firstly verify the token ,if does not match cancel the whole request and return some status code to client side.
The point is that how can i cancel the request and send status code appropriately, I had tried like below, but when the channel have closed, the client did not finished sending the request, and will throw "connection reset" exception:
ChannelFuture future = channel.writeAndFlush(response);
future.addListener(ChannelFutureListener.CLOSE);
How to send response back to client during manually reading chunked post msg. In my case send response and close channel when the chunk is not the last chunk ,client side could not get any response.