-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.io.IOException: Server returned HTTP response code: 400 #66
Comments
If you are working in an environment, which does not support sending PATCH requests, and with a server, which does not allow to override the request method, then I do not think there is a solution to this. Can you please test whether your Java environment is able to send PATCH requests? If not, please contact Cloudflare and ask them for help as you are using their servers. |
Hi, In the other hand, I have found a workaround (https://community.hubspot.com/t5/APIs-Integrations/Invalid-HTTP-method-PATCH/m-p/436679) to make the PATCH verb to work in jdk11, but not in above versions. I think the problem is that tus-java-client is using HttpUrlConnection class, and it should be move to another http client. Thank you for your response. Marcos |
You are correct. We have talked about using another HTTP client in #14 and want to work on this in the near future. Your feedback is very helpful for prioritizing this work. |
encounter same problem |
@fujohnwang Are you uploading to CloudFlare as well? |
yes I bypass via some nasty hacking, but it works, and I wrote a blog on this, but in Chinese, Hope it helps if you can figure out via the code part, the blog is here: http://afoo.me/posts/2022-12-06-tus-stuck-in-cloudflare-stream.html just pay attention to the java reflection part and cli/VM options part. |
Thank you, @fujohnwang. The way I understand it is that the current HTTP client inside tus-java-client is not fully compatible with CloudFlare. We will upgrade to a newer HTTP client in the next major release: #78 |
Question
Hi,
I'm getting this error when try to upload a file to Cloudflare servers:
java.io.IOException: Server returned HTTP response code: 400
It seems that the root cause is the following code, at TusUploader.java file
try {
connection.setRequestMethod("PATCH");
// Check whether we are running on a buggy JRE
} catch (java.net.ProtocolException pe) {
connection.setRequestMethod("POST");
connection.setRequestProperty("X-HTTP-Method-Override", "PATCH");
}
Cloudflare does not support the X-HTTP-Method-Override header.
I have found the same error at:
#29
Is there any workaround does not depends on server configuration?
Regards
Marcos
Setup details
Please provide following details, if applicable to your situation:
The text was updated successfully, but these errors were encountered: