Skip to content
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

Allow fully qualified multipart content-type header #1423

Merged
merged 1 commit into from Feb 18, 2015

Conversation

simov
Copy link
Member

@simov simov commented Feb 12, 2015

Fixes #1416

The problem here was with poorly written logic about the boundary field in multipart/related content-type header. Now we allow fully qualified multipart headers, including ones containing their own boundary, in that case the boundary property is set from the content-header for that instance (see test-multipart.js)

I've done some major refactoring on the chunked detection tests and moved them to test-multipart-chunked.js I also fixed the logic where the transfer-encoding header overrides the value set through the chunked key, because the header wasn't removed anyway, and I don't think that should be the case either. Probably the previous tests were not catching this edge case.

Major refactoring on multipart chunked detection tests
@simov
Copy link
Member Author

simov commented Feb 17, 2015

@pronvit can you test out this branch and see if it works for your case?

simov added a commit that referenced this pull request Feb 18, 2015
Allow fully qualified multipart content-type header
@simov simov merged commit 7ef212f into request:master Feb 18, 2015
self.request.setHeader('content-type', 'multipart/related; boundary=' + self.boundary)
} else {
if (header.indexOf('boundary') !== -1) {
self.boundary = header.replace(/.*boundary=([^\s;])+.*/, '$1')
Copy link

Choose a reason for hiding this comment

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

([^\s;])+ picks the first character of the boundary, should be ([^\s;]+)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for pointing that out @assaf the bug was fixed here #1505 I had a faulty test for that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content-Type header incomplete for "multipart/related" requests
2 participants