When uploading a file more than 2 GB (> Integer.MAX_VALUE) thru restlet api, the client is getting connection reset error. I found the code in MonitoredRequest is assuming content length <= Integer.MAX_VALUE, which is not consistent with httpclient or restlet package who are all using "long". Thus it prevents us from uploading a file > 2 GB. I check the latest "simple" package, and it's still assuming the content length within Integer range. I am not sure if this is intentional or it's something you overlooked. Here is the code from 3.1.3:
private int parseLength() throws NumberFormatException {
int index = indexOf("Content-Length");
if(index >= 0){
String text = getValue(index).trim();
return Integer.parseInt(text); // ----> this will throw exception if the content length is > 2gb, i.e. Integer.MAX_VALUE
}
return -1;
}
I have been through the current code to implement this change:
01- it is all easy upto when I got to the implementation of PartListConsumer and FixedConsumer, when handling the buffers' capacity, marks and limits
02- when integrating with other tools such as Apache Wicket or other servlet based API, it then shows up that the proper javax.servlet.ServletRequest#getContentLength() method has return type of int, not long thus being there the size limit origin
I will need more time to understand the chosen strategies for handling of buffers.