Module webmachine_multipart

Utility for parsing multipart form bodies.

Copyright © 2009 Basho Technologies

Authors: Justin Sheehy (justin@basho.com), Andy Gross (andy@basho.com).

Description

Utility for parsing multipart form bodies.

Data Types

boundary()

boundary() = string()

The multipart boundary, as taken from the containing message's content-type.

fcontent()

fcontent() = binary()

The body content within a form part.

fheader()

fheader() = {binary(), binary()}

A header name and value supplied within a form part.

fparam()

fparam() = {binary(), binary()}

A key-value parameter from the content-disposition header in a form part.

fpart()

fpart() = {fpartname(), {[fparam()], [fheader()]}, fcontent()}

A single part of a multipart form.

fpartname()

fpartname() = string()

The name from the form field of a form part.

Function Index

find_boundary/1Find the multipart boundary for a request.
get_all_parts/2Turn a multipart form into component parts.
stream_parts/2Similar to get_all_parts/2, but for streamed/chunked bodies.

Function Details

find_boundary/1

find_boundary(ReqData::wrq:wm_reqdata()) -> boundary()

Find the multipart boundary for a request.

get_all_parts/2

get_all_parts(Body::incoming_req_body(), Boundary::boundary()) -> [fpart()]

Turn a multipart form into component parts.

stream_parts/2

stream_parts(StreamStruct::wm_stream(), Boundary::boundary()) -> done_parts | {fpart(), function()}

Similar to get_all_parts/2, but for streamed/chunked bodies. Takes as input the result of wrq:stream_req_body/2, and provides either the atom 'done_parts' when no more parts are available, or a tuple with the next part and a function. That function will have 0-arity and the same return type as stream_parts/2 itself.


Generated by EDoc, Feb 8 2011, 19:14:54.