-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.ocamlinit
49 lines (48 loc) · 1.99 KB
/
.ocamlinit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#require "fmt,angstrom,cstruct";;
#use "lib/http_multipart_formdata.ml";;
let body =
String.concat "\r\n"
[ {||}
; {| this is a preamble text. |}
; {|-----------------------------735323031399963166993862150|}
; {|Content-Disposition: form-data; name="text1"|}
; {||}
; {|text default|}
; {|-----------------------------735323031399963166993862150|}
; {|Content-Disposition: form-data; name="text2"|}
; {||}
; {|aωb|}
; {|-----------------------------735323031399963166993862150|}
; {|Content-Disposition: form-data; name="file1"; filename="a.txt"|}
; {|Content-Type: text/plain|}
; {||}
; {|Content of a.txt.|}
; {||}
; {|-----------------------------735323031399963166993862150|}
; {|Content-Disposition: form-data; name="file2"; filename="a.html"|}
; {|Content-Type: text/html|}
; {||}
; {|<!DOCTYPE html><title>Content of a.html.</title><div>thiasdasdf asdfiasdf asdf asdf as df asdf asdf as df asdf asd fa sdf asd fas df asdf as df asd fas df asdf as df asdfas df asd fa sdf as dfa sdf asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfsadfsadfasdfasdfasdfasdfasdfsadfasdfasdfasdfasdfasdfsadfasdfasdfasdfasdfasdfasdfasdfasdfasdf
asdfasdfasdfasdfasdfasdf|}
; {||}
; {|-----------------------------735323031399963166993862150|}
; {|Content-Disposition: form-data; name="file3"; filename="binary"|}
; {|Content-Type: application/octet-stream|}
; {||}
; {|aωb|}
; {||}
; {|-----------------------------735323031399963166993862150|}
; {|Content-Disposition: form-data; name="file3"; filename="binary"; param1=value1; param2=value2|}
; {|Content-Type: application/octet-stream|}
; {||}
; {|aωb|}
; {|-----------------------------735323031399963166993862150--|} ]
|> Cstruct.of_string
;;
let boundary =
boundary
~content_type:
"multipart/form-data; \
boundary=---------------------------735323031399963166993862150"
|> Result.get_ok;;
let r1 = reader boundary (`Cstruct body);;