-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathcurl.ldoc
175 lines (155 loc) · 3.91 KB
/
curl.ldoc
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
---
-- Provide same functions as `lcurl` module with some additions.
-- Here are the only functions that have been added or changed.
--
-- @module cURL
do
--- Create HTTP multipart/formdata object.
--
-- @tparam FORM_DESCRIPTION form description
-- @treturn[1] Form new curl HTTP Post object context
--
-- @see FORM_DESCRIPTION
function form() end
end
do
--- Form description table.
--
-- @table FORM_DESCRIPTION
-- @tfield string|form_stream|form_file|form_buffer|form_content content_name
--
-- @usage
-- post_form = cURL.form{
--
-- -- file form filesystem
-- name01 = {
-- file = "post_form.lua",
-- type = "text/plain",
-- name = "post.lua",
-- },
--
-- -- file form string
-- name02 = {
-- data = "<html><bold>bold</bold></html>",
-- name = "dummy.html",
-- type = "text/html",
-- },
--
-- -- file form stream object
-- name03 = {
-- stream = Stream:new('8', 25),
-- name = "stream1.txt",
-- type = "text/plain",
-- headers = {
-- "X-Test-Char : 8",
-- "X-Test-length : 25",
-- }
-- },
--
-- -- file form stream function
-- name04 = {
-- stream = stream,
-- length = length,
-- name = "stream2.txt",
-- type = "text/plain",
-- },
--
-- -- content form string
-- name05 = 'value05',
--
-- -- content form string
-- name06 = { 'value06', -- or content = 'value05'
-- type = "text/plain",
-- },
--
-- }
--- Table describe stream part in form.
--
-- @table form_stream
-- @tfield function|table|userdata stream stream function is same as in readfunction.
-- Also stream object may provide `length` method.
-- @tfield[opt=stream:length()] number length
-- @tfield[opt] string name file name
-- @tfield[opt] string type mime type (e.g. 'text/plain')
-- @tfield[opt] table headers array of headers
--
--- Table describe file part in form.
--
-- @table form_file
-- @tfield string file path to file in local FS (e.g. 'path/to/some/file.txt')
-- @tfield[opt=basename(file)] string name file name
-- @tfield[opt] string type mime type (e.g. 'text/plain')
-- @tfield[opt] table headers array of headers
--
--- Table describe buffer part in form.
--
-- @table form_buffer
-- @tfield string data file content
-- @tfield string name file name
-- @tfield[opt] string type mime type (e.g. 'text/plain')
-- @tfield[opt] table headers array of headers
--
--- Table describe content part in form.
--
-- @table form_content
-- @tfield string content value (or first field in table)
-- @tfield[opt] string type mime type (e.g. 'text/plain')
-- @tfield[opt] table headers array of headers
--
end
--- HTTP multipart/formdata object
-- @type httpform
--
do
--- Add new part to form.
--
-- @tparam FORM_DESCRIPTION form description
-- @treturn[1] httpform self
--
-- @see FORM_DESCRIPTION
function add() end
end
--- Easy curl object
-- @type easy
--
do
--- Perform a file transfer
--
-- @tparam[opt] table options
-- @treturn[1] easy self
-- @usage
-- e:perfom{writefunction = assert(io.open("fname.txt", "w+b"))}
function perfom() end
--- User data.
--
-- Please use this field to associate any data with curl handle.
--
-- @field data
--
-- @usage
-- f = io.open("lua.org.download", "w+")
-- e = curl.easy{url = "http://lua.org", writefunction = f}
-- e.data = f
end
--- Muli curl object
-- @type multi
--
do
--- Iterator that returns the next data, type and corresponding easy handle.
--
-- <br/>Returned data types: `response`, `header`, `data`, `error`, `done`.
-- <br/>Note. response data may appeare several times (e.g. if you proceed http request
-- with digest auth you should get 401 and 200 responses).
-- <br/> Easy handle is removed at the end of the operation (when get `done` or `error` row).
--
-- @treturn Iterator iterator for generic for
--
-- @usage
-- for data, type, easy in m:iperform() do ... end
function iperform() end
--- User data.
--
-- Please use this field to associate any data with curl handle.
--
-- @field data
end