-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Content-Length header #2062
Comments
Thanks for the quick reply, but that doesn't help me this case, because the CONTENT_LENGTH header is explicitly added when calling Am I missing something? Or did I misunderstood your answer? I tried this: |
Be aware that I'm talking about the header of the multipart section:
|
What is the point for header removing? |
Sorry, my bad. |
... can be closed |
While this isn't a bug per se, I'd still be interested as to why a Content-Length header is added for each part since this isn't specified in any RFC¹. In fact, there was even call to remove bad examples in SIP-related RFCs, where this was used in examples². ¹ RFCs I checked: 1867, 2388, 7230, 7231, 7233 ² https://www.ietf.org/mail-archive/web/sipcore/current/msg04739.html https://www.rfc-editor.org/errata_search.php?rfc=6086&eid=3167 |
@kxepal can you shed a light? |
Well, it's simple.
Probably, we can drop it and feel no sorry, but imagine the case you receive multipart payload with some text and images and you need to decide to do preview or not depending on their size. Much likely you wouldn't let do preview for 3+ MiB images, while small one you would like to. Content-Length header could help you to make a decision long before you start read body part data. You can even skip it with easy - you know how long you should leap to start read the next one. So, it's very helpful hint for your clients and servers. You can ignore it if you like, but when you'll need it - it'll be there. I think 14+X{1-6} additional bytes per body part is not a big price for such opportunities. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Long story short
I would need a simple way to remove the
Content-Length
header line from the multipart section of my POST request.Expected behaviour
I'd expect this line to ensure that.
https://github.com/aio-libs/aiohttp/blob/master/aiohttp/formdata.py#L133
Actual behaviour
This line puts the header back anyway.
https://github.com/aio-libs/aiohttp/blob/master/aiohttp/multipart.py#L789
Steps to reproduce
Your environment
aiohttp==2.2.3
The text was updated successfully, but these errors were encountered: