From 430ebb927ea86c537fc36593e4572da9002bda4a Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 27 Aug 2014 10:54:51 +0500 Subject: [PATCH] Rename. `httppost` function to `form` --- README.md | 2 +- doc/lcurl.ldoc | 30 ++++++++++++++++-------------- examples/easy.obj.lua | 2 +- src/lcurl.c | 2 +- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 6094e0d..4b8fa88 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ curl:easy() curl:easy() :setopt_url('http://posttestserver.com/post.php') :setopt_writefunction(io.write) - :setopt_httppost(curl.httppost() + :setopt_httppost(curl.form() :add_content("test_content", "some data", { "MyHeader: SomeValue" }) diff --git a/doc/lcurl.ldoc b/doc/lcurl.ldoc index 86f5b97..5c5dbf7 100644 --- a/doc/lcurl.ldoc +++ b/doc/lcurl.ldoc @@ -1,11 +1,11 @@ --- -- @module lcurl - +do --- Create HTTP multipart object. -- --- @treturn[1] httppost new curl HTTP Post object context -function httppost() end +-- @treturn[1] httpform new curl HTTP Post object context +function form() end --- Create Easy object -- @@ -27,8 +27,10 @@ function version() end -- if proto.HTTP then ... -- libcurl support http protocol function version_info() end +end + --- HTTP multipart/formdata object --- @type httppost +-- @type httpform -- do @@ -39,7 +41,7 @@ do -- @tparam[opt] string type provides the content-type for this part -- @tparam[opt] table headers specifies extra headers for the form POST section -- @return[1] self -function httppost:add_content() end +function httpform:add_content() end --- Add new part to form. -- @@ -49,7 +51,7 @@ function httppost:add_content() end -- @tparam[opt] string type provides the content-type for this part -- @tparam[opt] table headers specifies extra headers for the form POST section -- @return[1] self -function httppost:add_buffer() end +function httpform:add_buffer() end --- Add new part to form. -- @@ -60,7 +62,7 @@ function httppost:add_buffer() end -- By default it is basename of path. -- @tparam[opt] table headers specifies extra headers for the form POST section -- @return[1] self -function httppost:add_file() end +function httpform:add_file() end --- Serialize multipart/formdata HTTP POST chain. -- @@ -68,7 +70,7 @@ function httppost:add_file() end -- -- @usage print(post:get()) -- -function httppost:get() end +function httpform:get() end --- Serialize multipart/formdata HTTP POST chain. -- @@ -84,11 +86,11 @@ function httppost:get() end -- post:get(table.insert, t) -- print(table.concat(t)) -- -function httppost:get() end +function httpform:get() end --- Serialize multipart/formdata HTTP POST chain. -- --- This call same as httppost:get(writer.write, writer) +-- This call same as httpform:get(writer.write, writer) -- -- @tparam object writer -- @return[1] self @@ -97,11 +99,11 @@ function httppost:get() end -- f = io.open(...) -- post:get(f) -- -function httppost:get() end +function httpform:get() end --- Free multipart/formdata. -- -function httppost:free() end +function httpform:free() end end @@ -251,9 +253,9 @@ function easy:setopt_readfunction() end --- Set HTTP multipart/formdata -- --- @tparam httppost data +-- @tparam httpform data -- @return[1] self -function easy:setopt_httppost() end +function easy:setopt_httpform() end --- Set HTTP multipart/formdata -- diff --git a/examples/easy.obj.lua b/examples/easy.obj.lua index daddfbb..a291aff 100644 --- a/examples/easy.obj.lua +++ b/examples/easy.obj.lua @@ -121,7 +121,7 @@ function easy:perform(opt) end function easy:post(data) - local post = curl.httppost() + local post = curl.form() local ok, err for k, v in data do if type(v) == "string" then diff --git a/src/lcurl.c b/src/lcurl.c index 45251bb..b78924e 100644 --- a/src/lcurl.c +++ b/src/lcurl.c @@ -74,7 +74,7 @@ static int lcurl_version_info(lua_State *L){ static const struct luaL_Reg lcurl_functions[] = { {"error", lcurl_error_new }, - {"httppost", lcurl_hpost_new }, + {"form", lcurl_hpost_new }, {"easy", lcurl_easy_new }, {"version", lcurl_version }, {"version_info", lcurl_version_info },