Closed JeanBeaurepaire closed 9 years ago
And what was the real cause of the problem? Is this a bug in apache commons? In redmine implementation? In some http server or proxy? In [anti]virus software on the machine?
Is this an issue with simple vs multipart post? Or is this an issue with Content-Lenght header? Resolutions could be different. Maybe creating multipart request with stream source is a better solution?
I am very suspicious about Content-Length header (and other fixed lenghts in the requests). Usually, reading file length and then sending a file is not an atomic operation. So file could be changed after its length was read. How the guilty component (if any) will behave if Content-Lenght is different from an actual conetnt length?
Content-Lenght is automaticaly set , i didn't do changes about this. But multipart-request doesn't works. Only application/octet-stream works with REST Redmine api ( see doc on redmine website ) . I have found this solution because it works with my utilisation, but if you found a general utilisation better than this, you can ! :-)
First of all, there's no pom.xml here - gradle is used to build the project, not maven (makes me wonder where have you found POM file here). Then, updating httpclient/httpcore to 4.4 breaks the build for me:
D:\projects\git\redmine-java-api-keritaf\src\main\java\com\taskadapter\redmineapi\internal\Transport.java:592: error: exception UnsupportedEncodingException is never thrown in body of corresponding try statement
} catch (UnsupportedEncodingException e) {
^
UnsupportedCharsetException
is now thrown instead. And there are lots of deprecations between 4.2 and 4.4 so I propose a migration to new API.
And could you please explain what is actually broken here?
I appreciate when people help out with this library. but to keep the quality on a certain level we cannot accept pull requests that do not have tests or detailed explanation of what is wrong and how the fix will address that.
switching to newer Httpclient library (4.5.1) is not an option yet - see problems with pools in https://github.com/taskadapter/redmine-java-api/issues/212
I found the bug. You can't upload InputStream because big files seems to plant . You need to use a File type on your files.
I added the class upload(File content), and you need to add the last version of httpclient and httpcore (4.4) , and add httpmime to your pom.xml :
I didn't delete upload(InpuStream content) but she is useless now .