Skip to content

Conversation

@nex3
Copy link
Member

@nex3 nex3 commented Mar 6, 2017

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

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
// 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';
Copy link
Contributor

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.

Copy link
Contributor

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: ?

Copy link
Member Author

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.

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nex3 nex3 merged commit 9076857 into 0.11.x Mar 7, 2017
@nex3 nex3 deleted the multipart-boundary branch March 7, 2017 20:58
@tvolkert
Copy link
Contributor

FYI, this change causes the following tests to fail:

https://github.com/dart-lang/http/blob/0.11.3%2B12/test/multipart_test.dart
https://github.com/dart-lang/http/blob/0.11.3%2B12/test/io/multipart_test.dart

FYI, I've disabled the tests internally when bumping the version of package:http within Google.

@kevmoo
Copy link
Member

kevmoo commented Mar 28, 2017

@yjbanov any chance you could look at the failing tests?

@yjbanov
Copy link
Contributor

yjbanov commented Mar 29, 2017

I'll take a look.

yjbanov pushed a commit to yjbanov/http that referenced this pull request Mar 30, 2017
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
donny-dont added a commit to donny-dont/http that referenced this pull request Jun 24, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants