package yurt

  1. Overview
  2. Docs
exception Invalid_multipart_form
val urlencoded : Cohttp_lwt.Body.t -> (string, string list) Stdlib.Hashtbl.t Lwt.t

Parse URL encoded form

val urlencoded_list : Cohttp_lwt.Body.t -> (string * string list) list Lwt.t
val urlencoded_json : Cohttp_lwt.Body.t -> Ezjsonm.t Lwt.t

Parse URL encoded form into JSON

There are a couple of big things from RFC2388 that aren't implemented yet: * 1. multipart/mixed content type may not be parsed correctly. * 2. content-transfer-encoding is currently ignored.

type multipart = {
  1. mutable data : char Lwt_stream.t;
  2. mutable name : string;
  3. attr : (string, string list) Stdlib.Hashtbl.t;
}
val line_regexp : Str.regexp
val equal_regexp : Str.regexp
val semicolon_regexp : Str.regexp
val split_semicolon : string -> string list
val get_attr : multipart -> string -> string list
val is_file : multipart -> bool

Return true when the multipart object has a filename attribute

val is_multipart_regexp : Str.regexp
val is_multipart : Cohttp_lwt_unix.Request.t -> bool
val multipart : Cohttp_lwt_unix.Request.t -> Cohttp_lwt.Body.t -> multipart list Lwt.t
type form =
  1. | Multipart of multipart list
  2. | Urlencoded of (string, string list) Stdlib.Hashtbl.t
val parse_form : Cohttp_lwt_unix.Request.t -> Cohttp_lwt.Body.t -> form Lwt.t

Parse URL encoded form

OCaml

Innovation. Community. Security.