-
Notifications
You must be signed in to change notification settings - Fork 380
Don't quote the multipart boundary header. #63
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
Conversation
This is be more broadly compatible than the quoted version, although the quoted version is what's described by the spec. curl and browsers send unquoted boundaries, so we can safely assume that any server will support them. Closes #61
@@ -83,7 +83,7 @@ class MultipartRequest extends BaseRequest { | |||
ByteStream finalize() { | |||
// TODO(nweiz): freeze fields and files | |||
var boundary = _boundaryString(); | |||
headers['content-type'] = 'multipart/form-data; boundary="$boundary"'; | |||
headers['content-type'] = 'multipart/form-data; boundary=$boundary'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll have to remove 39 ('
) and 61 (=
) in _BOUNDARY_CHARACTERS
for this to really work. I'd actually leave just alpha-numerics, 95 (underscore) and 45 (hyphen). I think all others play some special role in URL encoding, so I'd leave them out just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are the suspicious ones:
39: '
40: (
41: )
43: +
44: ,
46: .
47: /
58: :
61: =
63: ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to go alphanumeric-only unless we absolutely have to, but I've removed all the characters that aren't valid in MIME tokens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
FYI, this change causes the following tests to fail: https://github.com/dart-lang/http/blob/0.11.3%2B12/test/multipart_test.dart FYI, I've disabled the tests internally when bumping the version of |
@yjbanov any chance you could look at the failing tests? |
I'll take a look. |
This is be more broadly compatible than the quoted version, although the quoted version is what's described by the spec. curl and browsers send unquoted boundaries, so we can safely assume that any server will support them. Closes dart-lang#61
This is be more broadly compatible than the quoted version, although the quoted version is what's described by the spec. curl and browsers send unquoted boundaries, so we can safely assume that any server will support them. Closes dart-lang#61
This is be more broadly compatible than the quoted version, although the
quoted version is what's described by the spec. curl and browsers send
unquoted boundaries, so we can safely assume that any server will
support them.
Closes #61