-
Notifications
You must be signed in to change notification settings - Fork 116
-
Notifications
You must be signed in to change notification settings - Fork 116
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
HttpClient removes Content-Length and causes 411 #656
Comments
Wow, that's pretty wild. This is a Django-based server? It's news to me that Django misbehaves in this way. We'd certainly be happy to accept a patch to add a configuration option to disable the transport framing validation. |
Just a little more insight, I tried adding a body using code like this (this is a Vapor project):
And it went from returning a 411 to returning a 400 and complaining about the body. The odd thing is that in URLSession, it works if I don't pass Content-Length either. I wonder if URLSession is adding it? What could be the difference between how HttpClient does it and URLSession does it? |
When attempting to make GET calls with Django based server, I'm getting a 411 Length Required. Looking at the code in RequestValidation.swift, it is removing
Content-Length
from headers forGET
calls. This may be according to specs but it appears that some servers still require this (probably set to 0). There should be some way to override this behavior or to cause it to force Content-Length to appear in the headers.I have worked around this by implementing my own networking code using
URLSession
and the calls do work since I can control the headers exactly.For reference, the code that is causing the problem is here:
The text was updated successfully, but these errors were encountered: