-
-
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
Issue with MultipartReader #2302
Comments
looks like in my example the lines were separated by \n's, and not \r\n |
I've traced this back to the fact that the default linesep for the email module in python is '\n': https://github.com/python/cpython/blob/master/Lib/email/_policybase.py#L163 used by https://github.com/google/google-api-python-client/blob/master/googleapiclient/http.py#L1328 since policy=None. So the question is should aiohttp check for '\n' + boundary or `\r\n' + boundary as it currently does. |
in particular the issue is on this line: https://github.com/aio-libs/aiohttp/blob/master/aiohttp/multipart.py#L324 |
https://tools.ietf.org/html/rfc7578 explicitly states CRLF as a separator. |
Only if optional to be explicitly enable by user. From Python docs about
I think we should stay with RFC by default. |
Well it's working with Google servers. We should check how other servers
behave.
…On Oct 5, 2017 2:13 AM, "Alexander Shorin" ***@***.***> wrote:
Only if optional to be explicitly enable by user.
From Python docs about linesep:
It defaults to ``\n`` because that is the most useful value for Python application code (other library packages expect ``\n`` separated lines). ``linesep=\r\n`` can be used to generate output with RFC-compliant line separators.
I think we should stay with RFC by default.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2302 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AD0P_f4VmhADU5gqVrpqjSm-Z59OHLpmks5spJ3AgaJpZM4PuS4i>
.
|
I don't think this check will change everything. We must follow the specifications in all the questions. That's the only way to make sure we're doing everything right. However, we have to admit that life is...complicated and legacy still exists and backward compatibility with ancients still have to be preserved by major providers etc. etc. For such cases, if they are really worth to be supported (and if they cannot fix their code due to same BC), well, some fix may have to be implemented, but as opt-in feature. Even not all browsers correctly support multipart spec, so I think some room of customization is possible here. |
The issue is still waiting for a hero. |
btw, I'd like to be able to optionally support both styles, so perhaps a boolean instead of specify if should allow for both? |
Do you mean a heuristic for detection what style should be used by the reader, |
yes, ala |
@thehesiod would you work on implementation? |
ya I'll give it a shot |
Cool! |
Nota benehttps://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.3 (but it's obsolete since June 2014 by RFC7230):
(https://stackoverflow.com/a/5757349/595220) https://tools.ietf.org/html/rfc7231#section-3.1.1.3:
|
I'm trying to mock the google API batch endpoint which takes a multipart request. It ends up sending a request like this:
with headers:
And with a handler like the following:
I get the exception:
seems like it's not correctly determining the boundary
The text was updated successfully, but these errors were encountered: