Skip to content

MultipartReader does not support multipart data with a preamble #880

@obmarg

Description

@obmarg

Long story short

I'm using the MultipartReader to read multi-part data from a 3rd party API. It's response has an extra CRLF pair before the first boundary marker.

It appears from reading the RFC that it's valid to include a preamble before the first boundary, and it should just be ignored

I'm passing a response from this server through aiohttp.MultipartReader.from_response and then calling .next()

Expected behaviour

aiohttp ignores the preamble and returns the first part.

Actual behaviour

I get the exception:

ValueError: Invalid boundary b'', expected b'------=_Part_125656_1263945784.1463662001461'

Steps to reproduce

I've added a failing unit test here: obmarg@8724035

Your environment

Not sure any of it's relevant, but: MacOS, python 3.5.1, aiohttp 0.19.0 (though reproduced with master).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions