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

Skip the preamble in MultipartReader. #881

Merged
merged 1 commit into from
May 23, 2016

Conversation

obmarg
Copy link
Contributor

@obmarg obmarg commented May 19, 2016

What these changes does?

This updates the MultipartReader to ignore the preamble of a multipart
message. To quote the RFC:

There appears to be room for additional information prior to the first
boundary delimiter line and following the final boundary delimiter line.
These areas should generally be left blank, and implementations must
ignore anything that appears before the first boundary delimiter line or
after the last one.

To do this, the MultipartReader now acts slightly differently at the
beginning of the file. Instead of looking for a boundary and excepting
if it doesn't find one, it will skip over the initial data looking for
the first boundary and start reading from there.

If it doesn't find any boundary, it will except similar to how it did
before.

How to test your changes?

Parse some multipart responses.

Related issue number

Fixes #880

Checklist

  • Code is written and well
  • Tests for the changes are provided
  • Documentation reflects the changes

This updates the MultipartReader to ignore the preamble of a multipart
message.  To quote the RFC:

> There appears to be room for additional information prior to the first
> boundary delimiter line and following the final boundary delimiter line.
> These areas should generally be left blank, and implementations must
> ignore anything that appears before the first boundary delimiter line or
> after the last one.

To do this, the MultipartReader now acts slightly differently at the
beginning of the file.  Instead of looking for a boundary and excepting
if it doesn't find one, it will skip over the initial data looking for
the first boundary and start reading from there.

If it doesn't find any boundary, it will except similar to how it did
before.

Fixes aio-libs#880
@fafhrd91
Copy link
Member

@kxepal could you review?

@kxepal
Copy link
Member

kxepal commented May 23, 2016

+1

@kxepal
Copy link
Member

kxepal commented May 23, 2016

Sorry for delay /:

@kxepal
Copy link
Member

kxepal commented May 23, 2016

I wonder who does multipart generation with preamble?

@fafhrd91 fafhrd91 merged commit 1d1be84 into aio-libs:master May 23, 2016
@fafhrd91
Copy link
Member

thanks!

@obmarg
Copy link
Contributor Author

obmarg commented May 23, 2016

For the record: the server that I found a preamble in was whatever taleo enterprise edition (http://www.oracle.com/us/products/applications/taleo/enterprise/overview/) uses.

It wasn't a large preamble: just some extra CR-LF pairs. Seems like it's valid to have whatever you want in there though.

@kxepal
Copy link
Member

kxepal commented May 23, 2016

@obmarg good to know, thanks!

@lock
Copy link

lock bot commented Oct 29, 2019

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.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
@obmarg obmarg deleted the fix/multipart-preamble branch October 30, 2019 09:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MultipartReader does not support multipart data with a preamble
3 participants